grafana-cursor-mcp
Enables querying Elasticsearch logs via Lucene queries, integrated as a log datasource within Grafana.
Allows querying Grafana logs, metrics, dashboards, and alerts, including listing datasources, running LogQL/PromQL queries, and generating Explore URLs.
Allows running Prometheus/PromQL queries for metrics, retrieving time series data from Prometheus-compatible datasources.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@grafana-cursor-mcpfind logs with call_id abc123"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Grafana MCP for Cursor
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: Administration → Service accounts (or API Keys) → create one with Viewer (or least privilege). Copy the token.
2. Add the MCP server to Cursor
Open Cursor Settings → MCP (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:mcpIn 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.
Related MCP server: Grafana MCP Server
Config (env)
Variable | Required | Description |
| Yes | Grafana base URL (e.g. |
| Yes | Service account or API key token. ( |
| No | Default log datasource UID so log tools don’t need |
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 |
get_logs_for_call | Get logs by label (e.g. |
Metrics
Tool | Description |
query_metrics | Run a Prometheus/PromQL (or compatible) query. Params: |
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 ( |
get_dashboard | Get a dashboard by UID. With |
Alerting
Tool | Description |
list_alert_rules | List provisioned alert rules ( |
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.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/hacktivist1512/grafana-cursor-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server