GebSecure Docs v0.1.0

Guides · MCP

MCP security gateway

How the gateway fronts MCP servers — registration, scoping, endpoints, sessions and administration.

The MCP gateway (EPIC 11) lets agents use Model Context Protocol servers without holding their credentials and without trusting their tool definitions. Agents connect to GebSecure; GebSecure connects to the upstream servers through the credential broker.

MCP client (agent) ──Bearer <GebSecure token>──▶ gateway /v1/mcp[/{slug}]
                                                   │ validate args · outbound DLP · authorize + risk · approval
                                                   ▼
                                       credential broker (SSRF-safe, credential injected)
                                                   ▼
                                           upstream MCP server
                                                   │ sanitize · inbound DLP · prompt-injection scan (taint)
                                                   ▼
                                       result to the client · audit (mcp.tool.call)

Endpoints#

Endpoint Service Purpose
POST {gateway}/v1/mcp/{slug} gateway JSON-RPC to one registered server (a single message or a batch of up to 50)
POST {gateway}/v1/mcp gateway every server the agent may use; tools and prompts are named {slug}__{name}
DELETE {gateway}/v1/mcp[/{slug}] gateway ends the session given in Mcp-Session-Id (204)
GET {gateway}/v1/mcp[/{slug}] gateway 405 with Allow: POST, DELETE — the gateway does not open server-initiated SSE streams
GET {gateway}/v1/mcp-servers gateway discovery: servers visible to the calling agent
GET {gateway}/.well-known/oauth-protected-resource gateway RFC 9728 metadata (scopes_supported: ["mcp:connect"])
GET/POST {api}/v1/mcp/servers, GET/PATCH/DELETE {api}/v1/mcp/servers/{id} API registry
POST {api}/v1/mcp/servers/{id}/refresh API re-discover tools now (pinning and poisoning checks)
POST {api}/v1/mcp/servers/{id}/tools/{tool}/review API {"decision": "approve" | "block"} for a quarantined tool
GET {api}/v1/mcp/sessions, GET {api}/v1/mcp/sessions/{id} API sessions and their call log

Full schemas: Gateway MCP API and control-plane MCP API.

Registering servers#

POST /v1/mcp/servers (permission mcp:manage) takes projectId (required), an optional environmentId, a slug, name, description, the upstream url, authType (none, bearer, api_key, oauth2) with a vault secretId (required unless none) and authHeader, allowedTools / deniedTools glob lists, requirePinning (default true) and rateLimitPerMinute (default 120, 1–100000). The URL is checked against the SSRF rules when it is saved. PATCH accepts the same fields plus status (active or disabled); null clears a nullable field. Listing and reading servers and sessions require mcp:read.

The upstream credential is a vault secret. For bearer the broker sends Authorization: Bearer <key>; for api_key it sends the key in authHeader (default x-api-key); oauth2 sends the access token of an oauth_token secret. The agent never sees any of them.

Scoping#

An agent sees the servers of its own project (and environment, when the server is environment-scoped). Sessions are bound to the principal and to the scope they were opened with (/v1/mcp or /v1/mcp/{slug}); using a session id from another principal or scope is reported as "not found".

Sessions#

initialize checks the mcp:connect permission, creates a session and returns it in the Mcp-Session-Id response header. Every later request (except notifications) must carry that header, otherwise the gateway answers JSON-RPC error -32000 "Missing Mcp-Session-Id; call initialize first". The negotiated protocol version is the client's when supported (2025-06-18, 2025-03-26, 2024-11-05) and 2025-06-18 otherwise. The initialize result advertises tools, resources and prompts (listChanged: false) and includes instructions telling the client to retry the identical call after an approval.

Supported methods: ping, tools/list, tools/call, resources/list, resources/templates/list, resources/read, prompts/list and prompts/get; anything else is -32601. In the aggregated scope, resources/read needs params.server (resources carry _meta.server).

Authorization names#

MCP operation Action Resource
tools/call mcp:{slug}/{tool} mcp:{slug}/{tool}
resources/read mcp:{slug}/resources.read mcp:{slug}/resource/{uri}

The authorization request carries resourceAttributes {server, tool, annotations, risk: {category}} and the tool arguments as context, so policies can inspect them. Tool annotations set the risk category: destructiveHint: true → delete, readOnlyHint: true → read, otherwise write.

Audit#

The gateway records mcp.session.start, mcp.session.end and mcp.tool.call (with server, tool, duration, DLP and injection outcomes and redacted arguments), and administrative actions mcp.server.register, mcp.server.update, mcp.server.delete, mcp.tool.approve, mcp.tool.block, mcp.tool.poisoned and mcp.tool.changed. Each call also emits the event mcp.tool.called.