# Mcpstat

> Usage tracking and analytics for MCP servers

- **Type:** MCP server
- **Install:** `agentstack add mcp-tekkidev-mcpstat`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [tekkidev](https://agentstack.voostack.com/s/tekkidev)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [tekkidev](https://github.com/tekkidev)
- **Source:** https://github.com/tekkidev/mcpstat
- **Website:** https://mcpstat.vadim.dev

## Install

```sh
agentstack add mcp-tekkidev-mcpstat
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# mcpstat

[](https://pypi.org/project/mcpstat/)
[](https://github.com/tekkidev/mcpstat/blob/main/LICENSE)
[](https://pypi.org/project/mcpstat/)
[](https://github.com/tekkidev/mcpstat/actions/workflows/tests.yaml)
[](https://pypistats.org/packages/mcpstat)
[](http://mypy-lang.org/)
[](https://github.com/PyCQA/bandit)
[](https://codecov.io/gh/tekkidev/mcpstat)

**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

```bash
pip install mcpstat
```

With MCP SDK:
```bash
pip install "mcpstat[mcp]"
```

## Quick Start

```python
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](https://github.com/tekkidev/mcpstat/tree/main/docs)** - Quick start, API reference, examples

- [Quick Start](https://github.com/tekkidev/mcpstat/blob/main/docs/quickstart.md) - Get running in 5 minutes
- [Configuration](https://github.com/tekkidev/mcpstat/blob/main/docs/configuration.md) - Customize paths, logging, presets
- [API Reference](https://github.com/tekkidev/mcpstat/blob/main/docs/api.md) - Complete method reference
- [Token Tracking](https://github.com/tekkidev/mcpstat/blob/main/docs/token-tracking.md) - Cost analysis features
- [Latency Tracking](https://github.com/tekkidev/mcpstat/blob/main/docs/latency-tracking.md) - Performance monitoring

## Examples

```bash
# 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/](https://github.com/tekkidev/mcpstat/tree/main/examples/) for minimal and full integration patterns.

## Contributing

See [CONTRIBUTING.md](https://github.com/tekkidev/mcpstat/blob/main/CONTRIBUTING.md). Run tests with:

```bash
pip install "mcpstat[dev]"
pytest tests/
```

## License

MIT - see [LICENSE](https://github.com/tekkidev/mcpstat/blob/main/LICENSE) for details.

---

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

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [tekkidev](https://github.com/tekkidev)
- **Source:** [tekkidev/mcpstat](https://github.com/tekkidev/mcpstat)
- **License:** MIT
- **Homepage:** https://mcpstat.vadim.dev

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-tekkidev-mcpstat
- Seller: https://agentstack.voostack.com/s/tekkidev
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
