Home / Documentation / API Reference

MCP Governance and Security Hardening

Securing the Model Context Protocol integration layer

The MCP integration layer went through six P0 governance controls (P0-1 to P0-6), moving from a half-finished state to production-grade multi-user isolation.

What was fixed

IDVulnerabilityFix
M1Unauthenticated RCE (tool_layers had no authorization)Authorization dependency added to the router; stdio restricted to admin
M2No allowlist for stdio command/argsShell rejection table plus a command allowlist
M3The ToolRouter main path bypassed the firewallFirewall converged into the call_tool main path
M4Governance pre-check extracted only four key namesFull-parameter scanning (scan_all) with graded fail-closed
M5The MCP client was a cross-user singletonFirewall identity threaded per request (injected via ContextVar)
M6No reconnect, backoff, circuit breaking or health probingConfiguration converged and dead paths removed (further work planned in P1)
M7-M10Configuration forks / dead code / key-name bugsStorage converged, lazy ToolEngine acquisition, server_id corrected

Security architecture

request → JWT auth → role gate (admin/user) → firewall pre-check → parameter scan → audit persisted → execution
        ↓        ↓          ↓                  ↓               ↓
     L0 entry   L1 isolation    L2 output            L3 audit        L4 data

API

GET    /api/v1/tool-layers/mcp-servers       # list MCP servers (signed-in user)
POST   /api/v1/tool-layers/mcp-servers       # add an MCP (admin)
DELETE /api/v1/tool-layers/mcp-servers/{id}  # delete (admin)
POST   /api/v1/tool-layers/mcp/tool          # call an MCP tool (full firewall scan)