trackmcp
SDKs

Python SDK

The trackmcp package wraps your MCP server so every call, result, and client is captured automatically. Works with Python 3.9+ and the official MCP SDK.

Install

python3 -m pip install trackmcp
# or: uv add trackmcp / poetry add trackmcp

Wrap your server

Wrap your existing server with with_trackmcp and pass your API key. Your tools stay exactly as they are.

import os
from trackmcp import with_trackmcp
from mcp.server import server

app = with_trackmcp(
    server,
    api_key=os.environ["TRACKMCP_KEY"],
    service="acme-mcp-server",
    environment="production",
)

Options

Only api_key is required. See the full configuration reference for defaults.

with_trackmcp(
    server,
    api_key=os.environ["TRACKMCP_KEY"],
    service="acme-mcp-server",
    environment="production",
    sample_rate=1.0,                 # 0-1, fraction of calls captured
    redact=["args.password", "args.token"],  # never leaves your process
    endpoint="https://trackmcp.com/api/v1/ingest",  # self-hosted override
)

Redacting sensitive fields

Redaction runs locally before anything is sent. Point redact at any argument or result path.

redact=["args.email", "args.api_key", "result.raw_response"]

Custom events

Emit a named event from anywhere in your code.

from trackmcp import track

track("checkout_completed", {"amount": 4900, "plan": "pro"})