Skip to content

OpenAPI tools

Last updated: 2026-11-22T07:10:00-03:00 (UTC-3)

Many internal services already publish an OpenAPI document. The gateway can turn the operations of such a document into tools that agents call through the same execution routes as MCP tools, with the same per-team review, grants, egress guard and logs. Nothing runs before an administrator approves it, and the gateway never runs commands, scripts or code from the document.

Flag Default What it turns on
mcp_openapi_tools false Importing OpenAPI documents as draft API sources; requires mcp_connect (and so mcp_execution, mcp_registry, ui); an operator control
  1. An administrator pastes a document and chooses the base URL and the credential mode. The gateway generates one draft tool per operation and records them as a snapshot. It never fetches the document, a server URL or a reference.
  2. The reviewer opens the snapshot: each tool shows its method, full URL template, whether it is read-only, whether it sends the team credential, and why an operation could not be generated.
  3. The reviewer approves tools per team. A tool whose method is not GET or HEAD changes data upstream, so its approval needs the explicit acknowledgement acknowledge_side_effects: true (a checkbox in the console).
  4. Keys of an approved team list and call the tools at /v1/mcp/servers/{id}/tools and /v1/mcp/servers/{id}/tools/call. Tool search (MCP tool search) finds approved tools too.

The approval pins a hash of the whole generated mapping (method, path, parameters, body, credential use and schemas) and of its target (base URL and credential header), not only the input schema. Importing a new document creates a new snapshot; the approved snapshot keeps running unchanged until a reviewer approves the new one (the source list shows the latest imported base URL meanwhile). Changing the credential mode, the base URL’s origin or the credential header returns the source to draft, removes every approval and erases the teams’ stored credentials, which were given for the old target; deleting a source erases them too. Disabling the source stops every call at once.

Part Supported Otherwise
Document OpenAPI 3.0.x or 3.1.x, JSON or one YAML document, at most max_spec_bytes and max_operations, no NUL characters Refused (422 unsupported_openapi_document); YAML with excessive aliasing is refused
Size of the result References are copied where used, up to 20000 schema nodes and 256 KiB of copied values (descriptions, enums, defaults) per document; enums of at most 64 values; numbers of at most 64 digits on either side of the point; each input schema at most 64 KiB and accepted by the gateway’s argument validator Operations past a budget, or with a larger or invalid schema, are unsupported
Operations get, put, post, delete, patch, head under paths; path templates use only characters valid in an escaped path (letters, digits, -._~!$&'()*+,;=:@/ and {}), without empty or dot segments Path-item $ref, webhooks and callbacks are ignored with a diagnostic; other templates are unsupported
Tool name operationId when it is [A-Za-z0-9_.-]{1,128}; otherwise a stable name from method and path (delete_pets_petId) A duplicate name gets a hash suffix and stays unsupported
Parameters path (string, number, integer, boolean) and query (those, or arrays of them, form/explode) Required header/cookie parameters make the tool unsupported; optional ones are not exposed
Request body application/json with a schema in the validated subset, as the body argument Other media types or schema constructs make the tool unsupported
Schemas type, properties, required, items, additionalProperties, enum, numeric and length bounds, nullable, local #/components/... references oneOf, anyOf, allOf, not, pattern and similar constructs make the tool unsupported; format, example and readOnly are dropped with a note, since they are not enforced
Security No requirement, {}, or exactly the configured scheme Any other requirement makes the tool unsupported

An unsupported tool is shown with its reasons and can never be approved.

features:
mcp_registry: true
mcp_execution: true
ui: true
mcp_connect: true
mcp_openapi_tools: true
mcp_team_credentials: true # only for auth: team_credential
mcp_execution:
protocol_version: "2025-11-25"
openapi:
max_spec_bytes: 1048576 # one document, 1024-4194304
max_operations: 64 # per document, 1-256
max_response_bytes: 1048576 # one API response, 1024-8388608
request_timeout_seconds: 30 # one API call, 1-30
Field Default Bounds
max_spec_bytes 1048576 1024-4194304
max_operations 64 1-256
max_response_bytes 1048576 1024-8388608
request_timeout_seconds 30 1-30 (the execution route bounds every operation to 30 seconds)

These are boot settings under mcp_execution.openapi: GET /api/v1/admin/config shows the effective values as mcp_execution.openapi (it was a top-level mcp_openapi), the MCP servers page shows them in the import form and in the execution settings panel, both read-only, and changing them needs a rollout.

POST /api/v1/admin/mcp/openapi-sources
Cookie: <admin session>
X-CSRF-Token: <token>
Content-Type: application/json
{
"id": "billing-api",
"name": "Billing API",
"base_url": "https://billing.internal.example.com/v1",
"auth": "team_credential",
"security_scheme": "bearerAuth",
"spec": "openapi: 3.1.0\ninfo: {title: Billing, version: '4'}\npaths: ..."
}
Field Meaning
id ^[a-z][a-z0-9_-]{1,63}$, unique among console servers and not declared in YAML
base_url The URL every call goes to: https, or loopback http only with mcp_execution.allow_loopback_http; no credentials, query or fragment. A diagnostic notes when it is not one of the document’s servers
auth none (no credential is ever sent) or team_credential
security_scheme With team_credential: a components.securitySchemes name of type http/bearer (sent as Authorization: Bearer …) or apiKey in a header (that header; Host, Cookie, Accept, Accept-Encoding, User-Agent, hop-by-hop, forwarding and tracing headers are refused)

The 201 answer carries the draft server (kind: openapi), snapshot_id, every generated operation with its mapping, unsupported reasons and notes, the document’s own document_servers and diagnostics. PUT /api/v1/admin/mcp/openapi-sources/{id} with the current version records a new document; changing auth returns the source to draft and removes its approvals. GET /api/v1/admin/mcp/openapi-sources/{id}/snapshots/{snapshot} shows the stored mapping and provenance (document SHA-256, OpenAPI version, title and version). Approve with the usual POST /api/v1/admin/mcp/managed-servers/{id}/approve, adding "acknowledge_side_effects": true when a non-GET tool is approved; without it the answer is 400 side_effects_unacknowledged. The generic test and edit actions of MCP servers answer 409 for an OpenAPI source.

With team_credential, each team stores its own credential with PUT /api/v1/admin/mcp/servers/{id}/credentials/{team} (encrypted, never read back, see MCP execution). A call that needs it while the team has none answers 409 mcp_credential_required and sends nothing.

POST /v1/mcp/servers/billing-api/tools/call
Authorization: Bearer <key with mcp:read and mcp:execute>
{"name": "listInvoices", "arguments": {"status": "open", "limit": 20}}

The arguments are validated against the generated input schema before anything is sent. A path value fills exactly one segment: it is escaped (a b?x becomes a%20b%3Fx), and a value containing / or \, or equal to . or .., is refused with 400 invalid_arguments, so an argument cannot reach another path even on an upstream that decodes %2F; the built URL is checked against the base origin and the mapped path before sending. The request carries Accept: application/json, User-Agent: m7gtw-openapi-tools, the request ID and traceparent, the credential header when the operation requires it, and nothing from the client’s own request.

{
"protocol_version": "2025-11-25",
"result": {
"content": [{"type": "text", "text": "[{\"id\":\"inv_1\"}]"}],
"isError": false,
"structuredContent": {"http_status": 200, "body": [{"id": "inv_1"}]}
}
}

isError is true for any status outside 2xx, including a redirect, which is never followed. A response larger than max_response_bytes fails with 502 mcp_openapi_response_too_large instead of being truncated; a timeout answers 504 mcp_upstream_timeout, an unreachable or refused address 502 mcp_upstream_unreachable. No call is retried. The tool listing adds MCP annotations: readOnlyHint, destructiveHint (DELETE), idempotentHint, plus the method and path.

Calls go only to the base URL’s origin through the gateway’s egress guard, which resolves the name at dial time and refuses private, special and (unless allowed at boot) loopback addresses, defeating DNS rebinding. Each call has the request_timeout_seconds bound and the shared MCP admission. Logs record the server, tool, key, team and HTTP status, never arguments, bodies or credentials.

The standard MCP protocol ingress for clients (initialize, tools/list, tools/call over MCP) is a separate capability; today generated tools are reached through the gateway’s REST execution routes. Importing a remote MCP registry entry is a different feature (MCP execution).

Migration 142 adds the server kind column (mcp for every existing server), the team_credential auth mode for OpenAPI sources and the per-snapshot mapping table. Existing MCP servers are unchanged.

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.

Route What it does
POST /api/v1/admin/mcp/openapi-sources Generates draft tools from an inline OpenAPI 3.0/3.1 document; nothing runs until it is approved

m7gtw[email protected]