Query Tempo Tracing Data with AI
An archived Go MCP server for querying Grafana Tempo traces - Tempo now ships its own embedded MCP server instead.
Why it matters
Enable AI assistants to query and analyze distributed tracing data from Grafana Tempo. Search traces using Tempo query strings and integrate with AI tools for enhanced observability.
Outcomes
What it gets done
Query distributed tracing data from Grafana Tempo using custom query strings.
Configure integration with AI assistants like Claude Desktop and Cursor.
Deploy the server via source code, Docker, or Docker Compose.
Analyze trace data with support for time ranges and result limits.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-tempo | bash Capabilities
Tools your agent gets
Queries Grafana Tempo tracing data with custom query strings, time ranges, and result limits.
Overview
Tempo MCP Server
This archived Go MCP server exposes a tempo_query tool for running TraceQL queries against Grafana Tempo, with configurable time range, result limit, and authentication, over stdio or HTTP/SSE transport. This project is archived - Grafana Tempo now ships its own embedded MCP server, which should be used for new integrations instead of this repo.
What it does
A Go-based MCP server for querying Grafana Tempo distributed tracing data, exposing a single tool, tempo_query, that runs TraceQL-style queries such as {service.name="frontend"} or {duration>1s} against a Tempo instance, with a configurable time range, result limit, and optional basic-auth or bearer-token authentication. It supports both the standard stdio MCP transport and an HTTP mode with a Server-Sent Events endpoint (default port 8080, configurable via SSE_PORT) for integration with tools like n8n.
When to use - and when NOT to
This project is archived and no longer maintained: Grafana Tempo now ships its own embedded MCP server, and issues or pull requests should go to the Tempo repository instead. Treat this repo as a reference or for existing setups that already depend on it, not as a starting point for new work - use Tempo's built-in MCP server for that. When it was active, the use case was querying and analyzing distributed traces from Grafana Tempo conversationally through Claude Desktop, Cursor, or an n8n AI Agent workflow.
Capabilities
tempo_query takes a required query string plus optional parameters: url (Tempo server URL, defaulting to the TEMPO_URL environment variable or http://localhost:3200), start and end time bounds (defaulting to one hour ago through now), limit (defaulting to 20 traces), and username/password or a bearer token for authenticated Tempo instances.
How to install
go build -o tempo-mcp-server ./cmd/server
./tempo-mcp-server
Requires Go 1.21 or higher. It can also run via Docker: docker build -t tempo-mcp-server . then docker run -p 8080:8080 --rm -i tempo-mcp-server, or docker-compose up --build for a full local test environment. A Claude Desktop config points command at the built binary or a docker run invocation with TEMPO_URL passed as an environment variable, added to claude_desktop_config.json; Cursor uses a similar Docker-based mcpServers entry; n8n connects via an MCP Client Tool node pointed at the SSE endpoint, feeding results into an AI Agent node.
Who it's for
Teams already running Grafana Tempo who query traces conversationally through an AI assistant and have an existing dependency on this server - though anyone starting a new integration should use Tempo's own embedded MCP server instead of this archived project. Once wired up, example prompts included "query Tempo for traces with the query {duration>1s}", "find traces from the frontend service in Tempo using query {service.name="frontend"}", and "show me the most recent 50 traces from Tempo with {http.status_code=500}" - the tool could also be exercised directly for testing via the bundled run-client.sh script, without going through an AI client at all.
Source README
Archived!
This project has been archived. Tempo itself has an embedded MCP server. Please file issues and PRs in the Tempo repo
Tempo MCP Server
A Go-based server implementation for the Model Context Protocol (MCP) with Grafana Tempo integration.
Overview
This MCP server allows AI assistants to query and analyze distributed tracing data from Grafana Tempo. It follows the Model Context Protocol to provide tool definitions that can be used by compatible AI clients such as Claude Desktop.
Getting Started
Prerequisites
- Go 1.21 or higher
- Docker and Docker Compose (for local testing)
Building and Running
Build and run the server:
# Build the server
go build -o tempo-mcp-server ./cmd/server
# Run the server
./tempo-mcp-server
Or run directly with Go:
go run ./cmd/server
The server now supports two modes of communication:
- Standard input/output (stdin/stdout) following the Model Context Protocol (MCP)
- HTTP Server with Server-Sent Events (SSE) endpoint for integration with tools like n8n
The default port for the HTTP server is 8080, but can be configured using the SSE_PORT environment variable.
Server Endpoints
When running in HTTP mode, the server exposes the following endpoints:
- SSE Endpoint:
http://localhost:8080/sse- For real-time event streaming - MCP Endpoint:
http://localhost:8080/mcp- For MCP protocol messaging
Docker Support
You can build and run the MCP server using Docker:
# Build the Docker image
docker build -t tempo-mcp-server .
# Run the server
docker run -p 8080:8080 --rm -i tempo-mcp-server
Alternatively, you can use Docker Compose for a complete test environment:
# Build and run with Docker Compose
docker-compose up --build
Project Structure
.
├── cmd/
│ ├── server/ # MCP server implementation
│ └── client/ # Client for testing the MCP server
├── internal/
│ └── handlers/ # Tool handlers
├── pkg/
│ └── utils/ # Utility functions and shared code
└── go.mod # Go module definition
MCP Server
The Tempo MCP Server implements the Model Context Protocol (MCP) and provides the following tools:
Tempo Query Tool
The tempo_query tool allows you to query Grafana Tempo trace data:
- Required parameters:
query: Tempo query string (e.g.,{service.name="frontend"},{duration>1s})
- Optional parameters:
url: The Tempo server URL (default: from TEMPO_URL environment variable or http://localhost:3200)start: Start time for the query (default: 1h ago)end: End time for the query (default: now)limit: Maximum number of traces to return (default: 20)username: Username for basic authentication (optional)password: Password for basic authentication (optional)token: Bearer token for authentication (optional)
Environment Variables
The Tempo query tool supports the following environment variables:
TEMPO_URL: Default Tempo server URL to use if not specified in the requestSSE_PORT: Port for the HTTP/SSE server (default: 8080)
Testing
./run-client.sh tempo_query "{resource.service.name=\\\"example-service\\\"}"
Using with Claude Desktop
You can use this MCP server with Claude Desktop to add Tempo query tools. Follow these steps:
- Build the server or Docker image
- Configure Claude Desktop to use the server by adding it to your Claude Desktop configuration file
Example Claude Desktop configuration:
{
"mcpServers": {
"temposerver": {
"command": "path/to/tempo-mcp-server",
"args": [],
"env": {
"TEMPO_URL": "http://localhost:3200"
},
"disabled": false,
"autoApprove": ["tempo_query"]
}
}
}
For Docker:
{
"mcpServers": {
"temposerver": {
"command": "docker",
"args": ["run", "--rm", "-i", "-e", "TEMPO_URL=http://host.docker.internal:3200", "tempo-mcp-server"],
"disabled": false,
"autoApprove": ["tempo_query"]
}
}
}
The Claude Desktop configuration file is located at:
- On macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - On Windows:
%APPDATA%\Claude\claude_desktop_config.json - On Linux:
~/.config/Claude/claude_desktop_config.json
Using with Cursor
You can also integrate the Tempo MCP server with the Cursor editor. To do this, add the following configuration to your Cursor settings:
{
"mcpServers": {
"tempo-mcp-server": {
"command": "docker",
"args": ["run", "--rm", "-i", "-e", "TEMPO_URL=http://host.docker.internal:3200", "tempo-mcp-server:latest"]
}
}
}
Using with n8n
To use the Tempo MCP server with n8n, you can connect to it using the MCP Client Tool node:
Add an MCP Client Tool node to your n8n workflow
Configure the node with these parameters:
- SSE Endpoint:
http://your-server-address:8080/sse(replace with your actual server address) - Authentication: Choose appropriate authentication if needed
- Tools to Include: Choose which Tempo tools to expose to the AI Agent
- SSE Endpoint:
Connect the MCP Client Tool node to an AI Agent node that will use the Tempo querying capabilities
Example workflow:
Trigger → MCP Client Tool (Tempo server) → AI Agent (Claude)
Example Usage
Once configured, you can use the tools in Claude with queries like:
- "Query Tempo for traces with the query
{duration>1s}" - "Find traces from the frontend service in Tempo using query
{service.name=\"frontend\"}" - "Show me the most recent 50 traces from Tempo with
{http.status_code=500}"
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.