grafana-mcp-adapter

grafana-mcp-adapter

Read-only MCP server that exposes Grafana dashboards, datasources, and metric/log queries as tools, for use by skills in the TICKETS workspace.

Category
访问服务器

README

grafana-mcp-adapter

Read-only MCP server that exposes Grafana dashboards, datasources and metric/log queries as tools, for use by skills in the TICKETS workspace.

This is a private, standalone adapter: its own git repo, its own .env. It is not part of ia-tooling and does not depend on its stack — it only makes HTTPS calls out to the Grafana HTTP API (${GRAFANA_BASE_URL}/api). It was scaffolded by cloning the structure of fathom-mcp-adapter.

Architecture

The adapter is the MCP server. Internally it calls the Grafana HTTP API directly (just as the Fathom adapter calls Fathom's REST API). MCP servers are not chained to one another.

  • Auth: a Grafana service account token sent as a Bearer token in the Authorization header. Scope it to a read-only role (Viewer). Create the service account + token in Grafana → Administration → Service accounts.
  • Most tools return raw payloads (dashboard JSON, datasource lists). The exceptions are the high-volume ones: grafana_query returns a compact per-series digest by default (a full up query is ~8 MB of frames, far past what an MCP context wants), and grafana_logs_link returns a capped preview. Both can be pushed back toward raw (raw=true / a higher limit).
  • Read-only by design. Note that grafana_query is a POST (Grafana's /api/ds/query is POST-shaped) but only reads metrics/logs.

Tools

Tool Purpose
grafana_health Config/connectivity check (makes one authenticated call).
grafana_search_dashboards Search dashboards by title substring and/or tags.
grafana_get_dashboard Full dashboard JSON by uid.
grafana_list_datasources List configured datasources (uid, name, type).
grafana_query Run a PromQL/LogQL/etc. query against a datasource uid over a time range. Returns a per-series digest by default.
grafana_logs_link Build a permanent Grafana Explore (Loki) deep link for a customer's logs and return a preview of recent lines.

grafana_query response shape

The raw /api/ds/query response carries a full timestamp+value array per series, and a query like up can return thousands of series (~8 MB). By default the tool collapses each series to its labels + a numeric digest and caps the list:

{
  "results": {
    "A": {
      "status": 200,
      "series_count": 3085,        // total series before capping
      "series": [                  // capped to maxSeries (50)
        { "labels": { "job": "..." }, "count": 60, "first": 1, "last": 1, "min": 0, "max": 1, "avg": 0.98 }
      ],
      "truncated": 3035            // how many series were dropped from `series`
    }
  }
}

Pass raw=true to get the full (potentially very large) frames instead.

grafana_logs_link

Identify a customer/component with free text (client='april', component='gateway'); it matches case-insensitively against the service_name label, which on this instance encodes both (e.g. graviteeio-ae-april-rec-engine). Returns { query, explore_url, range, preview_count, preview } — paste explore_url (a permanent Grafana 11+ Explore link) into the ticket. The default range is the last hour; widen with from/to. When nothing matches, it returns close service_name values as suggestions so typos like aprl → april surface.

Examples (how a user asks for it)

Just ask in plain language — the agent maps it to the client / component / from / to / line_filter arguments for you.

"Give me the last hour of API gateway logs for Northwind." → { "client": "northwind", "component": "gateway" }

"Show me the engine logs for Contoso over the last 6 hours." → { "client": "contoso", "component": "engine", "from": "now-6h" }

"Find the gateway errors for Globex in the last 3 hours, give me up to 200 lines." → { "client": "globex", "component": "gateway", "line_filter": "error", "from": "now-3h", "limit": 200 }

"I need the UI logs for Initech during yesterday's incident between 10:00 and 11:00." → { "client": "initech", "component": "ui", "from": "<epoch ms 10:00>", "to": "<epoch ms 11:00>" }

"Give me the production gateway logs for Northwind." → { "client": "northwind prod", "component": "gateway" }

(The environment — prod, rec, dev — isn't a separate argument: it lives inside service_name, so just fold it into client as another word. Both client and component are matched as case-insensitive substrings with .* between them, so northwind prod matches …-northwind-prod-….)

Each call returns explore_url — paste it into the ticket as a permanent link — plus a capped preview of the newest matching lines.

Setup

npm install
cp .env.example .env   # then fill in GRAFANA_BASE_URL and GRAFANA_TOKEN
npm test
npm start              # speaks MCP over stdio

GRAFANA_TOKEN must come from .env (which is git-ignored) — never hardcode it.

Wiring into the TICKETS MCP session

Build the image and add a grafana entry to the TICKETS .mcp.json, alongside fathom / zendesk / vectordb / github. It only needs HTTPS egress.

docker build -t grafana-mcp-adapter .
// .mcp.json (TICKETS)
{
  "mcpServers": {
    "grafana": {
      "command": "docker",
      "args": ["run", "--rm", "-i", "--env-file", "/ABSOLUTE/PATH/TO/.env", "grafana-mcp-adapter"]
    }
  }
}

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选