Skip to main content
Glama

mcpstat

PyPI - Version GitHub License PyPI - Python Version GitHub Actions Workflow Status PyPI - Downloads Checked with mypy Security: bandit Codecov

Usage tracking and analytics for MCP servers. Pure Python, zero required dependencies.

Track which tools get called, how often, and keep an audit trail - all in 3 lines of code.

Installation

pip install mcpstat

With MCP SDK:

pip install "mcpstat[mcp]"

Quick Start

from mcp.server import Server
from mcpstat import MCPStat

app = Server("my-server")
stat = MCPStat("my-server")

@app.call_tool()
@stat.track  # ← One decorator does everything!
async def handle_tool(name: str, arguments: dict):
    # Your logic here - latency tracked automatically
    return await my_logic(arguments)

Then ask your AI assistant: "Give me MCP usage stats"

Features

  • SQLite-backed - Stats persist across restarts

  • Built-in MCP tools - get_tool_usage_stats, get_tool_catalog

  • Tag system - Categorize and filter tools

  • Token tracking - Estimate or record actual token usage

  • Latency tracking - Measure execution duration, identify slow tools

  • File logging - Optional timestamped audit trail

  • Async-first - Thread-safe via asyncio.Lock

Documentation

Full Documentation - Quick start, API reference, examples

Examples

# Clone and run example server
git clone https://github.com/tekkidev/mcpstat.git
cd mcpstat
pip install -e ".[mcp]"
python examples/example_server.py

See examples/ for minimal and full integration patterns.

Contributing

See CONTRIBUTING.md. Run tests with:

pip install "mcpstat[dev]"
pytest tests/

License

MIT - see LICENSE for details.


MCP is a trademark of its respective owners. This project is not affiliated with or endorsed by any trademark holders.

-
security - not tested
A
license - permissive license
-
quality - not tested

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tekkidev/mcpstat'

If you have feedback or need assistance with the MCP directory API, please join our Discord server