Skip to main content

Cloud Scoring Integration

The proxy performs local risk scoring first (pattern matching, keyword detection, behavior tracking), then optionally enriches the score via the cloud scoring API which provides graph-based analysis, GNN inference, compliance matching, and LLM-assisted reasoning.

Scoring Flow

Remote scoring never downgrades the local score. The final score is always max(local, remote). This ensures local safety checks are never bypassed by the cloud API.

Configuration

{
  "risk_api": {
    "url": "https://api-production-56df.up.railway.app",
    "api_key": "sk-acme-...",
    "customer_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "enabled": true,
    "timeout_ms": 15000
  }
}
Remote scoring is non-blocking — if the cloud API times out or errors, the proxy falls back to the local score with zero impact on the tool call.

Enriched Event Payload

The proxy sends the full AgentEventCreate schema to the cloud API:
{
  "event_id": "uuid",
  "customer_id": "a1b2c3d4-...",
  "action": "mcp:github:list_repos.list",
  "timestamp": "2025-03-05T10:30:00Z",
  "agent": {
    "agent_id": "anthropic:bold-amber-falcon",
    "agent_type": "claude",
    "framework": "claude-code",
    "model": "claude-sonnet-4-20250514"
  },
  "session": {
    "session_id": "sess-uuid",
    "user_id": "user-123"
  },
  "target": {
    "resource_type": "repository",
    "resource_id": "org/repo",
    "sensitivity_level": 2
  },
  "mcp_context": {
    "server_name": "github",
    "transport": "stdio",
    "is_verified": true,
    "tool_name": "list_repos"
  },
  "parameters": {"org": "acme-corp"},
  "preceding_actions": [
    "mcp:filesystem:read_file.read",
    "mcp:github:search_repos.search"
  ],
  "data_fields_accessed": [
    {"field": "email", "classification": "pii"},
    {"field": "repo_name", "classification": "internal"}
  ],
  "metadata": {
    "local_score": 25,
    "local_level": "low"
  }
}

Automatic Field Extraction

The proxy automatically extracts and classifies data fields from tool call arguments:
ClassificationMatched Patterns
pii_sensitivessn, passport, tax_id, national_id, drivers_license
piiemail, phone, name, address, date_of_birth, ip_address
financialcredit_card, cvv, bank_account, iban, swift
healthmedical, diagnosis, prescription, patient, hipaa
authpassword, api_key, secret, token, private_key
legalcontract, nda, legal_hold, subpoena, litigation
Sensitivity levels: 0 (public) → 1 (internal) → 2 (PII) → 3 (sensitive PII/financial/health) → 4 (auth credentials).

Target Resource Inference

The proxy infers target.resource_type from the MCP server name:
Server NamesResource Type
postgres, mysql, sqlite, mongo, redisdatabase
filesystem, fs, filefile
github, gitlab, bitbucketrepository
slack, discord, teamschannel
vault, secretssecret_store
aws, gcp, azurecloud_service
s3object_store
fetch, httpexternal_api

Session Tracker

The proxy tracks the last 20 actions per session in a 30-minute sliding window, providing behavioral context to the cloud API.
Session key: agent's subject ID (or "default")
Max actions: 20
Window: 30 minutes
The session tracker also provides local behavioral signals:
SignalThresholdDescription
Delegation burst5+ actions in 10sRapid-fire tool calls suggest automated sub-agent spawning
Action rateactions/secondHigh rates may indicate automated scanning
Temporal correlation0.0-0.50Timing similarity between two sessions suggests shared origin

Action Classification

Tool calls are classified into canonical domain:scope:verb format:
MCP MethodAction FormatExample
tools/callmcp:{server}:{tool}.{verb}mcp:github:list_repos.list
resources/readmcp:{server}:resource.readmcp:postgres:resource.read
prompts/getmcp:{server}:prompt.getmcp:slack:prompt.get
Verbs are inferred from tool name prefixes:
PrefixVerb
listlist
get, read, fetch, queryread
search, findsearch
create, add, insertcreate
update, edit, modify, patchupdate
delete, remove, destroydelete
send, post, publishsend
execute, run, execexecute
In forward proxy (HTTP) mode: http:{domain}:{method}.{path_slug}.

Score Response

The cloud API returns a 4-layer score decomposition:
{
  "event_id": "uuid",
  "score": 72,
  "risk_level": "high",
  "violations": ["PII access without justification"],
  "reasoning": "Agent accessed SSN field in customer database...",
  "scoring_source": "graph+gnn+llm",
  "compliance_refs": ["SOC2-CC6.1", "GDPR-Art.32"],
  "mitigations": ["Require approval for PII access", "Enable field-level encryption"],
  "behavioral_flags": ["escalation_pattern", "new_resource_access"],
  "score_decomposition": {
    "intrinsic": 45,
    "gnn": 68,
    "policy": 72,
    "temporal": 55
  },
  "gnn_score": 0.68,
  "confidence": 0.92
}
All enrichment fields (compliance refs, behavioral flags, score decomposition, GNN score, confidence) are persisted to the audit log for dashboard display.

Depth & Burst Penalties

The local scoring engine applies additional penalties for nested agents and burst behavior:
ConditionPenaltyCap
Agent depth > 0depth * 525
Delegation burst (5+ actions in 10s)10 + (count - 5) * 2