Prerequisites
Access logging must be enabled in your Tyk Gateway configuration. Setaccess_logs.enabled to true in tyk.conf. See Enabling Access Logs.
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.
The
mcp_error_code field holds the code of Tyk’s own error, or, when the upstream MCP server returns a JSON-RPC error, the code from its response. Tyk’s codes depend on the protocol version the request uses. See MCP Error Codes for the full list.
Access Logs When the Proxy Fronts a Tyk-Managed REST API
When an MCP proxy is generated directly from a Tyk-managed REST API rather than fronting a remote MCP server, a singletools/call request produces two separate access log entries when access logs are enabled on the Gateway.
The first entry is for the MCP proxy request itself, and carries the MCP fields described above. The second is for Tyk’s internal call into the paired source REST API, dispatched through the gateway’s standard request handling. That second entry has no MCP fields at all: its api_type reflects the source API’s own type (oas for a Tyk OAS API), and it is otherwise indistinguishable from a request made directly against that API.
trace_id: Tyk dispatches the internal call to the source API within the same trace as the originating MCP request, so the two entries are spans of one trace rather than unrelated hits. Without tracing enabled, there is no shared identifier between the two entries, so correlate them by timestamp. The proxy’s own latency_total includes the time spent on the source API call, so it is always the larger of the two figures.
This dual-record pattern isn’t unique to access logs. The Dashboard’s MCP analytics charts, and the Tyk Pump analytics pipeline underneath them, follow the same rule: only the MCP proxy’s own record is recorded as MCP traffic, so the source API’s analytics include this internal traffic indistinguishably alongside any direct hits it receives. See Tyk Pump for how analytics records are processed and stored.
Configuring Which Fields to Include
By default, each record includes all available fields. To log only some fields, use an access log template. See Access Log Templates. Addapi_type and the four mcp_ fields to the template to keep the MCP detail.
Example Log Records
A successfultools/call request produces a record similar to the following:
mcp_error_code set. Tyk reads the JSON-RPC body before it checks the key, so the record also has the primitive fields:
2026-07-28, the same failure records -33001.
An initialize lifecycle call produces a record with no mcp_primitive_type. Its mcp_primitive_name is the method name: