Menu
Enterprise
Open source
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
Bash
export GRAFANA_URL="http://localhost:3000"
export GRAFANA_SERVICE_ACCOUNT_TOKEN="<your-token>"
mcp-grafana --transport sse --address localhost:8000Or with Docker:
Bash
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):
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:
Bash
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):
ini
[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:
Bash
systemctl --user enable --now mcp-grafanaRead-only mode
Bash
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
Additional helpful documentation, links, and articles:
Video

Getting started with managing your metrics, logs, and traces using Grafana
In this webinar, we’ll demo how to get started using the LGTM Stack: Loki for logs, Grafana for visualization, Tempo for traces, and Mimir for metrics.
Video

Getting started with Grafana dashboard design
In this webinar, you'll learn how to design stylish and easily accessible Grafana dashboards that tell a story.
Video

Building advanced Grafana dashboards
In this webinar, we’ll demo how to build and format Grafana dashboards.
Choose a product
Viewing: v13.0 (latest)
Find another version
Scroll for more