Skip to content

MCP API

GET /v1/mcp/servers · operation listMCPServers

Metadata catalog filtered by caller scopes; this endpoint does not proxy MCP traffic.

Authentication: bearerAuth

Parameters

Name In Type Description
X-Request-Id header string, max length 128 Correlation ID echoed in the response and forwarded upstream when valid.
traceparent header string W3C trace context. Invalid values create a new trace.

Responses

Status Description Body
200 Visible MCP server definitions application/json: object
401 Missing or invalid bearer key application/json: Error
404 Feature disabled application/json: Error

Response 200 fields:

  • application/json: object

GET /v1/mcp/servers/{id}/tools · operation mcpListTools

Requires boot flag mcp_execution, mcp:read + mcp:execute and cumulative registry scopes plus per-tool boot key/team allowlists. REST facade as an MCP client for profile 2025-11-25, not a general MCP server. Exact pinned trust, bounded JSON/SSE, no redirects or tool-call retries; unsupported schema tools are omitted. No OAuth, stdio, resources, prompts or newer protocol profile implied.

Authentication: bearerAuth

Parameters

Name In Type Description
id path string, required, max length 128

Responses

Status Description Body
200 Authorized bounded MCP response; result.isError can indicate a tool-level error application/json: MCPToolList
400 Invalid request or interval beyond 90 days —
401 Missing key, or mcp_auth_required with connect_url when the server is per_user_oauth and the key owner has not connected (never falls back to a team credential) —
403 Resource or team forbidden —
404 Feature disabled or resource unavailable —
502 Upstream failed; never retried. mcp_upstream_unauthorized (the server refused the gateway credential, HTTP 401/403), mcp_upstream_unreachable (connection refused or name not resolved), mcp_upstream_failed (any other failure or a protocol violation) (ADR 0138) —
503 Storage unavailable, or mcp_busy when every MCP operation slot stayed taken for the admission wait (three seconds, ADR 0138) —
504 mcp_upstream_timeout: the server did not answer within 30 seconds (ADR 0138) —

POST /v1/mcp/servers/{id}/tools/call · operation mcpCallTool

Requires boot flag mcp_execution, mcp:read + mcp:execute and cumulative registry scopes plus per-tool boot key/team allowlists. For an approved OpenAPI source (mcp_openapi_tools, T031.002) the call runs the approved snapshot’s mapping once against its base URL through the egress guard (no redirects, no retries, response at most max_response_bytes or 502 mcp_openapi_response_too_large, 409 mcp_credential_required when the team has no credential); result.structuredContent carries http_status and the JSON body, and isError is true outside 2xx. REST facade as an MCP client for profile 2025-11-25, not a general MCP server. Exact pinned trust, bounded JSON/SSE, no redirects or tool-call retries; unsupported schema tools are omitted. No OAuth, stdio, resources, prompts or newer protocol profile implied.

Authentication: bearerAuth

Parameters

Name In Type Description
X-Gateway-Session-Id header string, min length 1, max length 128 Optional client-declared session or agent-run ID (1–128 printable characters) recorded under session_tracking to group requests in logs. Untrusted metadata: never authorization, routing or cache identity.
X-Gateway-Agent-Id header string, min length 1, max length 128 agent_sessions (T033.002). Optional client-declared agent that made this request (1–128 printable characters), kept with the session’s agent graph. Asserted, never authentication; ignored with the flag off; an invalid or repeated value answers 400 invalid_agent_context.
X-Gateway-Turn-Id header string, min length 1, max length 128 agent_sessions (T033.002). Optional client-declared turn this request belongs to (1–128 printable characters). Asserted; same rules as X-Gateway-Agent-Id.
X-Gateway-Parent-Session-Id header string, min length 1, max length 128 agent_sessions (T033.002). Optional session that spawned this one (a sub-agent run), 1–128 printable characters. Asserted; ignored when equal to X-Gateway-Session-Id; same rules as X-Gateway-Agent-Id.
X-MCP-Subject-Token header string, max length 8192 For a server declared auth token_exchange (T030.007, flag mcp_token_exchange): the end user’s access token (JWT), issued for token_exchange.subject_audience with every scope in token_exchange.scopes, from a key in token_exchange.allowed_key_ids. The gateway verifies it, exchanges it (RFC 8693) for the server audience and verifies the issued token; neither token is returned, cached or forwarded. Errors - 401 mcp_subject_token_required or mcp_subject_token_invalid, 403 mcp_delegation_forbidden, mcp_subject_scope_insufficient or mcp_token_exchange_denied, 502 mcp_token_exchange_invalid, 503 mcp_token_exchange_unavailable or mcp_token_exchange_disabled; nothing is sent upstream.
Idempotency-Key header string, max length 128 With mcp_execution_audit (T030.001), one header of 1-128 visible ASCII characters; a second call by the same key with the same value is refused with 409 mcp_call_already_attempted and never sent again. Stored only as SHA-256. Ignored while the trail is off.
id path string, required, max length 128

Request body (required)

  • application/json: object
    • name (string, required, pattern ^[A-Za-z0-9_.-]{1,128}$)
    • arguments (object) — Optional object defaulting to {}; bounded to 64 KiB and validated against the supported tool schema subset

Responses

Status Description Body
200 Authorized bounded MCP response; result.isError can indicate a tool-level error. With mcp_execution_audit the X-MCP-Execution-Id header names the execution record. application/json: MCPToolResult
400 Invalid request or interval beyond 90 days —
401 Missing key, or mcp_auth_required with connect_url when the server is per_user_oauth and the key owner has not connected (never falls back to a team credential) —
403 Resource or team forbidden —
404 Feature disabled or resource unavailable —
409 mcp_tool_quarantined: a console-managed tool whose schema changed since approval; an administrator must review it again (ADR 0092). mcp_call_already_attempted: the Idempotency-Key was already used by this key (T030.001); X-MCP-Execution-Id names the earlier record and nothing was sent —
502 Upstream failed; never retried. mcp_upstream_unauthorized (the server refused the gateway credential, HTTP 401/403), mcp_upstream_unreachable (connection refused or name not resolved), mcp_upstream_failed (any other failure or a protocol violation) (ADR 0138) —
503 Storage unavailable, mcp_busy when every MCP operation slot stayed taken for the admission wait (three seconds, ADR 0138), or mcp_audit_unavailable when mcp_execution_audit is on with require_record and the execution record could not be written (nothing was sent) —
504 mcp_upstream_timeout: the server did not answer within 30 seconds (ADR 0138) —

GET /v1/mcp · operation mcpComposedStream

No server-initiated stream; 405.

Authentication: bearerAuth

Responses

Status Description Body
405 No event stream —

POST /v1/mcp · operation mcpComposedMessage

Composed MCP ingress (T030.005, flag mcp_composition with mcp_ingress; plan right mcp_composition besides mcp_execution and mcp_ingress). The same protocol, session and error contract as POST /v1/mcp/servers/{id}/mcp, over the servers listed in mcp_execution.composition.servers. initialize answers 404 when the key can use none of them. tools/list merges the tools each listed server grants the key, named <server>__<tool> (a name longer than 128 characters once namespaced, or a duplicate, is left out and named in _meta.ai-gateway/omitted_tools), sorted by name and paged by page_size with a nextCursor bound to the session; each tool carries _meta ai-gateway/server and ai-gateway/tool. A server that fails or exceeds discovery_timeout_seconds is left out of that page and named in _meta.ai-gateway/unavailable_servers. tools/call splits the name at the first __ and runs exactly the per-server call under that server’s grants, once. A server the key cannot use never contributes a tool.

Authentication: bearerAuth

Request body (required)

  • application/json: object

Responses

Status Description Body
200 JSON-RPC response; initialize also returns Mcp-Session-Id —
202 Notification accepted —
400 Invalid message or headers —
401 Missing or invalid key —
403 Forbidden —
404 Feature disabled, no composed server for the key (initialize), or unknown session —
429 Session bound reached —

DELETE /v1/mcp · operation mcpComposedTerminate

Ends the caller’s own composed session.

Authentication: bearerAuth

Parameters

Name In Type Description
Mcp-Session-Id header string, required, max length 128

Responses

Status Description Body
204 Session ended —
404 Unknown, expired or foreign session —

GET /.well-known/oauth-protected-resource/v1/mcp

Section titled “GET /.well-known/oauth-protected-resource/v1/mcp”

GET /.well-known/oauth-protected-resource/v1/mcp · operation mcpComposedResourceMetadata

RFC 9728 metadata of the composed endpoint, published only with mcp_composition and mcp_execution.ingress.public_url.

Authentication: None.

Responses

Status Description Body
200 Metadata —
404 Not published —

GET /v1/mcp/servers/{id}/mcp · operation mcpIngressStream

No server-initiated event stream is offered; answers 405 with Allow POST, DELETE after authentication, as Streamable HTTP allows.

Authentication: bearerAuth

Parameters

Name In Type Description
id path string, required, max length 128

Responses

Status Description Body
401 Missing or invalid key —
404 Feature disabled —
405 No event stream —

POST /v1/mcp/servers/{id}/mcp · operation mcpIngressMessage

MCP ingress (T030.004, flag mcp_ingress with mcp_execution and mcp_registry; plan rights mcp_execution and mcp_ingress). The gateway is an MCP server for protocol revision 2025-11-25 over Streamable HTTP; the body is one JSON-RPC 2.0 message (batches refused) of at most 72 KiB, and every request is answered with one application/json message. Supported: initialize (creates a session owned by the calling key and returns it in Mcp-Session-Id; capabilities are tools only), notifications/initialized, ping, tools/list (the tools the key may run, exactly as GET /v1/mcp/servers/{id}/tools), tools/call (exactly as POST /v1/mcp/servers/{id}/tools/call, never retried; Idempotency-Key is honored as there) and notifications/cancelled (cancels an in-flight call of the same session on the same replica). Any other method gets JSON-RPC error -32601; resources, prompts, sampling, completion, logging and elicitation are not advertised. After initialize every message needs Mcp-Session-Id and MCP-Protocol-Version 2025-11-25 and the same key; a session of another key, terminated or expired answers 404. Requires key scopes mcp:read and mcp:execute; Origin must match the host. Errors of an operation are JSON-RPC errors - -32602 for invalid params or a tool the key may not run, -32001 for a refusal (401/403/409/429 of the REST route, with data.connect_url for per-user OAuth), -32002 for an unavailable server, -32603 for an upstream failure, -32800 for a cancelled call - with data.code (the REST problem code), data.http_status and data.execution_id when the execution trail is on. With flag mcp_protocol_2026_07_28 the endpoint is dual-era (T168): a request whose params._meta carries io.modelcontextprotocol/protocolVersion (or that has no Mcp-Session-Id and no 2025-11-25 header) is served statelessly under revision 2026-07-28, which mcp_execution.ingress.protocol_versions must list. Such a request needs _meta io.modelcontextprotocol/protocolVersion and clientCapabilities (else 400 with -32602), MCP-Protocol-Version equal to it and Mcp-Method equal to the method (else 400 with -32020 HeaderMismatch), and for tools/call Mcp-Name equal to params.name plus every Mcp-Param-{Name} header the tool’s x-mcp-header annotations require, matching the arguments (else 400 with -32020 and nothing is sent). An unserved version answers 400 with -32022 and data.supported. Served methods are server/discover (supportedVersions, tools capability, ttlMs 0, cacheScope private), tools/list (resultType complete, ttlMs 0, cacheScope private) and tools/call (resultType complete); every result carries _meta io.modelcontextprotocol/serverInfo. Other methods (ping, logging/setLevel, subscriptions/listen, resources, prompts) answer 404 with -32601. The gateway codes become -31001 (refused) and -31002 (unavailable), outside the JSON-RPC reserved range. No session is created; each request is authenticated, authorized and audited alone, and closing the connection cancels the call. When the flag is on and 2025-11-25 is not listed, initialize answers 400 with -32022 naming the served versions.

Authentication: bearerAuth

Parameters

Name In Type Description
id path string, required, max length 128
Mcp-Session-Id header string, max length 128 Required after initialize
MCP-Protocol-Version header string, one of "2025-11-25" Required after initialize
Idempotency-Key header string, max length 128 Forwarded to tools/call as on the REST route (T030.001)
X-MCP-Subject-Token header string, max length 8192 Forwarded to tools/call for token_exchange servers as on the REST route (T030.007)

Request body (required)

  • application/json: object — One JSON-RPC 2.0 request, notification or response

Responses

Status Description Body
200 JSON-RPC response; initialize also returns Mcp-Session-Id application/json: object
202 Notification or client response accepted, no body —
400 Parse error, batch, invalid message, missing session or protocol header (JSON-RPC error body) —
401 Missing or invalid key; WWW-Authenticate carries resource_metadata when mcp_execution.ingress.public_url is set —
403 Scope, plan right or cross-origin request forbidden —
404 Feature disabled, server unavailable to the key (initialize), or unknown/expired/foreign session —
413 Message larger than 72 KiB —
429 The key already has mcp_execution.ingress.max_sessions_per_key open sessions —
503 Session storage unavailable —

DELETE /v1/mcp/servers/{id}/mcp · operation mcpIngressTerminate

Ends the caller’s own session (Mcp-Session-Id) for good.

Authentication: bearerAuth

Parameters

Name In Type Description
id path string, required, max length 128
Mcp-Session-Id header string, required, max length 128

Responses

Status Description Body
204 Session ended —
400 Missing Mcp-Session-Id —
401 Missing or invalid key —
404 Feature disabled, or unknown, expired or foreign session —

GET /.well-known/oauth-protected-resource/v1/mcp/servers/{id}/mcp

Section titled “GET /.well-known/oauth-protected-resource/v1/mcp/servers/{id}/mcp”

GET /.well-known/oauth-protected-resource/v1/mcp/servers/{id}/mcp · operation mcpIngressResourceMetadata

RFC 9728 protected-resource metadata of the ingress (T030.004), published only when mcp_ingress is on and mcp_execution.ingress.public_url names the gateway origin (the request Host is never used). The bearer is a gateway key; no authorization server is advertised.

Authentication: None.

Parameters

Name In Type Description
id path string, required, max length 128

Responses

Status Description Body
200 Metadata application/json: object
404 Not published —

Response 200 fields:

  • application/json: object
    • resource (string (uri), required)
    • bearer_methods_supported (array of string, required)
    • resource_name (string)

GET /v1/assets · operation discoverAssets

Requires flag asset_discovery and, under plan entitlements, the asset_discovery right (T031.004). One private listing (sharing the bounded MCP slots, 503 mcp_busy) of what the calling key may use - configured model aliases (key scope route:models), MCP servers and OpenAPI sources (mcp_registry, mcp:read), MCP and generated tools (mcp_execution, mcp:read + mcp:execute) and product skills granted to the key’s team as the skills feed delivers them (skill_registry, skill_marketplace, skills:install) - each read from its own registry with that registry’s rules and the kind’s plan rights, before the query, counts and pagination. No provider or MCP server is contacted. A result is a reference (ref) to the asset’s own route, which checks access again; discovery grants nothing. Unrelated to the anonymous /registry research and the published /hub.

Authentication: bearerAuth

Parameters

Name In Type Description
q query string, max length 256 Lexical search over name, ID and description; without it the order is by kind then ID
kind query string Comma-separated subset of model, mcp_server, api, tool, skill
limit query integer, default 20, min 1, max 100
cursor query string, max length 128 next_cursor of the previous page; bound to the same key, q and kind

Responses

Status Description Body
200 One page of authorized assets application/json: object
400 invalid_request (unknown or repeated parameter, kind, limit, q) or invalid_cursor —
401 Missing or invalid key —
403 Cross-origin browser request or plan without asset_discovery —
404 Feature disabled —
503 mcp_busy when every shared slot stayed taken, or an asset registry or plan lookup is unavailable —

Response 200 fields:

  • application/json: object
    • data (array of object, required)
      • kind (string, required, one of "model", "mcp_server", "api", "tool", "skill")
      • id (string, required)
      • name (string, required)
      • description (string)
      • owner (string, required) — operator, console or team:<id> (skills)
      • source (string, required) — yaml, console, openapi, boot, managed or registry
      • version (string) — Approved snapshot or skill revision when known
      • lifecycle (string, required) — active, granted, approved or published
      • ref (string, required) — Route to use the asset
    • total (integer, required) — Authorized assets matching q and kind
    • counts (object, required) — total per selected kind
      • any other key: integer
    • next_cursor (string)

POST /v1/mcp/code/search · operation mcpCodeSearch

MCP code mode discovery (T031.003). Requires flags mcp_code_mode, extension_javascript, extensions, mcp_execution and mcp_registry, a key with mcp:read + mcp:execute and, under plan entitlements, mcp_execution and mcp_code_mode. Returns at most code_mode.search_limit tools the key may run - server_id, tool and a description cut at 300 bytes, no schemas - ranked lexically; the candidate set is built from the same grants as a call before ranking, and authorized_tools counts only those. An empty query lists in server and tool order.

Authentication: bearerAuth

Request body (required)

  • application/json: object
    • query (string, max length 512)
    • limit (integer, min 1, max 50)

Responses

Status Description Body
200 data (server_id, tool, description) and authorized_tools —
400 invalid_request —
401 Missing or invalid key —
403 Scope, plan right or cross-origin request forbidden —
404 Feature disabled —
503 storage_unavailable —

POST /v1/mcp/code/schema · operation mcpCodeSchema

The live definition of one tool (description and input_schema), read through the same route as GET /v1/mcp/servers/{id}/tools with every grant, scope, quarantine and approved-schema check, and recorded in the MCP execution trail (surface code_mode). Same flags, scopes and rights as search.

Authentication: bearerAuth

Request body (required)

  • application/json: object
    • server_id (string, required, max length 128)
    • tool (string, required, pattern ^[A-Za-z0-9_.-]{1,128}$)

Responses

Status Description Body
200 server_id, tool, description and input_schema —
400 invalid_request —
401 Missing or invalid key —
403 Scope, plan right or cross-origin request forbidden —
404 Feature disabled, or a server or tool the key may not run —
502 The upstream listing failed —

POST /v1/mcp/code/execute · operation mcpCodeExecute

Runs a short JavaScript program (the body of a function; it returns its result) in the extension sandbox - QuickJS on wazero, a fresh instance, no file system, environment, network or clock, no credential or key in reach. The program uses tools.search(query, limit), tools.schema(server, tool) and tools.call(server, tool, args); each is one step through the same route as a direct call, with the key authenticated again and grants checked live (a revoked key stops the run as key_refused), the server credential resolved inside the gateway and the call recorded in the MCP execution trail with surface code_mode and session_id the run ID. A refused or failed step is an exception with a code the program may catch; calls are never retried. Bounds (extensions.code_mode): max_program_bytes, max_steps (then step_limit), timeout_ms for the run, step_timeout_ms per call, max_step_bytes per tool answer, max_result_bytes, heap and memory pages, team_concurrency per replica (429 code_mode_busy). Cancelled when the client disconnects. The response is 200 for any run that started - status ok, program_error, timeout, memory_limit, output_limit, canceled or key_refused - with run_id, result (ok only), error (a bounded message), steps (op, server_id, tool, status, code, execution_id, duration_ms, result_bytes) and metrics (steps, tool_calls, duration_ms, result_bytes, tool_result_bytes). One extension execution record per run (hook code_mode) holds identifiers, outcome and the step trail, never the program, arguments or results.

Authentication: bearerAuth

Request body (required)

  • application/json: object
    • program (string, required, min length 1, max length 262144)

Responses

Status Description Body
200 The run outcome —
400 invalid_request —
401 Missing or invalid key —
403 Scope, plan right or cross-origin request forbidden —
404 Feature disabled —
413 program_too_large —
429 code_mode_busy —
503 code_mode_unavailable —

POST /v1/mcp/tools/search · operation mcpSearchTools

Requires flags mcp_tool_search, mcp_execution and mcp_registry, a key with mcp:read + mcp:execute and, under plan entitlements, mcp_execution and mcp_tool_search (T031.001). Candidates are only the tools this key may call (registry scopes, boot grants or console approvals of active servers without drift quarantine, access-group toolsets), filtered before ranking, counts and embeddings; no MCP server is contacted. Lexical mode uses BM25 over the tool name and the reviewed description. Embedding mode embeds through mcp_execution.tool_search.embedding_model with the caller’s own key (its quotas, budget and usage apply), at most max_embedding_inputs texts per search; the query is embedded on every search and only tool vectors are cached, per team. Searches share the MCP operation slots (503 mcp_busy). A result grants nothing; calls still go through the execution routes. The query is never logged.

Authentication: bearerAuth

Parameters

Name In Type Description
X-Request-Id header string, max length 128 Correlation ID echoed in the response and forwarded upstream when valid.
traceparent header string W3C trace context. Invalid values create a new trace.

Request body (required)

  • application/json: object
    • query (string, required, min length 1) — Trimmed; at most mcp_execution.tool_search.max_query_chars (default 512) characters
    • limit (integer, min 1, max 50) — Defaults to and is capped by max_results (default 10)

Responses

Status Description Body
200 Ranked authorized tools with provenance application/json: object
400 Invalid query or limit —
401 Missing or invalid key —
403 Missing scope or entitlement, cross-origin browser request, or tool_search_embedding_forbidden: the key cannot use the embeddings alias —
404 Feature disabled —
429 tool_search_embedding_limited: the embeddings call of this key was refused by its limits or budget —
503 mcp_busy, approval storage unavailable, or tool_search_embedding_unavailable; nothing is ranked lexically instead —

Response 200 fields:

  • application/json: object
    • data (array of object, required, max items 50)
      • server_id (string, required)
      • server_name (string, required)
      • tool (string, required)
      • description (string, required) — Operator-reviewed text (boot grant description or the approved snapshot), never fetched live
      • source (string, required, one of "boot", "managed")
      • approved_snapshot_id (integer) — Snapshot the approval reviewed (managed only)
      • schema_sha256 (string) — Approved input schema hash (managed only)
      • score (number, required)
      • embedded (boolean, required) — False when ranked lexically because the embedding budget was exhausted or a cached vector no longer matched the model dimensions
    • ranking (object, required)
      • method (string, required, one of "lexical", "embedding")
      • embedding_model (string)
      • candidates (integer, required) — Authorized tools considered
      • embedded_inputs (integer, required) — Texts sent for embedding by this search (query included)
      • cached_vectors (integer, required)
      • unembedded_candidates (integer, required)

m7gtwcontact@m7gtw.com