MCP Gateway integration
Unlike the LangChain, CrewAI, and AutoGen integrations, this isn't a code change. Register your MCP server once, and AGF fronts it — no SDK, no changes to your agent or your MCP server.
1. Register your MCP server
target_url is your MCP server's JSON-RPC endpoint. audience is the aud value your delegation tokens should carry for this gateway. upstream_auth is optional — the bearer token AGF sends to your MCP server, if it requires one. Requires a Growth plan or above.
curl -X POST https://api.agentgovernancefoundation.com/v1/mcp-gateways \
-H "X-AGF-Key: agfk_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "prod-tools-server",
"target_url": "https://mcp.internal.acme.com/mcp",
"audience": "mcp-prod",
"upstream_auth": "your-mcp-servers-own-bearer-token"
}'Response includes the gateway ID you'll route traffic to. The secret is never echoed back.
{
"id": "a1b2c3d4-...",
"name": "prod-tools-server",
"target_url": "https://mcp.internal.acme.com/mcp",
"audience": "mcp-prod",
"enabled": true,
"log_tool_arguments": false,
"timeout_ms": 30000
}2. Point your MCP traffic at the gateway
Call /mcp/{gateway_id} instead of your MCP server directly. tools/call and resources/read — the two methods most likely to have side effects or expose data — need a delegation chain in the X-AGF-Chain header (a JSON array of the same JWTs /v1/decide accepts). Read-only discovery methods like tools/list pass straight through once your API key checks out — no chain needed.
curl -X POST https://api.agentgovernancefoundation.com/mcp/a1b2c3d4-... \
-H "X-AGF-Key: agfk_your_key_here" \
-H "X-AGF-Chain: [\"eyJhbGciOi...\"]" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": { "name": "send_invoice", "arguments": { "customer_id": "cus_123" } }
}'X-AGF-Artifact-ID header so you can correlate it with the audit trail.What a blocked call looks like
A non-ALLOW decision never reaches your MCP server. The caller gets a standard JSON-RPC error instead of an AGF-specific shape — any MCP client already knows how to handle this without new code:
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32000,
"message": "AGF decision: DENY",
"data": { "artifact_id": "dec_...", "approval_request_id": null }
}
}Which methods get a decision
| Method | Decision-gated? | Requires X-AGF-Chain |
|---|---|---|
| tools/call | Yes | Yes |
| resources/read | Yes | Yes |
| initialize, tools/list, resources/list, prompts/*, ping | No — passthrough | No |
Delegation chains travel over this stopgap header today rather than a protocol-native field, since MCP has no standard place to carry one yet — see the MCP Gateway blog post for where this is headed.
Related
Quick start
End-to-end walkthrough from registration to first decision
API reference
Full REST API — /v1/decide, webhooks, JIT credentials
Blog: MCP needs an authorization layer, too
Why MCP tool calls need authorization AGF's protocol doesn't provide
AutoGen integration
Policy enforcement for AutoGen tool-call handlers

