Overview
Gateway provides a runtime API for Model Context Protocol (MCP) connections with:- Discovery - Automatic tool discovery from MCP servers with caching
- Filtering - Connection-level and per-subject tool policies (allow/deny lists)
- Execution - Validated tool calls with circuit breaker protection
- Explain - Policy decision transparency for tool access
protocol: "mcp" and communicate via streamable HTTP transport.
MCP Session Lifecycle
Gateway maintains explicit MCP session states:- initialize_required - New connection, needs MCP
initializecall - ready - Session active, tools available
- reinitialize_pending - Temporary failure, attempting recovery
Discovery Cache Policy
Gateway caches MCP discovery results with TTL and stale-if-error fallback:- Fresh (within TTL) - Return cached results immediately
- Stale (past TTL, within stale-if-error) - Attempt refresh, fall back to stale on error
- Expired (past stale-if-error) - Force refresh, fail if unavailable
Circuit Breaker
Gateway opens a per-connection circuit breaker after repeated upstream failures:503 Service Unavailable until cooldown elapses.
List MCP Tools
MCP connection identifier (must have
protocol: "mcp")Discovery refresh mode:
auto- Use cache policy (default)force- Bypass cache and refresh from upstream
Required Headers
RFC 9421 Signature-Input header (same as proxy endpoints)
RFC 9421 Signature header
Namespace identifier
Subject identifier for tool policy filtering
Public key of signing agent
Agent certificate
Response
List of MCP tools filtered by subject policy
MCP server metadata
RFC3339 timestamp of last successful discovery
Example Request
Example Response
Tools are filtered by connection-level and subject-level policies before returning. Denied tools are excluded from the response.
Explain Tool Policy
MCP connection identifier
Tool name (e.g.,
linear.searchIssues)Discovery refresh mode (
auto or force)Response
Tool name being explained
Whether the tool is allowed for the subject
Policy decision source:
connection_allowlist- Connection-level allowlistconnection_denylist- Connection-level denylistsubject_allowlist- Subject-specific allowlistsubject_denylist- Subject-specific denylistdefault_allow- No explicit policy, default allow
Subject identifier from request
Example Request
Example Response (Denied)
Example Response (Allowed)
Call MCP Tool
MCP connection identifier
Tool name to execute (must be in allowlist)
Discovery refresh mode (
auto or force)Request Body
Tool-specific input arguments (validated against tool’s input_schema)
Response
Tool execution results as MCP content blocks
Whether the tool execution failed
Example Request
Example Response (Success)
Example Response (Tool Error)
Example Response (Tool Denied)
Tool Filtering Policies
Gateway applies multi-level tool filtering:1. Connection-Level Policy
Applies to all subjects using the connection:Explicit tool names to allow (if present, only these tools are exposed)
Explicit tool names to deny (takes precedence over allowlist)
Maximum number of tools to expose (additional tools truncated)
2. Subject-Level Policy
Overrides connection policy for specific subjects:Subject policies are keyed by
sigilum-subject header value. Wildcard patterns are supported in allowlist/denylist.Policy Evaluation Order
- Check subject-level denylist → deny if matched
- Check subject-level allowlist → allow if matched, deny if allowlist present but not matched
- Check connection-level denylist → deny if matched
- Check connection-level allowlist → allow if matched, deny if allowlist present but not matched
- Default → allow
Rate Limiting
MCP tool calls are rate-limited per connection + namespace:Retry Behavior
Gateway retries MCP requests only for retryable conditions: Retryable:- Network timeouts
- HTTP 429 (Too Many Requests)
- HTTP 502, 503, 504 (Temporary upstream failures)
- HTTP 4xx (except 429)
- Tool policy denials
- Invalid request formats
MCP Connection Configuration
HTTP MCP Connection
MCP with Query Parameter Auth
MCP connections support optional auth secrets. Only configure
auth_mode and secrets when the upstream MCP server requires credentials.Discovery Workflow
To set up a new MCP connection:- Create Connection via
POST /api/admin/connectionswithprotocol: "mcp" - Run Discovery via
POST /api/admin/connections/{id}/discover?refresh=force - Review Tools in
mcp_discovery.toolsfield - Configure Policies via
PATCH /api/admin/connections/{id}to set allowlist/denylist - Test Runtime via
GET /mcp/{id}/toolswith signed request
Error Scenarios
Circuit Breaker Open
Discovery Cache Unavailable
Invalid Tool Arguments
Next Steps
Admin Endpoints
Learn how to create and discover MCP connections
Proxy Endpoints
Explore HTTP proxy functionality