This project runs a local Grafana stack (Grafana, Prometheus, Loki) via Docker Compose and connects to it using the Grafana MCP server.
- Docker & Docker Compose
- Python
uvx(via uv)
docker compose up -dThis starts Grafana on http://localhost:3000, Prometheus on :9090, and Loki on :3100.
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.
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>"
}
}
}
}
}claude mcp add grafana \
-e GRAFANA_URL=http://localhost:3000 \
-e GRAFANA_SERVICE_ACCOUNT_TOKEN=<your-service-account-token> \
-- uvx mcp-grafana- Open Grafana at
http://localhost:3000 - Go to Administration → Service accounts
- Click Add service account, give it admin role
- Click Add service account token and copy the token
- Replace
<your-service-account-token>in the config above