telemetry-mcp
A read-only MCP server for querying telemetry data from configurable backends. Provides tools to list sources, describe schemas, run bounded queries, and compute aggregates.
README
telemetry-mcp
telemetry-mcp is a small, read-only Model Context
Protocol server that exposes a configurable
metrics/telemetry backend as typed tools: list sources, describe a source's
schema, run a bounded query, and compute a single aggregate. It turns ad-hoc
"go read the numbers" scripts into constrained, structured tools an agent can
call.
The server is schema-agnostic by design: it hard-codes no dataset, table, or metric. The shape of the available telemetry is supplied entirely by the injected backend, so the same server works against whatever dataset infra wires up.
Repo structure: this ships as a per-server repo, following the shipped convention (e.g.
reddit-mcp,dispatch-mcp). Whether the fleet's MCP servers consolidate into a singleagent-mcprepo is pending a consolidation decision; until that lands, this stays per-server.
Tools
| Tool | Purpose |
|---|---|
metrics_list_sources() |
List the telemetry sources (datasets/tables/metrics) the backend exposes. |
metrics_describe(source) |
Describe one source: its description and column -> type schema. |
metrics_query(source, start, end, filters?, limit?) |
Bounded, read-only query over [start, end); returns structured rows. |
metrics_summary(metric, start, end, agg) |
A single aggregate (count/sum/avg/min/max) of a metric over a range. |
start / end are ISO-8601 instants. filters is an optional column -> value
mapping (keys are validated; values are bound as query parameters by the backend,
never string-interpolated). limit is capped by the core.
Security model
This server is built so that exposing it does not expose arbitrary data access or command execution. The properties below are enforced in code and covered by tests.
- Read-only. The tools are list/describe/query/summary. There is no write,
no DDL, and no
run_sql/ raw-query escape hatch — a caller cannot supply query text. - Bounded. Every query is time-ranged and
limit-capped (MAX_LIMIT), so a call cannot pull an unbounded result set. - No embedded credentials. Nothing in this package stores a token or key.
Credentials are resolved at call time by an injected
CredentialProvider(backed by WIF/GSM/env in production) and handed to the backend per request; they never live in source, in the service, or in a returned payload (tests assert the sentinel credential never appears in output). - Validated handles. Source / metric / filter-key names are restricted to a conservative identifier shape, so a rejected lookup cannot smuggle injection or path traversal into the backend (defence in depth; the backend's own allowlist is the real gate).
- Schema-agnostic. No dataset/table/metric is hard-coded; the backend defines what exists, so the server cannot leak the existence of anything the backend does not expose.
Deliberate omissions
- No tool lets the caller supply or override executed query text.
- No tool returns or accepts credentials.
- No mutation/DDL capability — if you need to change data, that is out of scope here by design.
Configuration (environment, resolved at call time)
| Variable | Effect |
|---|---|
TELEMETRY_BQ_PROJECT |
BigQuery project the production backend targets (consumed once infra wires it). |
TELEMETRY_BQ_DATASET |
BigQuery dataset whose tables/views become the available sources. |
No credentials are read from the environment by this server; identity is resolved per call from the runtime (WIF/GSM) by the credential provider.
What infra must wire (the build split)
This repo is the offline-testable scaffold. The core, the MCP wrapper, the backend interface, and a full offline test suite (fake in-memory backend) are complete here. The live BigQuery adapter + credentials are intentionally not wired — that is the infra half:
- Backend implementation. Complete
BigQueryBackendinsrc/telemetry_mcp/backend.py(currently fails fast with "not wired up"). It must implement the read-only, parameterised path:list_sources/describefrom the dataset's tables/views andINFORMATION_SCHEMA.query/summaryas read-only BigQuery jobs where the time range and filter values are passed as query parameters (never interpolated), andlimitbecomes aLIMITclause.- Install the optional dependency:
pip install 'telemetry-mcp[bigquery]'.
- Dataset. A BigQuery dataset (in the chosen project, e.g.
speedforge-prod-499002) whose tables/views are the telemetry sources. The server adopts whatever schema the dataset has — nothing is hard-coded. - Identity (keyless). A Workload Identity Federation service account
with read-only BigQuery access to that dataset (e.g.
roles/bigquery.dataViewerroles/bigquery.jobUser). TheCredentialProviderresolves this at call time; no key is stored in this repo or the image. (Prefer WIF over a static SA key.)
- Config. Set
TELEMETRY_BQ_PROJECTandTELEMETRY_BQ_DATASETfor the workload.
Until step 1 lands, the production backend raises and only the fake-backed offline path runs — so this scaffold is safe to ship and CI is green without any GCP access.
Install
Run directly from GitHub with the MCP extra:
uvx --from "git+https://github.com/selamy-labs/telemetry-mcp@v0.1.0#egg=telemetry-mcp[mcp]" telemetry-mcp
Or with pipx:
pipx install "telemetry-mcp[mcp] @ git+https://github.com/selamy-labs/telemetry-mcp@v0.1.0"
MCP client config
{
"mcpServers": {
"telemetry": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/selamy-labs/telemetry-mcp@v0.1.0#egg=telemetry-mcp[mcp]",
"telemetry-mcp"
],
"env": {
"TELEMETRY_BQ_PROJECT": "speedforge-prod-499002",
"TELEMETRY_BQ_DATASET": "telemetry"
}
}
}
}
Architecture
The metrics logic lives once in telemetry_mcp.core.MetricsService; the MCP
server in telemetry_mcp.mcp_server is a thin wrapper that serialises structured
results to JSON and maps expected failures to ToolError. All data access goes
through an injected backend (telemetry_mcp.backend.MetricsBackend) and all
credential resolution through an injected CredentialProvider, so the full
validate / route / shape path is exercised offline in tests with a fake
in-memory backend — no GCP, no network. The default backend
(BigQueryBackend) uses only the standard library until infra wires it, so the
core package has zero runtime dependencies; the mcp SDK and
google-cloud-bigquery are optional extras.
Development
python -m pip install -e ".[test]"
ruff format --check .
ruff check .
coverage run -m pytest
coverage report --fail-under=95
License
MIT — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。