SemFW: Intent-Bound Authorization & Signed Passports for MCP Tool Calls

Standard OAuth and DPoP authorization in the Model Context Protocol (MCP) validates which tools a client may access at token issuance—not whether a specific tool call matches the user's task. SemFW (arXiv:2612.03586) introduces a trusted intent issuer signing per-task ES256 passports, an inspecting MCP proxy, and body-bound DPoP proofs verified in Tamarin 1.12, slashing in-scope attack success from 100% to <=4.2% (0% with Llama-3.1-8B/Gemma-4-E4B) while passing 88.2% of benign calls.
SemFW: Intent-Bound Authorization & Signed Passports for MCP Tool Calls: Standard OAuth and DPoP authorization in the Model Context Protocol (MCP) validates which tools a client may access at token issuance—not whether a specific tool call matches the user's task. SemFW (arXiv:2612.03586) introduces a trusted intent issuer signing per-task ES256 passports, an inspecting MCP proxy, and body-bound DPoP proofs verified in Tamarin 1.12, slashing in-scope attack success from 100% to <=4.2% (0% with Llama-3.1-8B/Gemma-4-E4B) while passing 88.2% of benign calls. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.
- Zero Scope & Resource Escalation: Deterministic ES256 passport enforcement stops 100% of out-of-scope tools, unbound URI reads, and JSON-RPC batch smuggling (0/5 exploits across X1-X12).
- Cuts In-Scope Misuse from 100% to 0%-4.2%: Hardened local inspector models (Qwen2.5-3B, Llama-3.1-8B, Gemma-4-E4B) block semantic hijacking while passing 85.3%-88.2% of benign tool calls.
- Provenance Tracking Slashes False Alarms (32.4% -> 6.9%): Tracking where destination arguments originate in AgentDojo multi-step sessions preserves benign productivity.
- Tamarin 1.12 Formally Verified Protocol: Proves authenticated issuance, confinement, and body-bound DPoP replay prevention, exposing how standard body-less DPoP allows cross-call replay.
import { createAgent } from '@smoke-monkey/harness';// Enforce per-task ES256 passports and fail-closed inspection over MCP tool callsconst agent = createAgent({agentId: 'semfw-guarded-analyst-agent',provider: 'openai-compatible',baseUrl: 'http://127.0.0.1:8080/v1',model: 'meta-llama/Llama-3.1-8B-Instruct',workspacePath: process.cwd(),mcpServers: {semfwProxy: {command: 'npx',args: ['-y', '@smoke-monkey/mcp-semfw-proxy', '--passport-alg', 'ES256'],env: {SEMFW_REQUIRE_INSPECTOR: '1',SEMFW_FAIL_CLOSED: 'true',SEMFW_DPOP_BIND_BODY: 'sha256',},},},permissions: {read_file: 'allow',write_file: 'ask',run_command: 'ask',},});async function main() {const result = await agent.run('Review Q1 sales-q1 records under signed task passport and block any external email exfiltration calls.');console.log('Verified Output:', result.summary);}main().catch(console.error);
Watch: Related Video Guides
Model Context Protocol Clearly Explained | MCP Beyond the Hype
What is MCP? Integrate AI Agents with Databases & APIs
What Is Intent-Bound MCP Authorization and Why Does Standard OAuth Fail?
SemFW (arXiv:2612.03586) is an intent-bound authorization architecture for Model Context Protocol (MCP) agents that cryptographically binds every tool call to the user's original task rather than static client permissions. By combining a per-task ES256 JWT passport with a fail-closed semantic proxy and body-bound DPoP proofs, SemFW cuts indirect prompt-injection attack success from 100% to 0%-4.2%.
Standard MCP OAuth + RAR + DPoP authorizes what tools a client may call at token-issuance time, blind to the user's current request. If an agent reads a poisoned file instructing it to call an authorized generate_report tool and email data to an attacker, static scopes permit the exfiltration—and standard DPoP does not hash the JSON-RPC request body, allowing a captured proof to authorize a different call.
| SemFW Configuration (Corpus E1) | Inspector Model | Attack Success Rate (ASR) | In-Scope Semantic ASR | Benign Pass Rate (%) | Held / Blocked (%) |
|---|---|---|---|---|---|
| C0: Static OAuth Token | None | 100.0% | 100.0% | 100.0% | 0.0% / 0.0% |
| C1: + Intent Scopes (Passport) | None | 79.5% | 100.0% | 97.1% | 0.0% / 2.9% |
| C2: + Resource Binding | None | 61.5% | 100.0% | 97.1% | 0.0% / 2.9% |
| C3: + Deterministic Rules | None | 5.1% | 8.3% | 85.3% | 5.9% / 8.8% |
| C5: + Hardened Model | Qwen2.5-3B | 2.6% | 4.2% | 85.3% | 0.0% / 14.7% |
| C5: + Hardened Model | Llama-3.1-8B | 0.0% | 0.0% | 88.2% | 5.9% / 5.9% |
| C5: + Hardened Model | Gemma-4-E4B | 0.0% | 0.0% | — (hardened) | — |
Tamarin 1.12 Formal Guarantees and Escaped Inspector Mediation
Modeling the protocol in Tamarin 1.12 (verified in 75 seconds) proves seven security properties (P1–P7) across the issuer, proxy, and MCP resource server:
- Single-Request JSON-RPC & Fail-Closed Binding: SemFW rejects JSON-RPC batch arrays (preventing X4 policy smuggling), pins
ES256(rejectingalg=noneor defaultHS256), restrictsresources/readstrictly to catalog-intersected passport URIsR, and denies calls if the inspector times out or returns malformed JSON. - Body-Bound DPoP & Replay Cache (P5): Unlike RFC-standard DPoP—where Tamarin found a replay attack in 16 trace steps when request bodies were omitted—SemFW signs
sigma = sign(<h(pi), h(t, r), pj>, sk_P)and enforces a server-side replay cache. - Hardened Delimiter Escaping & Argument Provenance: Untrusted tool arguments have
<and>escaped inside<untrusted_tool_arguments>tags so payload text cannot close the tag. On AgentDojo multi-step benchmarks, tracking argument provenance cut Gemma inspector false alarms from 32.4% down to 6.9%.
Always Hash the Full Tool Arguments Inside DPoP Proofs
Standard DPoP binds only HTTP method and URI. Because MCP routes every tool invocation over POST /mcp JSON-RPC, omitting a canonical hash of tool name and arguments allows any captured DPoP proof to replay an arbitrary destructive tool call.
Reproducible MCP Passport & Fail-Closed Proxy Guard Check
Validate that your MCP gateway rejects JSON-RPC batch smuggling, alg=none tokens, and out-of-passport resources before forwarding calls:
# Test MCP proxy fail-closed defenses against batch smuggling & alg=none payloads
python3 - << 'EOF'
import json
def validate_mcp_envelope(raw_payload: str, allowed_tools: set, allowed_uris: set):
obj = json.loads(raw_payload)
if isinstance(obj, list):
return (False, "DENY: JSON-RPC batch smuggling rejected (P4)")
if obj.get("method") == "tools/call":
name = obj.get("params", {}).get("name")
args = obj.get("params", {}).get("arguments", {})
if name not in allowed_tools:
return (False, f"DENY: tool '{name}' not in passport scope S (P2)")
uri = args.get("datasetId") or args.get("uri")
if uri and uri not in allowed_uris:
return (False, f"DENY: resource '{uri}' not in passport R (P3)")
return (True, "ALLOW -> forward to hardened semantic inspector")
print(validate_mcp_envelope('[{"method":"tools/call"}]', {"generate_report"}, {"sales-q1"}))
print(validate_mcp_envelope('{"method":"tools/call","params":{"name":"delete_dataset","arguments":{"datasetId":"sales-q1"}}}', {"generate_report"}, {"sales-q1"}))
EOFFrequently Asked Questions
Q:Why cannot standard OAuth scopes stop indirect prompt injection in MCP?
OAuth scopes are granted at session setup based on what tools a user might ever need, without knowing the user's current prompt. An attacker hiding instructions inside a tool output can abuse any broadly authorized tool unless calls are bound to per-task intent.
Q:What happens if the local inspector LLM crashes or times out?
SemFW is strictly fail-closed (Property P6): any inspector outage, timeout, invalid schema, or expired human approval immediately denies the tool call rather than falling back to allow.
Q:Why did naive Qwen2.5-3B and Llama-3.1-8B inspectors perform poorly before hardening?
Naive Llama-3.1-8B blocked 91.2% of benign calls (passing only 2.9%), while naive Qwen2.5-3B allowed 75.0% of in-scope semantic attacks. Escaping XML tags, separating trusted passport metadata, and tracking argument provenance fixed both extremes.
Q:Can an agent spoof a SemFW human approval or mint its own passport?
No. Passport issuance requires the trusted client credential c (Property P1) signed with sk_I, and human approval decisions require an out-of-band approver credential a with HTML-escaped console rendering (Property P7).
Related Alternatives & Comparisons
Related Architecture Guides
View all guidesBest Open Source Coding Agents in 2026: Free, Local & Fully Hackable Harnesses
MCP Server Security Best Practices: Hardening Model Context Protocol Agents in 2026
Open Source Coding Agent Harness: Build a Forkable, Local AI Engineering Runtime
Build with Smoke Monkey Harness
Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.