Skip to main content

Availability

MCP analytics is available from Tyk AI Studio 2.3.0.

Overview

Clients call MCP servers on Tyk Gateway directly, so AI Studio is not on the traffic path. To show MCP usage, AI Studio receives the analytics records of Tyk Gateway through Tyk Pump. This works for Tyk Dashboard connections and for Tyk Gateway (open source) connections. AI Studio keeps the MCP calls and shows them in these places:
  • The Usage tab of each MCP server. It shows calls, errors, latency, the use of each tool, resource and prompt, and the top Apps.
  • The MCP usage section of App pages, in the admin UI and in the AI Portal.
  • The MCP traffic panel on the AI Studio dashboard.
AI Studio does not store API keys, request or response bodies, or client addresses. AI Portal users see the MCP usage of their own Apps only. The admin views need the read action on analytics. The usage figures have these limits:
  • The error rate counts HTTP errors and the JSON-RPC errors that the gateway finds. A tool result with isError counts as a successful call.
  • REST-to-MCP proxies do not report the upstream latency. Use the total latency for them.
  • AI Studio does not delete old MCP call records yet, so the table grows with MCP traffic.
Usage tab of an MCP server with the overview tiles, the calls and latency charts, the tools table, and the Top Apps table

Prerequisites

  • Tyk Gateway 5.14 or later, with enable_analytics set to true.
  • Traffic logs on each MCP proxy: x-tyk-api-gateway.middleware.global.trafficLogs.enabled set to true. The proxies that AI Studio creates have this setting. A proxy that someone else created records nothing until they turn it on.
  • Tyk Pump 1.16 or later.

Create an Ingest Token

  1. Open the Tyk connection, and go to its Analytics section.
  2. Click Generate token.
  3. Copy the token. AI Studio shows it one time only, and stores only its hash.
Tyk Pump sends the token in the Authorization: Bearer header with each batch. Rotate token stops the old token at once. Revoke stops all analytics for the connection. Managing the token needs the write action on tyk-connections. A token belongs to one connection. AI Studio matches records only with the MCP servers of that connection. It counts and drops the records of other APIs. Calls that arrive after you delete their server also count as unknown APIs, and AI Studio drops them. The Analytics section also shows the time of the last batch. It shows these counts for the last 24 hours:
  • MCP records
  • Records for unknown APIs
  • MCP records without an App
  • Non-MCP records dropped
The section also gives Tyk Pump and Vector configurations that you can copy.

Configure Tyk Pump

Tyk Pump reads the analytics records from Redis and removes them. To send them to AI Studio, use the stdout pump with Vector.

Tyk Pump Stdout Pump With Vector

The stdout pump writes each record to the output of the Tyk Pump container. Vector reads that output, keeps the MCP records, and posts them to AI Studio. Add the stdout pump to pump.conf:
  • dont_purge_uptime_data: Set to true unless you run an uptime pump. Otherwise Tyk Pump looks for MongoDB at start and stops. The environment variable is TYK_PMP_DONTPURGEUPTIMEDATA.
  • omit_detailed_recording: Set to true to keep the raw requests and responses out of the records.
Configure Vector in vector.toml. Set MCP_INGEST_URL to https://<ai-studio-host>/api/v1/ingest/tyk-analytics, and MCP_INGEST_TOKEN to the ingest token:
Vector reads the output of Tyk Pump from the time that it connects. If Vector is down, the records that Tyk Pump writes in that time are lost.

Ingest Limits

The ingest endpoint accepts a JSON array of records, with no compression or with gzip. It refuses these requests:
  • A missing, incorrect, or revoked token, or a disabled connection: 401. Tyk Pump drops the batch.
  • A body that is not a JSON array: 400. Tyk Pump drops the batch.
  • A body larger than 16 MiB (also after gzip) or with more than 5000 records: 413. Tyk Pump drops the batch.
  • Another content encoding: 415. Tyk Pump drops the batch.
  • In the Community Edition, or when the integration is off (TYK_MCP_ENABLED is false): 404. Tyk Pump drops the batch.
  • More than 20 batches each second for one connection: 429. If AI Studio is busy: 503. Tyk Pump tries again.
Delivery is at least once. Records have no ID, so AI Studio can count a batch that Tyk Pump sends again two times. For the endpoint, refer to the AI Studio API reference.

App Attribution

AI Studio links a call to an App in one of these ways:
  • The key of the call is a key that AI Studio issued for the App on this connection. AI Studio matches the key hash that the gateway records. If the gateway has hash_keys off, it matches the key.
  • If there is no such key, the key alias names an App that has a key on this connection.
AI Studio does not issue keys for servers that use OAuth, JWT, mTLS, or no authentication. It counts their calls for each server only.