# MCP tools

**Last updated:** 2026-11-23T07:11:23-03:00 (UTC-3)

Every MCP tool is a door into your systems: internal search, tickets, databases. The gateway puts MCP servers behind the same access control as models. A key only lists and calls the tools approved for its team; the server credential stays in the gateway; and every call has a log and a trace, without arguments or results.

| Flag | What it turns on |
| --- | --- |
| `mcp_registry` | The server catalog, visible by scope |
| `mcp_management` | Creating, editing, and deactivating catalog entries |
| `mcp_execution` | Listing and calling tools (boot) |
| `mcp_connect` | Registering and approving servers from the console, with quarantine on schema change |
| `mcp_catalog` | Searching for servers in the official MCP Registry |
| `mcp_team_credentials` | Per-team server credential (BYOK) |
| `mcp_user_oauth` | Per-user OAuth |
| `mcp_health_checks` | On-demand health check |

## Two ways to register a server

| | YAML (boot trust) | Console (`mcp_connect`) |
| --- | --- | --- |
| Who defines the endpoint and grants | The operator, in the YAML, with a rollout | The admin, in the console, without restarting |
| Approval | Tool by tool, in the YAML | Tool by tool, pinned to the hash of the reviewed schema |
| Schema change | Shows up in the health check | The tool goes into quarantine until approved again |

### From the YAML

```yaml
features:
  mcp_registry: true
  mcp_execution: true
mcp_servers:
  - id: knowledge
    name: Knowledge
    transport: streamable_http
    url: https://mcp.example.com/mcp
    scopes: [team:platform]
mcp_execution:
  protocol_version: '2025-11-25'
  allowed_origins: [https://mcp.example.com]
  allowed_private_cidrs: []
  allow_loopback_http: false
  servers:
    - id: knowledge
      endpoint_url: https://mcp.example.com/mcp
      credential_env: MCP_KNOWLEDGE_TOKEN   # optional; bearer sent to the server
      tools:
        - name: search
          allowed_team_ids: [platform]
          allowed_key_ids: [key_from_existing_inventory]
```

The `mcp_servers` registry entry names and scopes the server:

| Key | Default | What it does |
| --- | --- | --- |
| `mcp_servers[].id` | required | Unique server ID, also the `mcp_execution.servers[].id` of its execution settings |
| `mcp_servers[].name` | required | Display name in the console and the server list |
| `mcp_servers[].transport` | required | `streamable_http`, the only transport the gateway speaks |
| `mcp_servers[].url` | required | The server's address as listed to clients |
| `mcp_servers[].scopes` | `[]` | Who sees the server: `team:<id>`, `group:<id>` and similar scopes |
| `mcp_servers[].disabled` | `false` | Hides the server without removing it |

The execution trust:

| Key | Default | What it does |
| --- | --- | --- |
| `mcp_execution.protocol_version` | `2025-11-25` | MCP revision used toward servers: `2025-11-25`, `2026-07-28` or `auto` ([protocol 2026-07-28](/docs/features/mcp-protocol-2026-07-28/)) |
| `mcp_execution.allowed_origins` | `[]` | Up to 64 exact origins the gateway may call |
| `mcp_execution.allowed_private_cidrs` | `[]` | Up to 32 private networks (RFC 1918/ULA) a server address may resolve to; any other private address is refused |
| `mcp_execution.allow_loopback_http` | `false` | Allows `http://` to loopback, for development only |
| `mcp_execution.servers[].id` | required | The `mcp_servers` entry these execution settings belong to (at most 64) |
| `mcp_execution.servers[].endpoint_url` | required | The server's Streamable HTTP endpoint the gateway calls; its origin must be in `allowed_origins` |
| `mcp_execution.servers[].credential_env` | empty | Variable holding the bearer token sent to the server |
| `mcp_execution.servers[].tools[].name` | required | The upstream tool name the grant allows |
| `mcp_execution.servers[].tools[].allowed_team_ids` | `[]` | Up to 128 teams whose keys may call the tool |
| `mcp_execution.servers[].tools[].allowed_key_ids` | `[]` | Up to 128 key IDs that may call the tool; a grant needs teams, keys or both |
| `mcp_execution.servers[].tools[].description` | empty | Your reviewed description of the tool for [tool search](/docs/features/mcp-tool-search/); the upstream's own text is never copied |
| `mcp_execution.oauth_redirect_url` | empty | The callback registered at every authorization server for [per-user OAuth](#per-user-oauth): exactly `<console origin>/api/v1/admin/mcp/oauth/callback` |

- Endpoint, origins, networks, credential, and grants are boot settings: the console does not widen that boundary.
- `GET /api/v1/admin/config` serves the rest of the block, effective and read-only, as `mcp_execution` (`protocol_version`, `tool_search`, `openapi`, `audit`, `ingress`, `composition`, `scheduled_health` and `servers`). Each `servers` entry carries only `id`, `auth`, `protocol_version`, `allow_user_credential` and `scheduled_health`; endpoint URLs, OAuth and token-exchange profiles, tool grants, credential names, `allowed_origins`, `allowed_private_cidrs` and `oauth_redirect_url` are never served. The MCP servers page lists them under **Execution settings**.
- `allowed_origins` are exact origins (`https://host[:port]`), with no wildcard. The URL does not accept a user, query, fragment, or redirect.
- Private networks (RFC 1918/ULA) only with an explicit CIDR; loopback only with `allow_loopback_http`, for development.
- Within each grant list, **OR** applies; with both lists filled in, **AND** applies. Both empty is refused.

### From the console

With `mcp_connect` (requires `mcp_execution`, `mcp_registry`, `ui`, and PostgreSQL), the **MCP servers** screen and the `/api/v1/admin/mcp/managed-servers` API follow a cycle:

1. **Register or import.** Every server starts as `draft`. The import reads `mcpServers` from Claude Desktop, Cursor, or VS Code: entries with a `url` become drafts; stdio entries are refused, because the gateway does not execute commands; static headers are not imported.
2. **Test.** `initialize` + `tools/list` records a snapshot with the hash of each tool's `inputSchema`. Tools with a schema outside the [supported subset](#supported-schemas) become `unsupported` and cannot be approved.
3. **Approve** tools from that snapshot for explicit teams (no `*`).
4. **Execute.** Only `active` servers, and only for keys of teams with an approval.
5. **Drift.** If the served schema changes, the tool disappears from the listing and the call responds `409 mcp_tool_quarantined`; the server stays `drift_pending` until a new test and a new approval.

Changing the endpoint or the authentication sends the server back to `draft` and deletes the approvals. An `active` server must be deactivated before it can be deleted. The network of a console server reaches only the endpoint's origin; private networks and loopback still depend on the boot policy.

**Discover** (`mcp_catalog`) lists servers from the [official MCP Registry](https://registry.modelcontextprotocol.io) live, with a 10 min cache. **Use** fills in a draft with the remote HTTPS endpoint; nothing runs before the cycle above. Package-only servers (npm, PyPI, OCI) show up as local, because the gateway does not run stdio.

## How to use it

```bash
curl http://localhost:8080/v1/mcp/servers/knowledge/tools \
  -H "Authorization: Bearer $GATEWAY_API_KEY"

curl http://localhost:8080/v1/mcp/servers/knowledge/tools/call \
  -H "Authorization: Bearer $GATEWAY_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"name": "search", "arguments": {"query": "refund policy"}}'
```

A key needs all of the following at once:
1. the `mcp:read` **and** `mcp:execute` scopes (`route:*` does not cover them);
2. all of the server's scopes in the catalog (`team:<id>` compares the key's team);
3. a grant or approval for the tool;
4. and, with [plans](/docs/features/entitlements/), the `mcp_execution` entitlement.

`team_admin` does not issue keys with MCP scopes. A forbidden tool is denied before any connection; a nonexistent one never receives `tools/call`.

**In the console:** the **MCP tools** panel lists and calls tools with a key that lives only in the page's memory, and asks you to confirm each call after you review the name and arguments. Nothing is called when the screen opens. Results appear as escaped text.

## Credentials

- **Server (boot):** `credential_env`, a bearer of 16 to 8,192 bytes in the environment or a Secret.
- **Per team (BYOK):** with `mcp_team_credentials`, `PUT /api/v1/admin/mcp/servers/{id}/credentials/{team}` stores, encrypted, the credential used by that team's keys. Admin and operator manage any team; `team_admin`, their own. The listing shows only the teams, never the value.
- **Per user (OAuth):** see below.

The gateway never passes the client's bearer, cookies, or administrative headers to the MCP server, only the configured credential and `X-Request-Id`/`traceparent`.

### Per-user OAuth

With `mcp_user_oauth`, a server declared with `auth: per_user_oauth` uses **only the user's own token**. Without a token, the call responds `401 mcp_auth_required` with a `connect_url`; it never falls back to the team or boot credential.

```yaml
mcp_execution:
  allowed_origins: [https://mcp.example.com, https://login.example.com]  # include the authorization server
  oauth_redirect_url: https://gateway.example.com/api/v1/admin/mcp/oauth/callback
  servers:
    - id: docs
      endpoint_url: https://mcp.example.com/mcp
      auth: per_user_oauth
      oauth:                       # optional; without client_id, the gateway registers itself (RFC 7591)
        client_id: gateway-mcp
        client_secret_env: MCP_DOCS_CLIENT_SECRET
        scopes: [openid]
        # omit_resource: true      # only for servers that reject RFC 8707
      tools: [{name: search, allowed_team_ids: [platform]}]
```

| Key | Default | What it does |
| --- | --- | --- |
| `mcp_execution.servers[].oauth.client_id` | empty (the gateway registers itself, RFC 7591) | The client pre-registered at the server's authorization server; at most 256 characters, no spaces |
| `mcp_execution.servers[].oauth.client_secret_env` | empty (a public client with PKCE) | The variable holding that client's secret; needs `client_id`. The secret is read from the environment and never stored or returned |
| `mcp_execution.servers[].oauth.scopes` | the `scopes_supported` of the server's RFC 9728 metadata | The scopes each user's authorization asks for; up to 32 |
| `mcp_execution.servers[].oauth.omit_resource` | `false` | Drops the RFC 8707 `resource` parameter, only for authorization servers that reject it |

- Each user connects their own account in **MCP connections**.
- The gateway discovers the authorization server (RFC 9728, RFC 8414/OIDC), requires PKCE S256, sends `resource` (RFC 8707), and uses single-use `state`.
- The token is stored encrypted; refresh is serialized across replicas by a short claim on the grant, without holding a database transaction during the call to the authorization server. Disconnecting revokes at the provider when it publishes a `revocation_endpoint`.
- Only a refusal from the token endpoint (HTTP 400/401, such as `invalid_grant`) ends the connection and asks the user to connect again. A timeout, network error, 5xx, or 429 keeps the grant: the current access token is used while it is still valid, and otherwise the call answers `503 mcp_credentials_unavailable` and can be retried.
- Discovery of the authorization server is cached for ten minutes per server, endpoint, and network policy, so changing a server's URL or the trusted origins takes effect on the next call.
- At execution, the token of the **user who owns the key** applies ([owners](/docs/features/identity-ownership/)). A key without a human owner gets 401.
- Tested against a real Keycloak.

## Groups and toolsets

- A server that requires `group:<id>` in its scopes shows up for keys that reference the group, if the group lists it in `mcp_servers` and the team policy also references the group.
- `access_groups[].mcp_tools` (`server/tool`) restricts the tools for whoever comes in through the group, always within the boot grants.

See [access groups](/docs/features/access-control/#access-groups).

## Health check

With `mcp_health_checks`, admin and operator check a boot server at `POST /api/v1/admin/mcp/servers/{id}/health` or on the catalog card: `initialize` + `tools/list`, without calling tools, within 10 s. The result shows reachability, tool count, present and missing grants, latency, and error class, and compares names and schema hashes with the previous check (tools added, removed, or changed). It lives in process memory and becomes `stale` after 5 min. Nothing is checked automatically; servers with per-user OAuth have no health check.

A failure can trigger the `mcp_health_failed` alert ([alerts](/docs/features/alerting/)).

## Errors

| Code | HTTP | Cause |
| --- | --- | --- |
| `mcp_busy` | 503 | All 4 concurrent operations were busy for more than 3 s |
| `mcp_upstream_timeout` | 504 | The server did not respond within 30 s |
| `mcp_upstream_unauthorized` | 502 | The server responded 401/403 to the gateway's credential |
| `mcp_upstream_unreachable` | 502 | Connection refused, host unreachable, or name not resolved |
| `mcp_upstream_failed` | 502 | Another failure or a profile violation |
| `mcp_tool_quarantined` | 409 | The schema changed since approval |
| `mcp_auth_required` | 401 | The user's OAuth is missing |

**A call is never repeated.** An error, timeout, or dropped connection does not trigger a retry, because a tool may have side effects. Canceling sends `notifications/cancelled`, but the effect may already have happened: check the target system before calling again.

## Supported schemas

The gateway validates arguments locally with a subset of JSON Schema 2020-12: a `type: object` root, simple types (and a union with `null`), `properties`, `required`, `additionalProperties`, `items`, `minItems`/`maxItems`, `minLength`/`maxLength`, `minimum`/`maximum`, and `enum`. `title`, `description`, and `default` are annotations only.

Not accepted: `$ref`, `$defs`, regex, `format`, and combinators (`anyOf`, `oneOf`...). Tools with these constructs are left out. The `outputSchema` is not validated: the result is treated as untrusted data.

## Network protections and limits

- Every resolved IP must be allowed, and the connection goes straight to the validated IP (protecting against DNS rebinding). The environment proxy is turned off. Link-local, cloud metadata, and special ranges are refused.
- Each operation opens its own session with the server; nothing is shared between keys.
- Responses that echo the credential or the session are refused. This does not replace trusting the server.

| Limit | Value |
| --- | --- |
| Concurrent operations | 4 per process |
| Time per operation | 30 s |
| Response / session | 1 MiB / 2 MiB |
| Tools per server | 256, in up to 8 pages |
| Arguments / schema | 64 KiB each |

## Limits

- Protocol **2025-11-25** with Streamable HTTP. Version 2026-07-28 is not supported yet.
- This page's routes are a REST facade over an MCP client. A client that speaks MCP itself (JSON-RPC over Streamable HTTP) uses the [MCP ingress](/docs/features/mcp-ingress/) (`mcp_ingress`) and [composition](/docs/features/mcp-composition/) (`mcp_composition`) instead.
- No stdio, resources, prompts, sampling, elicitation, tasks, or SSE resumption.
- The inference RPM does not count MCP calls; the limit is the concurrency limit above.
- Logs and spans record request ID, server, tool, key, team, duration, and status, never arguments or results. Each authorized call or listing is also a row of the request log (with `usage_analytics`), operation `mcp_tools_call` or `mcp_tools_list`, so its request ID opens its journey and, with the [span store](/docs/features/traces/), its trace (a `tool` span under the request, which names the server). It calls no model provider: the row has no provider, zero model tokens and no valuation, so it counts as a request and as `not_valued` in usage and customer reports, never as an unknown cost. For a durable per-execution record, turn on the [execution audit trail](/docs/features/mcp-execution-audit/) (`mcp_execution_audit`).

## Admin API routes

Every route below needs a console session or an admin Bearer token, the role's permission and, for writes, the `X-CSRF-Token` header; the full contract is in the [API reference](/docs/api/).

| Route | What it does |
| --- | --- |
| `GET /api/v1/admin/mcp/catalog` | Searches the public MCP Registry for servers to add |
| `GET /api/v1/admin/mcp/health` | The cached results of the explicit health checks this replica ran |
| `PUT /api/v1/admin/mcp/servers/{id}` | Creates or overrides the registry entry of a Streamable HTTP server |
| `DELETE /api/v1/admin/mcp/servers/{id}` | Removes a console server, or reverts its override to the YAML |
| `GET /api/v1/admin/mcp/servers/{id}/credentials` | Lists the teams that have their own upstream credential for a server |
| `POST /api/v1/admin/mcp/managed-servers/import` | Imports the `mcpServers` of Claude Desktop, Cursor or VS Code as drafts; nothing becomes executable |
| `PUT /api/v1/admin/mcp/managed-servers/{id}` | Edits a console-managed server; a new endpoint or auth returns it to draft and clears its approvals |
| `DELETE /api/v1/admin/mcp/managed-servers/{id}` | Deletes a disabled managed server with its snapshots and approvals |
| `POST /api/v1/admin/mcp/managed-servers/{id}/disable` | Stops a managed server at the next request, keeping its approvals for audit |
| `POST /api/v1/admin/mcp/managed-servers/{id}/reject` | Marks a draft or pending server as rejected |
| `POST /api/v1/admin/mcp/managed-servers/{id}/test` | Connects through the egress guard, lists the tools and records a new snapshot when something changed |
| `GET /api/v1/admin/mcp/oauth/connections` | The session user's OAuth status on each per-user server: active, needs re-authorization or not connected |
| `POST /api/v1/admin/mcp/servers/{id}/oauth/connect` | Starts the session user's OAuth 2.1 authorization for a server |
| `DELETE /api/v1/admin/mcp/servers/{id}/oauth` | Revokes the session user's grant at the provider, then deletes it |
| `PUT /api/v1/admin/mcp/servers/{id}/credentials/{team}` | Stores a team's own upstream credential for the server, encrypted |
| `DELETE /api/v1/admin/mcp/servers/{id}/credentials/{team}` | Removes the team credential; the team's keys fall back to the boot credential |

## See also

- [MCP and agents](/docs/features/feature-mcp-agents/): overview.
- [A2A agents](/docs/features/a2a-agents/).
- MCP specification: [transports](https://modelcontextprotocol.io/specification/2025-11-25/basic/transports), [tools](https://modelcontextprotocol.io/specification/2025-11-25/server/tools), [cancellation](https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/cancellation).


## Registry schema and execution trust

The existing registry requires explicit `streamable_http` transport. Its creation form may seed that value, but the backend field has no default. Shared [parameter definitions](/docs/reference/parameter-registry/) consolidate this consumed choice without adding SSE, stdio, a protocol version or a client capability. Registry names, URLs and scopes remain typed domain data; execution keeps its separate origin/DNS/CIDR/authentication trust and cumulative key/team/tool/plan checks. Credentials, OAuth references and actual tool grants never become safe parameter metadata.
