Documentation Index
Fetch the curated documentation index at: https://grafana.com/llms.txt
Fetch the complete documentation index at: https://grafana.com/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: https://grafana.com/docs/grafana/next/developer-resources/mcp/clients/vscode-copilot.md (append .md) or send Accept: text/markdown to https://grafana.com/docs/grafana/next/developer-resources/mcp/clients/vscode-copilot/. For the curated documentation index, use https://grafana.com/llms.txt. For the complete documentation index, use https://grafana.com/llms-full.txt.
This is documentation for the next version of Grafana documentation. For the latest stable release, go to the latest version.
VS Code and GitHub Copilot
This guide helps you set up the mcp-grafana server for VS Code with GitHub Copilot agent mode.
Prerequisites
- VS Code with GitHub Copilot extension
- Grafana 9.0+ with a service account token
mcp-grafanabinary installed
Important
GitHub Copilot in VS Code uses SSE transport, not stdio. You need to run mcp-grafana as an HTTP server.
Setup
1. Start the MCP server
export GRAFANA_URL="http://localhost:3000"
export GRAFANA_SERVICE_ACCOUNT_TOKEN="<your-token>"
mcp-grafana --transport sse --address localhost:8000Or with Docker:
docker run --rm -p 8000:8000 \
-e GRAFANA_URL=http://host.docker.internal:3000 \
-e GRAFANA_SERVICE_ACCOUNT_TOKEN=<your-token> \
grafana/mcp-grafana --transport sse --address :80002. Configure VS Code
Add to your VS Code settings (settings.json):
{
"github.copilot.chat.mcpServers": {
"grafana": {
"url": "http://localhost:8000/sse"
}
}
}Or use workspace settings (.vscode/settings.json) for project-specific config.
Debug mode
Start the server with debug logging:
mcp-grafana --transport sse --address localhost:8000 -debugVerify configuration
- Restart VS Code after configuration changes
- Open Copilot Chat (Ctrl+Shift+I)
- Type:
@grafana list dashboards - If tools are available, Copilot will query Grafana
Troubleshooting
Server not connecting:
- Verify server is running:
curl http://localhost:8000/sse - Check firewall allows port 8000
- Restart VS Code after configuration changes
Tools not appearing:
- GitHub Copilot agent mode required (may need Copilot Chat enabled)
- Check VS Code output panel for MCP errors
Running as a service
For persistent server, create a systemd unit or launchd plist.
Linux systemd (~/.config/systemd/user/mcp-grafana.service):
[Unit]
Description=Grafana MCP Server
After=network.target
[Service]
ExecStart=/path/to/mcp-grafana --transport sse --address localhost:8000
Environment=GRAFANA_URL=http://localhost:3000
Environment=GRAFANA_SERVICE_ACCOUNT_TOKEN=<your-token>
Restart=always
[Install]
WantedBy=default.targetEnable with:
systemctl --user enable --now mcp-grafanaRead-only mode
mcp-grafana --transport sse --address localhost:8000 --disable-writeNext steps
- Transports and addresses for SSE details.
- Configure authentication for Grafana credentials.
Was this page helpful?
Related resources from Grafana Labs


