Skip to content

Tempo MCP Server 🤖 - #5212

Merged
joe-elliott merged 21 commits into
grafana:mainfrom
joe-elliott:tempo-mcp
Jul 14, 2025
Merged

Tempo MCP Server 🤖 #5212
joe-elliott merged 21 commits into
grafana:mainfrom
joe-elliott:tempo-mcp

Conversation

@joe-elliott

@joe-elliott joe-elliott commented Jun 4, 2025

Copy link
Copy Markdown
Collaborator

What this PR does:
Adds an MCP server shim in the query frontend using mcp-go. This API layer allows LLMs and other agents access to tracing data. Due to privacy/security concerns it is disabled by default and warns the user if enabled.

Also, I reorganized the TraceQL docs to serve them directly from MCP. As seen in the screenshot it can give up to date information to an LLM to correct syntax errors in its queries. Unsure if what I did is brittle and awful or dynamic and powerful. You decide!

Allows for fun interactions like:
claude-code-tempo-mcp

To test locally:
This can be tested with local test data using Claude code and our docker examples. Refer to the documentation in PR

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]
@joe-elliott
joe-elliott marked this pull request as draft June 4, 2025 17:32
@joe-elliott
joe-elliott force-pushed the tempo-mcp branch 3 times, most recently from 123a5d7 to 9fe9f78 Compare June 5, 2025 17:51
@joe-elliott
joe-elliott marked this pull request as ready for review June 5, 2025 17:51
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Comment thread pkg/api/http.go Outdated
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Signed-off-by: Joe Elliott <number101010@gmail.com>
Comment thread docs/sources/tempo/shared/traceql-main.md Outdated
@cbos

cbos commented Jun 16, 2025

Copy link
Copy Markdown

@joe-elliott
How is this related to https://github.com/grafana/mcp-grafana?
For Prometheus, Loki and Grafana itself it is added as separate MCP, not part of Loki for example.
To me it would sound logical to add Tempo support the the same MCP to have 1 MCP configured to access the whole LGTM stack.

In a few days I will be having a Hackathon where I will be exploring the Grafana MCP to see how it can help to do analysis on problems in a software stack.
If you have some suggestions on how to use this, I can try this Tempo MCP as well and let you know the outcome.

@joe-elliott

Copy link
Copy Markdown
Collaborator Author

For databases willing to support their own MCP server mcp-grafana should simply read tools, append them to its internal list and proxy them back to the caller. By supporting this protocol directly Tempo can more easily update and test new tools as we add new endpoints and capabilities.

Signed-off-by: Joe Elliott <number101010@gmail.com>
Comment thread docs/sources/tempo/api_docs/mcp-server.md
Comment thread modules/frontend/mcp_tools.go Outdated
Comment thread modules/frontend/mcp_tools.go Outdated
Comment thread modules/frontend/mcp_tools.go
Signed-off-by: Joe Elliott <number101010@gmail.com>

@electron0zero electron0zero left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, have a small Question around docs, but that's a nit, so approving :shipit:

| [Compactor ring status](#compactor-ring-status) | Compactor | HTTP | `GET /compactor/ring` |
| [Status](#status) | Status | HTTP | `GET /status` |
| [List build information](#list-build-information) | Status | HTTP | `GET /api/status/buildinfo` |
| [MCP Server](https://grafana.com/docs/tempo/<TEMPO_VERSION>/api_docs/mcp-server) (*) | MCP | | `/api/mcp` |

@electron0zero electron0zero Jul 8, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question/nit: should we have a section in docs page for MCP endpoint like we do for others? or it doesn't make sense?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. I wasn't sure what to say about it b/c I didn't intend to document parameters or request/response bodies and I thought it needed more space than just a simple section like the rest of our endpoints.

Signed-off-by: Joe Elliott <number101010@gmail.com>
@joe-elliott
joe-elliott merged commit 3a2796b into grafana:main Jul 14, 2025
22 checks passed
mattdurham pushed a commit to mattdurham/tempo that referenced this pull request Jun 18, 2026
* MCP Server

Signed-off-by: Joe Elliott <number101010@gmail.com>

* docs

Signed-off-by: Joe Elliott <number101010@gmail.com>

* tests

Signed-off-by: Joe Elliott <number101010@gmail.com>

* logs

Signed-off-by: Joe Elliott <number101010@gmail.com>

* changelog

Signed-off-by: Joe Elliott <number101010@gmail.com>

* manifest

Signed-off-by: Joe Elliott <number101010@gmail.com>

* lint

Signed-off-by: Joe Elliott <number101010@gmail.com>

* lint

Signed-off-by: Joe Elliott <number101010@gmail.com>

* use tools error return

Signed-off-by: Joe Elliott <number101010@gmail.com>

* add meta info about response types

Signed-off-by: Joe Elliott <number101010@gmail.com>

* made constants and split the metrics meta types

Signed-off-by: Joe Elliott <number101010@gmail.com>

* update path from /mcp to /api/mcp

Signed-off-by: Joe Elliott <number101010@gmail.com>

* mcp integration tset

Signed-off-by: Joe Elliott <number101010@gmail.com>

* review

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Removed httptest.Recorder

Signed-off-by: Joe Elliott <number101010@gmail.com>

* Use new jaeger client

Signed-off-by: Joe Elliott <number101010@gmail.com>

---------

Signed-off-by: Joe Elliott <number101010@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

6 participants