MCP gateway
How the /mcp endpoint, sessions and authentication work.
Godelgate exposes a single MCP endpoint at /mcp using the Streamable HTTP transport. To clients it looks like one MCP server whose tools are the combined tools of every connected server.
#Authentication
Every request must carry a user key:
http
Authorization: Bearer <user key>Requests without a valid key get 401. Keys and groups are defined in Users and keys.
#Sessions
- A client starts a session by sending an MCP
initializerequest without a session ID. - Godelgate creates the session for that user and returns its ID in the
Mcp-Session-Idheader. - Later requests send that header. A session can only be used with the key that opened it; another key gets
404. - Sessions close when the client ends them, or after one hour without activity.
Each session has its own trifecta markers, so what one conversation read never affects another.
#What happens on a tool call
- Look up the tool by its namespaced name.
- Decide using the decision order: deny rule, quarantine, trifecta, matching rule, default.
- Record the call in the audit log with the decision and reason.
- If the decision is
approve, wait for a human decision. - Forward allowed calls to the upstream server, with a 60-second timeout.
- Update the session's trifecta markers from the tool's labels.
- Record the result and return it unchanged to the client.
Denied calls never reach the upstream server. They return an MCP error result:
json
{
"isError": true,
"content": [{ "type": "text", "text": "Blocked by Godelgate: <reason>" }]
}#Limits
| Limit | Value |
|---|---|
| Request body | 4 MB |
| Upstream call timeout | 60 seconds |
| Idle session lifetime | 1 hour |
| Approval wait | policy.approvalTimeoutSeconds, default 300 |