Tempo MCP Server

Tempo MCP Server

An MCP ( Model Context Protocol ) Server for Grafana Tempo

scottlepp

Developer Tools
Visit Server

README

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 communicates using stdin/stdout following the Model Context Protocol (MCP). This makes it suitable for use with Claude Desktop and other MCP-compatible clients. It does not run as an HTTP server on a port.

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

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:

  1. Build the server or Docker image
  2. 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"]
    }
  }
}

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}"

<img width="991" alt="Screenshot 2025-04-11 at 5 24 03 PM" src="https://github.com/user-attachments/assets/bcb1fb78-5532-48ab-ada2-4857f6f22514" />

License

This project is licensed under the MIT License.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

Linear MCP Server

A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Featured
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python