Overview
An MCP proxy definition is the configuration object that tells Tyk how to front an MCP server. It is built on the Tyk OAS API definition format (an OpenAPI 3.0.x or 3.1.x document extended with thex-tyk-api-gateway vendor extension) and adds the MCP-specific structures that allow Tyk to inspect JSON-RPC traffic and apply middleware at the method and primitive level.
This page explains the structure of an MCP proxy definition, how MCP concepts (primitives, methods, operations) map to it, and which parts of the extension are specific to MCP.
If you are not familiar with Tyk OAS API definitions, read Tyk OAS first. This page focuses on the MCP-specific aspects and assumes knowledge of the base format.
Structure Overview
An MCP proxy definition has two parts that work together:- The OpenAPI specification: Describes the MCP server’s transport endpoints and, optionally, each JSON-RPC method as a documented operation. Tyk uses this to understand the API’s shape and to present it in the Developer Portal.
- The
x-tyk-api-gatewayextension: Contains all gateway configuration: the listen path, upstream URL, authentication, and the middleware maps that govern individual tools, resources, and prompts.
x-tyk-api-gateway extension has four top-level sections:
The sections below explain each part and the MCP-specific patterns within them.
MCP Concepts in the Definition
Three core MCP concepts shape how you write an MCP proxy definition: primitives, JSON-RPC methods, and transport endpoints, see What is MCP?. Understanding them before reading the definition structure makes the configuration decisions much clearer. In the definition, method-level middleware goes inmiddleware.operations, and each primitive type has its own map: mcpTools, mcpResources, and mcpPrompts.
The OpenAPI Specification Portion
The OpenAPI specification in an MCP proxy definition documents the server’s HTTP interface. For MCP, this has a standard structure that you can treat as a template.Transport Paths
At minimum, thepaths object documents the two transport endpoints:
operationId values (mcpTransportPost, mcpSSEGet) are referenced internally by Tyk for the transport endpoints. These values are fixed; do not change them.
Method Paths
In addition to the transport paths, you can document each JSON-RPC method as a separate path. This is optional for gateway operation but makes the MCP proxy browsable in the Tyk Developer Portal:/mcp/{namespace}/{action}) and the operationId convention ({method}POST) are what tie the OpenAPI spec to the middleware.operations map in the x-tyk-api-gateway extension.
The method paths do not correspond to real HTTP endpoints. All traffic still flows through
POST /mcp. The method paths exist solely for documentation, schema validation, and middleware configuration purposes.The x-tyk-api-gateway Extension
Thex-tyk-api-gateway extension contains all gateway configuration. For MCP proxies, it has the same four top-level sections as any Tyk OAS API definition, with MCP-specific content in the middleware section.
info, server, and upstream
Theinfo, server, and upstream sections work identically to a standard Tyk OAS API definition. They configure the API’s identity, its client-facing interface, and its upstream connectivity:
https://my-gateway.example.com/weather/mcp. Tyk authenticates the request, applies any configured middleware, and proxies it to https://weather-mcp.example.com/mcp. Tyk serves both the POST and GET transport endpoints under the same listen path.
There are no MCP-specific fields in these three sections. You configure authentication, TLS, load balancing, upstream rate limits, and all other standard gateway capabilities exactly as you would for a REST API. See Tyk OAS for the full field reference for these sections.
For an MCP proxy generated directly from a Tyk-managed REST API, upstream.url holds an adapter target instead of a remote server’s url. See The upstream adapter target for what this value means and why it takes this form.
The example above uses bearerAuth as the security scheme, a simple bearer token check. For full OAuth 2.1 compliance (token validation, scope enforcement, Protected Resource Metadata, and token exchange), use the oauth2 scheme instead. See MCP OAuth 2.1.
The middleware Section
Themiddleware section is where MCP proxy definitions diverge from standard Tyk OAS API definitions. It contains the same global block for API-wide middleware, but adds two new concepts: an operations map keyed by JSON-RPC method, and three primitive maps: mcpTools, mcpResources, and mcpPrompts. This section covers where each middleware option lives in the definition; for what each option actually does, see MCP middleware.
A REST API to MCP proxy only populates
mcpTools. mcpResources and mcpPrompts are unused, since a REST API has no resource or prompt primitives to expose. Its tool catalog is generated from the source API’s operations rather than hand-written. See REST API to MCP x-tyk-mcp-server extension.global: API-Wide Middleware
Global middleware applies to every request on the API. It is configured identically to a standard Tyk OAS API (CORS, traffic logs, header transformations, custom plugins, and so on). There is nothing MCP-specific here.operations: Method-Level Middleware
Theoperations map lets you configure middleware that applies to every invocation of a JSON-RPC method, regardless of which specific primitive is targeted. It is keyed by the operation ID of the method path in the OpenAPI spec, which follows the convention {json-rpc-method}{HTTP-method}:
For an example, see Operation middleware.
mcpTools: Per-Tool Middleware
ThemcpTools map configures middleware for individual tools. Each key is the tool name as it appears in the params.name field of a tools/call request:
allow and block work, including allowlist mode, see Access control.
mcpResources: Per-Resource Middleware
ThemcpResources map configures middleware for individual resources or URI patterns. Each key is matched against the params.uri field of a resources/read request. Keys can be exact URIs or wildcard patterns using *:
mcpPrompts: Per-Prompt Middleware
ThemcpPrompts map configures middleware for individual prompts. Each key is the prompt name as it appears in the params.name field of a prompts/get request:
REST API to MCP x-tyk-mcp-server Extension
An MCP proxy generated directly from a Tyk-managed REST API has one further structure:x-tyk-mcp-server, a vendor extension alongside x-tyk-api-gateway rather than nested inside it, holding the tool catalog Tyk derives from the source API’s OpenAPI operations. See REST API to MCP x-tyk-mcp-server extension for the full field reference, the allow-list selection rule, tool name validation limits, and worked examples.
Middleware Precedence
Tyk runs global middleware, then operation middleware, then primitive middleware. For details, see Evaluation order. All three middleware levels apply to all consumers of the proxy. For per-consumer control, use security policies. See Policies versus middleware.A Complete Example
The following definition configures a weather MCP proxy with bearer token authentication, method-level and tool-level rate limiting, and allowlists for tools, resources, and prompts.- The API listens on
/weather/and proxies tohttps://weather-mcp.example.com. Clients connect to{gateway_host}/weather/mcp. - Bearer token authentication is required on all requests.
- All
tools/callrequests are rate limited to 500 per minute at the method level. - Only two tools are accessible (
get-weatherandget-forecast). Any other tool name is rejected. Each tool has its own tighter rate limit. - Resources matching
weather://stations/*are accessible. - Only the
weather-summaryprompt is accessible. - Traffic logs are enabled for all requests.
bearerAuth for simplicity. For full OAuth 2.1 compliance, including token validation against an external IdP, per-primitive scope enforcement, Protected Resource Metadata, and RFC 8693 token exchange, replace bearerAuth with the oauth2 scheme. See MCP OAuth 2.1 for a complete worked example.
Supported MCP Spec Features
The following table documents which MCP protocol capabilities Tyk currently implements and how each maps to the proxy definition.
MCP specification version: Tyk implements the
2025-11-25 revision of the MCP specification.