Add MCP server exposing Glean metadata to AI assistants #2319
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@edugfilho This is a PoC, I'd like to get an early opinion. This implements a simple MCP server for Glean Dictionary. It's not fully compliant with https://github.com/modelcontextprotocol, but supports JSON-RPC over POST which is enough for Claude Code and other tools. Available tools:
list_apps,get_app,search_metrics,get_metric,get_ping.If we decide to productionize this we might want to use the Typescript SDK. Continuing with a simple Js implementation like this is probably fine too.
Why?
While testing SQL generation with AI agents (e.g. in https://github.com/akkomar/mozdata-claude-plugin) we found that the agent having access to Glean metadata can be useful.
Glean Dictionary is a Single Page Application with metrics loaded dynamically via JavaScript. This means that AI web fetchers only see an empty HTML shell, not the actual content. Two workarounds for that were:
https://probeinfo.telemetry.mozilla.org/(which requires you to know the API in order to write instructions and doesn't contain annotations)Given that it's low effort, I think it would make sense to have an official MCP endpoint in dictionary with support for all the available telemetry metadata.
Local testing
First start the server:
Then add it to Claude:
Then in Claude we can search metrics:
or access ping metadata including [annotations](https://github.com/mozilla/glean-annotations/blob/main/annotations/firefox_desktop/pings/messaging-system/README.md):