When Tyk Gateway processes an MCP request, it adds four MCP-specific fields to the structured access log record for that request. These fields let you filter, aggregate, and analyze MCP traffic in your log management tooling using the same access log pipeline you use for REST APIs. For an overview of all MCP observability signals, see MCP observability.Documentation Index
Fetch the complete documentation index at: https://tyk.io/docs/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Access logging must be enabled in your Tyk Gateway configuration. Setaccess_logs.enabled to true in tyk.conf:
MCP fields
The following fields are added to access log records for MCP requests. Each field is only included when it has a non-empty value; fields are omitted from the record entirely when not applicable, keeping log volume low on lifecycle calls such asinitialize and ping.
| Field | Type | Description |
|---|---|---|
api_type | string | API protocol type. Always mcp for MCP requests. |
mcp_method | string | JSON-RPC method invoked, for example tools/call or resources/read. Present on all MCP requests. |
mcp_primitive_type | string | MCP primitive category: tool, resource, or prompt. Present only when a primitive was matched. |
mcp_primitive_name | string | Name of the specific tool, resource, or prompt invoked, for example get_current_weather. Present only when a primitive was matched. |
mcp_error_code | integer | Gateway-mapped JSON-RPC error code. Present only when the request failed at the gateway layer. |
mcp_error_code field reflects errors that occur within the gateway: authentication failures, rate limit rejections, and upstream errors. It does not capture error codes from within the upstream MCP server’s JSON-RPC response body.
| Error code | Meaning |
|---|---|
-32001 | Authentication required |
-32002 | Access denied |
-32003 | Rate limit exceeded |
-32004 | Upstream error (502/503/504) |
-32600 | Invalid request (400) |
-32603 | Internal error (500) |
Configuring which fields to include
By default, when access logging is enabled, all available fields are included in each log record. To restrict the fields logged, set atemplate array in access_logs:
template is configured, only the listed fields appear in each log record. Fields in the template that have no value for a given request are omitted.
Example log records
A successfultools/call request produces a record similar to the following:
mcp_error_code set and no primitive fields (the primitive was never reached):
initialize lifecycle call produces a record with mcp_method set but no primitive fields: