---
title: "Cursor | Grafana documentation"
description: "Set up the Grafana MCP server for Cursor."
---

# Cursor

This guide helps you set up the `mcp-grafana` server for Cursor.

## Prerequisites

- Cursor IDE installed
- Grafana 9.0+ with a service account token
- `mcp-grafana` binary in your PATH

## Configuration

Two options for configuration location:

Expand table

| Scope                 | Path                               |
|-----------------------|------------------------------------|
| Global (all projects) | `~/.cursor/mcp.json`               |
| Project-specific      | `.cursor/mcp.json` in project root |

### Add using the UI

1. Open Cursor Settings -&gt; **Tools &amp; Integrations**
2. Click **New MCP Server**
3. This opens `~/.cursor/mcp.json` for editing

### Manual configuration

Create or edit `~/.cursor/mcp.json`:

JSON ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```json
{
  "mcpServers": {
    "grafana": {
      "command": "mcp-grafana",
      "args": [],
      "env": {
        "GRAFANA_URL": "http://localhost:3000",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN": "<your-token>"
      }
    }
  }
}
```

### Docker configuration

JSON ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```json
{
  "mcpServers": {
    "grafana": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "GRAFANA_URL",
        "-e",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN",
        "grafana/mcp-grafana",
        "-t",
        "stdio"
      ],
      "env": {
        "GRAFANA_URL": "http://host.docker.internal:3000",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN": "<your-token>"
      }
    }
  }
}
```

## Debug mode

JSON ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```json
{
  "mcpServers": {
    "grafana": {
      "command": "mcp-grafana",
      "args": ["-debug"],
      "env": {
        "GRAFANA_URL": "http://localhost:3000",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN": "<your-token>"
      }
    }
  }
}
```

## Verify configuration

1. Go to Cursor Settings -&gt; **Tools &amp; Integrations**
2. Find **grafana** in the MCP servers list
3. Click the refresh button if needed
4. Green indicator = server running
5. Open Composer and ask: “List my Grafana dashboards”

## Troubleshooting

**Server not appearing:**

- Check JSON syntax (trailing commas break it)
- Restart Cursor
- Verify binary path: `which mcp-grafana`

**Tools not working:**

- Click refresh button in MCP settings
- Check Grafana token permissions
- Enable `-debug` flag and check output

## Read-only mode

JSON ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```json
{
  "mcpServers": {
    "grafana": {
      "command": "mcp-grafana",
      "args": ["--disable-write"],
      "env": {
        "GRAFANA_URL": "http://localhost:3000",
        "GRAFANA_SERVICE_ACCOUNT_TOKEN": "<your-token>"
      }
    }
  }
}
```

## Next steps

- [Set up](../../set-up/) for other install options (uvx, Helm).
- [Configure authentication](../../configure/authentication/) for Grafana credentials.
