Metadata-Version: 2.4
Name: spotdowntime-mcp
Version: 0.1.1
Summary: Report your MCP server's tool calls to Spot Downtime: per-tool error rates, latency and alerts.
Author: Qikdrive Technologies Pvt Ltd
License: MIT
Project-URL: Homepage, https://spotdowntime.com
Project-URL: Source, https://github.com/qikdrive/spotdowntime-mcp
Project-URL: Issues, https://github.com/qikdrive/spotdowntime-mcp/issues
Keywords: mcp,model-context-protocol,monitoring,observability,spot-downtime
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: test
Requires-Dist: mcp>=1.0; extra == "test"
Dynamic: license-file

# spotdowntime-mcp

See how your MCP server's tools behave for real users: calls, error rate and latency per tool, with an alert when a tool starts failing. It works with servers built on the official Python SDK, [`mcp`](https://pypi.org/project/mcp/): `MCPServer` and the low-level `Server` on mcp 2.x, and `FastMCP` on mcp 1.x.

```sh
pip install spotdowntime-mcp
```

```python
from mcp.server.mcpserver import MCPServer  # on mcp 1.x: from mcp.server.fastmcp import FastMCP
from spotdowntime_mcp import instrument

mcp = MCPServer("docs")
instrument(mcp)  # reads SPOTDOWNTIME_MCP_KEY

@mcp.tool()
def search_docs(query: str) -> str:
    ...
```

Get the key from your MCP server monitor's page in Spot Downtime (**Tool calls → Set up**), and set it as `SPOTDOWNTIME_MCP_KEY` where the server runs. Calls show up on the monitor's page within a minute.

## What's sent

For each `tools/call`: the tool's name, how long it took in milliseconds, and whether it worked. A call fails when the tool raises or returns an error result (`isError`).

Nothing else: no arguments, results, error messages, session IDs or anything about who called. Calls are sent in batches every 10 seconds from a background thread in your server, never from your users.

## Options

```python
reporter = instrument(
    mcp,
    key="mcpk_…",          # default: SPOTDOWNTIME_MCP_KEY
    flush_interval=10.0,   # seconds between batches
    on_error=lambda err: None,  # a batch couldn't be sent (it's dropped); default: one warning
)

reporter.stop()  # on shutdown: sends what's left (also done at exit)
```

Reporting never raises into your server and never delays a tool call. If Spot Downtime can't be reached, batches are dropped. No dependencies beyond the standard library; Python 3.10 or later.

Works with mcp 1.x and 2.x, whether you call `instrument` before or after registering tools. On 2.x it's added to the server's own middleware list.
