Command Palette

Search for a command to run...

UnylyUnyly
Весь каталог

Grafana Cursor

БесплатноНе проверен

Query Grafana logs, metrics, and dashboards from Cursor. Enables the AI to call your Grafana instance via tools without leaving the editor.

GitHubEmbed

Описание

Query Grafana logs, metrics, and dashboards from Cursor. Enables the AI to call your Grafana instance via tools without leaving the editor.

README

Query Grafana logs, metrics, and dashboards from Cursor. This MCP server lets the AI in Cursor call your Grafana instance via tools—no need to leave the editor to check logs or run a PromQL query.

  • Logs – Loki, Elasticsearch. Filter by label (e.g. call_id, session_id, request_id) or custom LogQL/Lucene. Results saved to a temp file so Cursor can analyze them.
  • Metrics – Run Prometheus/PromQL (or compatible) queries.
  • Dashboards – List and inspect dashboards by UID.
  • Alerts – List provisioned alert rules.
  • Explore – Build “Open in Grafana” URLs for any query.

Works with any Grafana instance and any log/metric datasource you already use. No custom log store—Grafana stays the single source of truth.

Package: grafana-cursor-mcp on npm


Quick start

You only need the MCP config and your Grafana URL + API key. No clone or build required if you use the npm package.

1. Get a Grafana API token

  • In Grafana: AdministrationService accounts (or API Keys) → create one with Viewer (or least privilege). Copy the token.

2. Add the MCP server to Cursor

Open Cursor SettingsMCP (or edit ~/.cursor/mcp.json). Add this (or merge the grafana-logs entry into your existing mcpServers):

{
  "mcpServers": {
    "grafana-logs": {
      "command": "npx",
      "args": ["-y", "grafana-cursor-mcp"],
      "env": {
        "GRAFANA_URL": "https://your-grafana.example.com",
        "GRAFANA_API_KEY": "your-service-account-token"
      }
    }
  }
}

Replace only:

  • GRAFANA_URL → your Grafana base URL (no trailing slash).
  • GRAFANA_API_KEY → the token from step 1.

Optional: add "GRAFANA_DEFAULT_DATASOURCE_UID": "your-loki-uid" to env if you have one default log datasource.

3. Restart Cursor

The AI can now use the Grafana tools. No clone or build—grafana-cursor-mcp runs via npx.


Alternative: run from source

If you prefer to clone and build locally:

git clone https://github.com/hacktivist1512/grafana-cursor-mcp.git
cd grafana-cursor-mcp
npm install
npm run build:mcp

In your MCP config, use "command": "node" and "args": ["/absolute/path/to/grafana-cursor-mcp/packages/mcp-server/dist/index.js"] instead of npx. See mcp.json.example in the repo.


Config (env)

Variable Required Description
GRAFANA_URL Yes Grafana base URL (e.g. https://grafana.example.com).
GRAFANA_API_KEY Yes Service account or API key token. (GRAFANA_TOKEN is also accepted.)
GRAFANA_DEFAULT_DATASOURCE_UID No Default log datasource UID so log tools don’t need datasource_uid when there’s only one.

Security: Keep the API key only in env or MCP config—never in code or docs. Use a Viewer (or minimal) role.


Tools the AI can use

Logs

Tool Description
list_log_datasources List log datasources (Loki, Elasticsearch) with name and UID. Use when the user hasn’t specified which datasource to query.
get_logs Run a custom log query (LogQL for Loki, Lucene for ES). Optional simple_query for an extra case‑insensitive filter. Full result is written to a temp .log file (path returned; files removed after 24h). Default limit 7000 lines; the AI is instructed to ask the user how many lines to fetch.
get_logs_for_call Get logs by label (e.g. call_id, session_id, request_id, trace_id). Use label_name to choose the label and call_id for the value. Optional topic for a second filter. Same temp file and “ask for limit” behavior. Fits any correlation/session/request id in Loki.

Metrics

Tool Description
query_metrics Run a Prometheus/PromQL (or compatible) query. Params: datasource_uid, query, from, to, optional instant. Returns time series or table as text.

Grafana context

Tool Description
grafana_info Get org name and all datasources (name, UID, type). Use to check connection and pick the right datasource.
get_explore_url Build a Grafana Explore URL for a given datasource, query, and time range (“Open in Grafana”).

Dashboards

Tool Description
list_dashboards Search dashboards (query, folder, limit). Returns title, UID, folder.
get_dashboard Get a dashboard by UID. With summary_only=true (default) returns a short panel summary; otherwise full JSON.

Alerting

Tool Description
list_alert_rules List provisioned alert rules (/api/v1/provisioning/alert-rules). Returns name, folder, rule group, condition.

Repo structure

  • packages/mcp-server – MCP server (Node/TypeScript). All tools above; stdio transport for Cursor.
  • packages/grafana-app – Optional Grafana app plugin (e.g. “Cursor logs” page and MCP snippet).

Publishing (maintainers)

The package is published as grafana-cursor-mcp. To publish a new version: cd packages/mcp-server, bump version in package.json, then npm publish. See docs/GITHUB_AND_NPM.md for details.


License

Apache-2.0. See LICENSE.

from github.com/hacktivist1512/grafana-cursor-mcp

Установка Grafana Cursor

У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.

▸ github.com/hacktivist1512/grafana-cursor-mcp

FAQ

Grafana Cursor MCP бесплатный?

Да, Grafana Cursor MCP бесплатный — установка в пару кликов через Unyly без оплаты.

Нужен ли API-ключ для Grafana Cursor?

Нет, Grafana Cursor работает без API-ключей и переменных окружения.

Grafana Cursor — hosted или self-hosted?

Доступен hosted-вариант: Unyly запускает сервер в облаке, локальная установка не обязательна.

Как установить Grafana Cursor в Claude Desktop, Claude Code или Cursor?

Открой Grafana Cursor на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.

Похожие MCP

Compare Grafana Cursor with

Не уверен что выбрать?

Найди свой стек за 60 секунд

Автор?

Embed-бейдж для README

Похожее

Все в категории ai