# spanlens/Spanlens [Health: Active]

**Category:** 📊 Monitoring  
**Repository:** https://github.com/spanlens/Spanlens  
**GitHub Stars:** 13  
**npm Downloads (last month):** 75  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/spanlens-spanlens-2

## Description
Query your Spanlens LLM observability from any MCP client. 7 read tools for request logs, agent traces, cost stats, anomalies, model-savings, and per-user analytics across OpenAI, Anthropic, and Gemini. Open source, self-hostable. npx -y @spanlens/mcp-server

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "spanlens": {
    "command": "npx",
    "args": ["-y","@spanlens/cli"],
    "env": {
      "SPANLENS_API_KEY": ""
    }
  }
}
```

**Requires environment variables:** `SPANLENS_API_KEY` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What spanlens/Spanlens does

The spanlens/Spanlens MCP server makes Spanlens observability records available to an MCP client. It is intended for inspecting LLM activity rather than sending new model requests. The available interface contains seven read tools covering request logs, agent traces, cost statistics, anomalies, model-savings data, and analytics organized by end user.

Use it when an agent needs operational context about an LLM application: which requests were made, how traces behaved, what usage cost, whether unusual activity was detected, or how usage differs between users. The underlying Spanlens product records activity across OpenAI, Anthropic, and Gemini workloads. The repository describes the server as open source and self-hostable.

## How it works

The server connects an MCP client to Spanlens observability data. A client can then issue read queries through the exposed tools and receive results for investigation or analysis. The material identifies Cursor and Claude Desktop as supported clients, so the server can be used from either environment when configured as an MCP server.

The data available to the MCP layer comes from Spanlens instrumentation and integrations. Spanlens can record model, provider, latency, token, cost, request, and response information. It also supports multi-step agent tracing, cost tracking, anomaly detection, and per-user tagging. These product capabilities provide the context queried by the MCP tools; the supplied material does not describe write operations or mutation tools.

## Setup and configuration

The package name for the server is `@spanlens/mcp-server`. The documented launch command is:

```bash
npx -y @spanlens/mcp-server
```

Configure that command in an MCP-compatible client such as Cursor or Claude Desktop. The provided material does not include a complete client configuration block or specify the server's MCP transport details.

Spanlens itself uses `SPANLENS_API_KEY` in its JavaScript and Python setup examples. The material does not explicitly state whether the MCP process requires that variable, how it receives the key, or whether a self-hosted endpoint needs additional settings. Confirm the MCP package documentation before deploying it with a hosted or self-hosted Spanlens instance.

## Tools and capabilities

The spanlens/Spanlens MCP server provides seven read-oriented capabilities for:

- Searching or reviewing request logs.
- Examining agent traces.
- Inspecting cost statistics.
- Reviewing detected anomalies.
- Evaluating model-savings information.
- Analyzing activity by end user.
- Querying observability information across supported provider workloads.

Spanlens request records can include full prompt and response bodies, streaming responses reconstructed by the platform, token counts, latency, model, provider, and cost. Agent traces can represent multi-step workflows. Per-user analytics depend on calls being tagged with Spanlens's user mechanism, such as `x-spanlens-user`, `withUser()`, or `with_user()`.

## Limitations and notes

The supplied description presents the MCP interface as read-only, so it should not be selected when an agent must change Spanlens configuration or modify recorded data. The README excerpt does not enumerate individual tool names, arguments, return schemas, pagination behavior, filtering syntax, or error handling. It also does not document an MCP-specific authentication flow.

OpenAI, Anthropic, and Gemini are the providers named in the listing. The broader Spanlens project mentions additional integrations, but those should not be assumed to be direct MCP query targets without checking the server's own documentation. Self-hosting is supported by the project, while the exact deployment and connection steps for this MCP package are not included in the supplied material.

## Getting started with this spanlens/Spanlens MCP server
Always refer to the official documentation for the most accurate and up-to-date information.

_Full upstream README: https://allmcps.com/mcp/spanlens-spanlens-2/readme_

