Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/grafana-cloud/machine-learning/mcp/set-up/install-with-docker.md, or by sending Accept: text/markdown to https://grafana.com/docs/grafana-cloud/machine-learning/mcp/set-up/install-with-docker/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/llms-full.txt.
Install with Docker
Run the Grafana MCP server using the official image from Docker Hub. The image defaults to SSE, but most users will want to use STDIO mode for direct integration with AI assistants like Claude Desktop.
What you’ll achieve
You run the server in a container and connect your MCP client. You can use stdio (typical for Claude Desktop and similar), SSE, streamable HTTP, or streamable HTTP with server TLS.
Before you begin
- Docker installed.
- A Grafana instance (Grafana 9.0 or later) and a service account token.
Run the server in STDIO mode
For direct integration with AI assistants, most users will want to use STDIO mode. Pass -t stdio and -i so the container keeps stdin open.
Local Grafana:
docker pull grafana/mcp-grafana
docker run --rm -i \
-e GRAFANA_URL=http://localhost:3000 \
-e GRAFANA_SERVICE_ACCOUNT_TOKEN=<your service account token> \
grafana/mcp-grafana -t stdioGrafana Cloud
docker pull grafana/mcp-grafana
docker run --rm -i \
-e GRAFANA_URL=https://myinstance.grafana.net \
-e GRAFANA_SERVICE_ACCOUNT_TOKEN=<your service account token> \
grafana/mcp-grafana -t stdioRun the server in SSE mode
In this mode, the server runs as an HTTP server that clients connect to. You must expose port 8000.
docker pull grafana/mcp-grafana
docker run --rm -p 8000:8000 \
-e GRAFANA_URL=http://localhost:3000 \
-e GRAFANA_SERVICE_ACCOUNT_TOKEN=<your service account token> \
grafana/mcp-grafanaPoint your client at http://localhost:8000/sse (or your host and port).
Run the server in streamable HTTP mode
In this mode, the server operates as an independent process that can handle multiple client connections. You must expose port 8000 and set -t streamable-http.
docker pull grafana/mcp-grafana
docker run --rm -p 8000:8000 \
-e GRAFANA_URL=http://localhost:3000 \
-e GRAFANA_SERVICE_ACCOUNT_TOKEN=<your service account token> \
grafana/mcp-grafana -t streamable-httpThe default MCP path is /mcp (see --endpoint-path). Clients often use http://localhost:8000/mcp.
Run in HTTPS streamable HTTP mode with server TLS certificates
To terminate TLS on the MCP server, mount certificates and set --server.tls-cert-file, --server.tls-key-file, and --address (for example :8443):
docker pull grafana/mcp-grafana
docker run --rm -p 8443:8443 \
-v /path/to/certs:/certs:ro \
-e GRAFANA_URL=http://localhost:3000 \
-e GRAFANA_SERVICE_ACCOUNT_TOKEN=<your service account token> \
grafana/mcp-grafana \
-t streamable-http \
--address :8443 \
--server.tls-cert-file /certs/server.crt \
--server.tls-key-file /certs/server.keyNext steps
- Install the binary for a host-installed binary.
- Client configuration examples for JSON snippets (including Docker).
- Transports and addresses and Server TLS (streamable-http).
Was this page helpful?
Related resources from Grafana Labs


