
Intent-bound authorization proxy for MCP tool calls: signed intent passports, DPoP sender constraints, and semantic inspection to block prompt-injected agent actions.
Intent-bound authorization for Model Context Protocol (MCP) tool calls: a reference implementation, a benchmark corpus, and a reproducible evaluation.

Most MCP authorization asks "is this agent allowed to call this tool?". This project asks a stricter question:
Should this tool call happen right now, given what the user actually asked for?
The motivating attack is right intent, malicious action: the user's request is legitimate and the agent holds a legitimately issued credential, but the agent has been steered (for example, by prompt injection hidden in a file it read) into a call the user never wanted, such as deleting a dataset, exporting customer emails, or mailing a report to an outside address.
docs/SECURITY_FINDINGS.mdexperiments/README.md| Component | Code | Role |
|---|---|---|
| Intent issuer ("orchestrator") | src/orchestrator/ | Trusted. Accepts the user's prompt from the trusted client, summarizes intent, and signs a Contextual Passport (ES256 JWT) carrying intent summary, tool scopes, resource indicators, audience, and a cnf.jkt sender constraint. |
| Agent | (any MCP client) | Untrusted. Receives the passport, never the issuer credential. |
| Semantic proxy (PEP) | src/semantic-proxy/ | Verifies the passport, then for each JSON-RPC request: method allowlist β tool scope β resource binding β inspector verdict β allow / human approval / block. Forwards with a DPoP-style proof. |
| Inspector | src/inspector/ | Judges whether the call matches the intent: deterministic rules (injection, exfiltration, destructive, sensitive data), a local model with a hardened prompt, or both OR-combined. |
| Protected MCP server | src/protected-resource/ | Official MCP SDK server over Streamable HTTP. Re-verifies passport, audience, DPoP proof (with replay cache), and re-checks scope and binding. |
| Dashboard | public/, src/dashboard/ | Live events, approvals (approver token required), reports. |
Decision policy (decideOnVerdict in src/semantic-proxy/server.js):
VIOLATION_THRESHOLD β allowexport_customer_emails, delete_dataset) β hold for human approvalAUTO_BLOCK_THRESHOLD β block, otherwise holdRequirements: Node.js 20+, npm, and optionally an Ollama host with a local model.
npm ci
OLLAMA_MODEL=qwen2.5:3b npm start
The stack prints an approver token at startup. Open
http://127.0.0.1:4000/dashboard/ and paste the token when you first approve or deny.
In a second terminal:
npm run demo:allow # in-intent report on sales-q1 β executes
npm run demo:block # delete_dataset under a report intent β blocked (scope)
npm run demo:approve # user-granted export, off-intent β held, approved by the demo "human"
npm run demo:guided # narrated version of the whole story
For a talk, use presenter mode on separate ports:
PRESENTER_AUTO_RUN=0 npm run presenter # dashboard on :4500
Without a model host, run INSPECTOR_MODE=heuristic SUMMARIZER_MODE=deterministic npm start.
| Variable | Default | Meaning |
|---|---|---|
OLLAMA_HOST / OLLAMA_URL | 127.0.0.1:11434 | Model host (OLLAMA_URL is the full /api/generate URL) |
OLLAMA_MODEL | qwen3-vl:8b | Model for summarizer and inspector |
INSPECTOR_MODE | ensemble | heuristic, model, or ensemble (model OR heuristic) |
INSPECTOR_PROMPT | hardened | hardened or naive (the original prompt, kept for comparison) |
INSPECTOR_HISTORY | 6 | Recent calls and results per session shown to the model judge; 0 disables |
PROVENANCE | off | Destination provenance: rules or model names the taint detector for tool results. Calls with a destination argument (recipient, IBAN, URL, ...) are held unless every destination comes from the prompt or clean session data |
SUMMARIZER_MODE | model | model or deterministic |
REQUIRE_MODEL | off | 1 makes model failures hard errors instead of falling back to rules |
VIOLATION_THRESHOLD | 0.7 | Minimum confidence for a violation to count |
AUTO_BLOCK_THRESHOLD | 0.95 | Confidence at which a low-risk call is blocked rather than held |
APPROVAL_TIMEOUT_MS | 30000 | A held call is denied when this expires |
PASSPORT_TTL_SECONDS | 300 | Passport lifetime |
ORCHESTRATOR_CLIENT_TOKEN, APPROVER_TOKEN | generated | Otherwise read from .runtime/secrets.json |
MODEL_SEED, MODEL_TEMPERATURE | unset, 0.1 | Sampling controls (used by the experiments) |
LOG_LEVEL | info | Fastify log level |
Keys and secrets are generated on first run under .runtime/ (mode 0600):
orchestrator-signing.json (passport signing key), proxy-identity.json (DPoP key),
secrets.json (client and approver tokens). None of these may be given to the agent process.
In a real deployment each component would hold only its own private key.
What the implementation enforces, and what tests or experiments check it:
scope_source). Only the trusted client can mint passports.alg pinned.resource_indicators; enforced for tools/call and resources/read.jti replay cache; the resource server re-checks scope and binding.prompt_sha256 travels.This project does not claim formal guarantees about model judgement, complete
prompt-injection resistance, a standards-complete OAuth 2.0 / RFC 9449 deployment, or
production key management. Known limitations are listed in
docs/SECURITY_FINDINGS.md and experiments/README.md.
From the evaluation in experiments/ (73 scenarios, three local models).
Aggregated tables are in experiments/results/summary/.

Open Source Identity and Access Management For Modern Applications and Services

OpenID Certified OAuth 2.0 and OpenID Connect provider for token issuance, client management, JWKS, and login/consent flow orchestration via headless APIs for cloud-native applications.

API-first identity and user management system for cloud-native applications. Handles login, registration, MFA, recovery, and profile management with support for OIDC, SAML, and social sign-in.