grafana.com
grafana.com logo

Grafana

Integrates with Grafana to enable searching dashboards, fetching datasource information, querying Prometheus metrics, an...

Created byApr 22, 2025

Grafana MCP server

A [Model Context Protocol][mcp] (MCP) server for Grafana.
This provides access to your Grafana instance and the surrounding ecosystem.

Features

  • Search for dashboards
  • Get dashboard by UID
  • List and fetch datasource information
  • Query datasources
  • Query Prometheus metadata
  • Query Loki metadata
  • Search, create, update and close incidents
  • Start Sift investigations and view the results
  • Alerting
  • Access Grafana OnCall functionality
The list of tools is configurable, so you can choose which tools you want to make available to the MCP client. This is useful if you don't use certain functionality or if you don't want to take up too much of the context window. To disable a category of tools, use the --disable-<category> flag when starting the server. For example, to disable the OnCall tools, use --disable-oncall.

Tools

[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]

Usage

  1. Create a service account in Grafana with enough permissions to use the tools you want to use, generate a service account token, and copy it to the clipboard for use in the configuration file. Follow the [Grafana documentation][service-account] for details.
  1. Download the latest release of mcp-grafana from the releases page and place it in your $PATH.If you have a Go toolchain installed you can also build and install it from source, using the GOBIN environment variable to specify the directory where the binary should be installed. This should also be in your PATH.
  1. Add the server configuration to your client configuration file. For example, for Claude Desktop:
Note: if you see Error: spawn mcp-grafana ENOENT in Claude Desktop, you need to specify the full path to mcp-grafana.

Debug Mode

You can enable debug mode for the Grafana transport by adding the -debug flag to the command. This will provide detailed logging of HTTP requests and responses between the MCP server and the Grafana API, which can be helpful for troubleshooting.
To use debug mode with the Claude Desktop configuration, update your config as follows:

Development

Contributions are welcome! Please open an issue or submit a pull request if you have any suggestions or improvements.
This project is written in Go. Install Go following the instructions for your platform.
To run the server, use:
You can also run the server using the SSE transport inside Docker. To build the image, use
And to run the image, use:

Testing

There are three types of tests available:
  1. Unit Tests (no external dependencies required):
You can also run unit tests with:
  1. Integration Tests (requires docker containers to be up and running):
  1. Cloud Tests (requires cloud Grafana instance and credentials):
Note: Cloud tests are automatically configured in CI. For local development, you'll need to set up your own Grafana Cloud instance and credentials.
More comprehensive integration tests will require a Grafana instance to be running locally on port 3000; you can start one with Docker Compose:
The integration tests can be run with:
If you're adding more tools, please add integration tests for them. The existing tests should be a good starting point.

Linting

To lint the code, run:
This includes a custom linter that checks for unescaped commas in jsonschema struct tags. The commas in description fields must be escaped with \\, to prevent silent truncation. You can run just this linter with:
See the JSONSchema Linter documentation for more details.

License

This project is licensed under the Apache License, Version 2.0.

Grafana MCP server

A [Model Context Protocol][mcp] (MCP) server for Grafana.
This provides access to your Grafana instance and the surrounding ecosystem.

Features

  • Search for dashboards
  • Get dashboard by UID
  • List and fetch datasource information
  • Query datasources
  • Query Prometheus metadata
  • Query Loki metadata
  • Search, create, update and close incidents
  • Start Sift investigations and view the results
  • Alerting
  • Access Grafana OnCall functionality
The list of tools is configurable, so you can choose which tools you want to make available to the MCP client. This is useful if you don't use certain functionality or if you don't want to take up too much of the context window. To disable a category of tools, use the --disable-<category> flag when starting the server. For example, to disable the OnCall tools, use --disable-oncall.

Tools

[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]
[object Object]

Usage

  1. Create a service account in Grafana with enough permissions to use the tools you want to use, generate a service account token, and copy it to the clipboard for use in the configuration file. Follow the [Grafana documentation][service-account] for details.
  1. Download the latest release of mcp-grafana from the releases page and place it in your $PATH.If you have a Go toolchain installed you can also build and install it from source, using the GOBIN environment variable to specify the directory where the binary should be installed. This should also be in your PATH.
  1. Add the server configuration to your client configuration file. For example, for Claude Desktop:
Note: if you see Error: spawn mcp-grafana ENOENT in Claude Desktop, you need to specify the full path to mcp-grafana.

Debug Mode

You can enable debug mode for the Grafana transport by adding the -debug flag to the command. This will provide detailed logging of HTTP requests and responses between the MCP server and the Grafana API, which can be helpful for troubleshooting.
To use debug mode with the Claude Desktop configuration, update your config as follows:

Development

Contributions are welcome! Please open an issue or submit a pull request if you have any suggestions or improvements.
This project is written in Go. Install Go following the instructions for your platform.
To run the server, use:
You can also run the server using the SSE transport inside Docker. To build the image, use
And to run the image, use:

Testing

There are three types of tests available:
  1. Unit Tests (no external dependencies required):
You can also run unit tests with:
  1. Integration Tests (requires docker containers to be up and running):
  1. Cloud Tests (requires cloud Grafana instance and credentials):
Note: Cloud tests are automatically configured in CI. For local development, you'll need to set up your own Grafana Cloud instance and credentials.
More comprehensive integration tests will require a Grafana instance to be running locally on port 3000; you can start one with Docker Compose:
The integration tests can be run with:
If you're adding more tools, please add integration tests for them. The existing tests should be a good starting point.

Linting

To lint the code, run:
This includes a custom linter that checks for unescaped commas in jsonschema struct tags. The commas in description fields must be escaped with \\, to prevent silent truncation. You can run just this linter with:
See the JSONSchema Linter documentation for more details.

License

This project is licensed under the Apache License, Version 2.0.