Skip to content

AlahmadiQ8/grafana-mcp-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Grafana MCP Demo

This project runs a local Grafana stack (Grafana, Prometheus, Loki) via Docker Compose and connects to it using the Grafana MCP server.

Prerequisites

  • Docker & Docker Compose
  • Python uvx (via uv)

Start the Stack

docker compose up -d

This starts Grafana on http://localhost:3000, Prometheus on :9090, and Loki on :3100.

Add the Grafana MCP Server

Option 1: VS Code (workspace config)

Create a .mcp.json file in your project root:

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

VS Code will automatically detect this file and offer to start the MCP server.

Option 2: VS Code (user-level config)

Open your user settings JSON (Cmd+Shift+P → "Preferences: Open User Settings (JSON)") and add:

{
  "mcp": {
    "servers": {
      "grafana": {
        "command": "uvx",
        "args": ["mcp-grafana"],
        "env": {
          "GRAFANA_URL": "http://localhost:3000",
          "GRAFANA_SERVICE_ACCOUNT_TOKEN": "<your-service-account-token>"
        }
      }
    }
  }
}

Option 3: CLI (Claude Code)

claude mcp add grafana \
  -e GRAFANA_URL=http://localhost:3000 \
  -e GRAFANA_SERVICE_ACCOUNT_TOKEN=<your-service-account-token> \
  -- uvx mcp-grafana

Generate a Service Account Token

  1. Open Grafana at http://localhost:3000
  2. Go to Administration → Service accounts
  3. Click Add service account, give it admin role
  4. Click Add service account token and copy the token
  5. Replace <your-service-account-token> in the config above

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors