MCP Gateway
Configure and call governed MCP servers through Odock.
MCP Gateway
The MCP gateway exposes configured MCP servers through a unified route:
/v1/mcp/:identifierThe identifier can resolve to a configured server ID or slug.
MCP Server Model
An MCP server has:
organisationId- optional
teamId - optional
apiKeyId nameslugdescriptiontransport:STREAMABLE_HTTP,SSE, orSTDIOendpointUrlstdioCommandstdioArgsstdioEnvauthType:NONE,BEARER,BASIC,OAUTH2authConfigoauthRequiredenabledisPublicallowedToolsblockedToolspoliciespricingsemanticFilterrateLimitmetadata
Transports
STREAMABLE_HTTP
The gateway proxies the MCP HTTP request to endpointUrl.
SSE
The gateway proxies to an SSE-capable endpoint and treats the request as streaming for rate-limit and observability metadata.
STDIO
The gateway starts the configured command with args and env, exchanges JSON-RPC over stdio, and returns the response.
Use STDIO carefully. It runs a configured local command in the gateway runtime environment.
Access Flow
For every MCP request, the gateway:
- Enforces request concurrency if configured.
- Allows only
GETandPOST. - Checks database availability.
- Assigns request ID and telemetry context.
- Runs pre-auth rate limiting.
- Authenticates the Odock API key.
- Resolves the MCP server by path identifier.
- Requires the server to be enabled.
- Checks
ApiKeyMcpAccess. - Resolves and enforces rate-limit policy.
- Extracts JSON-RPC method and tool name when available.
- Applies allowed and blocked tool lists.
- Reserves budget/quota capacity.
- Proxies the MCP request through the configured transport.
- Reconciles rate-limit usage.
- Settles budget/quota usage.
- Records generic usage and MCP-specific sidecar usage.
Tool Guardrails
Allowed and blocked tool lists are enforced by server configuration.
Recommended pattern:
- leave
allowedToolsempty for broad access during setup, - add
blockedToolsfor known-dangerous tools, - later invert to a strict
allowedToolslist for production keys.
MCP Rate Limits
MCP policies use the same policy envelope as LLM policies. MCP server policies are evaluated under MCP scope.
Example:
{
"policies": {
"ratelimit": {
"requests": { "per_minute": 300 },
"payload": { "max_request_bytes": 262144 },
"concurrency": { "max": 10 }
}
}
}MCP Pricing
MCP pricing is stored as JSON on the server row. The gateway estimates and records:
- call cost,
- input byte cost,
- output byte cost,
- total nanos USD.
The exact keys are interpreted by the current MCP pricing helper in the gateway route. Keep pricing snapshots in metadata if you need external reconciliation.
Calling An MCP Server
curl http://localhost:8080/v1/mcp/my-server-slug \
-H "Authorization: Bearer $ODOCK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": "1",
"method": "tools/call",
"params": {
"name": "search",
"arguments": { "query": "odock" }
}
}'Usage Records
MCP requests are visible in:
- generic usage records,
- MCP usage records,
- Grafana token/usage dashboards where configured,
- logs and traces under provider
mcp.