Mcp Grafana
grafana/mcp-grafana · 3.1k stars · Go · Apache-2.0
MCP server MCP server for Grafana
Install
The repo has no one-line install. Follow its README.
Files
Grafana MCP server
A [Model Context Protocol][mcp] (MCP) server for Grafana.
This provides access to your Grafana instance and the surrounding ecosystem.
Quick Start
Requires uv. Add the following to your MCP client configuration (e.g. Claude Desktop, Cursor):
{
"mcpServers": {
"grafana": {
"command": "uvx",
"args": ["mcp-grafana"],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_SERVICE_ACCOUNT_TOKEN": "<your service account token>"
}
}
}
}
For Grafana Cloud, replace GRAFANA_URL with your instance URL (e.g. https://myinstance.grafana.net). See Usage for more installation options including Docker, binary, and Helm.
Requirements
- Grafana version 9.0 or later is required for full functionality. Some features, particularly datasource-related operations, may not work correctly with earlier versions due to missing API endpoints.
Features
_The following features are currently available in MCP server. This list is for informational purposes only and does not represent a roadmap or commitment to future features._
Dashboards
- Search for dashboards: Find dashboards by title, folder UID, tag, or starred status
- Get dashboard by UID: Retrieve full dashboard details using its unique identifier. Pass optional
versionto load a saved snapshot instead of the current dashboard. _Warning: Large dashboards can consume significant context window space._ - List dashboard versions: List saved versions of a dashboard as compact metadata (version number, author, timestamp, save message)
- Get dashboard summary: Get a compact overview of a dashboard including title, panel count, panel types, variables, and metadata without the full JSON to minimize context window usage
- Get dashboard property: Extract specific parts of a dashboard using JSONPath expressions (e.g.,
$.title,$.panels[*].title) to fetch only needed data and reduce context window consumption - Update or create a dashboard: Modify existing dashboards or create new ones. _Warning: Requires full dashboard JSON which can consume large amounts of context window space._
- Patch dashboard: Apply specific changes to a dashboard without requiring the full JSON, significantly reducing context window usage for targeted modifications
- Get panel queries and datasource info: Get the title, query string, and datasource information (including UID and type, if available) from every panel in a dashboard
Run Panel Query
Note: Run panel query tools are disabled by default. To enable them, add
runpanelqueryto your--enabled-toolsflag.
- Run panel query: Execute a dashboard panel's query with custom time ranges and variable overrides.
#### Context Window Management
The dashboard tools now include several strategies to manage context window usage effectively (issue #101):
- Use
get_dashboard_summaryfor dashboard overview and planning modifications - Use
get_dashboard_propertywith JSONPath when you only need specific dashboard parts - Avoid
get_dashboard_by_uidunless you specifically need the complete dashboard JSON
Datasources
- List and fetch datasource information: View all configured datasources and retrieve detailed information about each.
- _Supported datasource types: Prometheus, Loki, ClickHouse, CloudWatch, Elasticsearch, OpenSearch, Snowflake, Athena._
Query Examples
Note: Query examples tools are disabled by default. To enable them, add
examplesto your--enabled-toolsflag.
- Get query examples: Retrieve example queries for different datasource types to learn query syntax.
Prometheus Querying
- Query Prometheus: Execute PromQL queries (supports both instant and range metric queries) against Prometheus datasources.
- Query Prometheus metadata: Retrieve metric metadata, metric names, label names, and label values from Prometheus datasources.
- Query histogram percentiles: Calculate histogram percentile values (p50, p90, p95, p99) using histogram_quantile.
Loki Querying
- Query Loki logs and metrics: Run both log queries and metric queries using LogQL against Loki datasources.
- Query Loki metadata: Retrieve label names, label values, and stream statistics from Loki datasources.
- Query Loki patterns: Retrieve log patterns detected by Loki to identify common log structures and anomalies.
InfluxDB Querying
Note: InfluxDB tools are disabled by default. To enable them, add
influxdbto your--enabled-toolsflag.
- Query InfluxDB: Execute queries against InfluxDB datasources using either InfluxQL (v1.x) or Flux (v2.x). The dialect is inferred from the datasource configuration, or can be set explicitly via the
dialectparameter.
SQL Datasource Querying
Note: SQL tools are disabled by default. To enable them, add
sqlto your--enabled-toolsflag. Back-compat aliasesclickhouse,snowflake, andathenaalso work.
Unified SQL tools support ClickHouse, Snowflake, Athena, MySQL, PostgreSQL, and MSSQL through a single set of tools. Queries go through Grafana's datasource plugins, so authentication is handled by datasource configuration — credentials are never seen by the MCP server.
- List databases/schemas/catalogs: Discover organizational units for a SQL datasource. For Athena, omit catalog to list catalogs, or pass a catalog to list databases.
- List tables: List tables in a database or schema with metadata (row counts, sizes where available).
- Describe table schema: Get column names, types, nullability, defaults, and comments.
- Query SQL: Execute SQL queries with datasource-specific macro substitution (
$__timeFilter(col),$__from/$__to,$__interval,${varname}), automatic limit enforcement, and template variable support.
CloudWatch Querying
Note: CloudWatch tools are disabled by default. To enable them, add
cloudwatchto your--enabled-toolsflag.
- List CloudWatch namespaces: Discover available AWS CloudWatch namespaces.
- List CloudWatch metrics: List metrics available in a specific namespace.
- List CloudWatch dimensions: Get dimensions for filtering metric queries.
- Query CloudWatch: Execute CloudWatch metric queries with time range support.
Google Cloud Logging Querying
Note: Google Cloud Logging tools are disabled by default. To enable them, add
cloudloggingto your--enabled-toolsflag. Requires the Google Cloud Logging datasource plugin (googlecloud-logging-datasource) version 1.8.0 or later, which needs Grafana 11.2+. Older plugin versions return a different response layout andquery_cloud_loggingreports an error asking for an upgrade.
- List Cloud Logging projects: Discover the GCP project IDs the datasource can read logs from.
- List Cloud Logging buckets and views: Discover log buckets and log views to scope a query.
- Query Cloud Logging: Run Cloud Logging query language filters (e.g.
resource.type="k8s_container" AND severity>=ERROR) with time range and limit; returns entries newest-first with severity, body, labels, and trace ID. GCP authentication is handled by the datasource configuration.
Graphite Querying
Note: Graphite tools are disabled by default. To enable them, add
graphiteto your--enabled-toolsflag.
- Query Graphite: Execute Graphite render API queries against a Graphite datasource.
- List Graphite metrics: Browse and discover Graphite metric paths.
- List Graphite tags: List available Graphite tags and tag values.
- Query Graphite density: Query Graphite metric density for a given pattern.
Elasticsearch/OpenSearch Querying
Note: Elasticsearch/OpenSearch tools are disabled by default. To enable them, add
elasticsearchto your--enabled-toolsflag.
- Query Elasticsearch/OpenSearch: Execute search queries against Elasticsearch or OpenSearch datasources using either Lucene query syntax or Elasticsearch Query DSL. Supports filtering by time range and retrieving logs, metrics, or any indexed data. Returns documents with their index, ID, source fields, and optional relevance score.
Quickwit Querying
Note: Quickwit tools are disabled by default. To enable them, add
quickwitto your--enabled-toolsflag.
Facts
- Kind
- MCP server
- Repo
- grafana/mcp-grafana
- Group
- Uncategorized
- Stars
- 3.1k
- License
- Apache-2.0
- Language
- Go
- Last push
- 2026-10-09
- Forks
- 460
- 1Everythingmodelcontextprotocol/serversThis MCP server attempts to exercise all the features of the MCP protocol. It is not intended to be a useful server, but rather a test server for builders of MCP clients. It implements prompts, tools, resources, sampling, and more to showcase MCP capabilities.85.8k
- 2Fetchmodelcontextprotocol/serversA Model Context Protocol server that provides web content fetching capabilities. This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.85.8k
- 3Gitmodelcontextprotocol/serversA Model Context Protocol server for Git repository interaction and automation. This server provides tools to read, search, and manipulate Git repositories via Large Language Models.85.8k
- 4Memorymodelcontextprotocol/serversA basic implementation of persistent memory using a local knowledge graph. This lets Claude remember information about the user across chats.85.8k
- 5Sequential Thinkingmodelcontextprotocol/serversAn MCP server implementation that provides a tool for dynamic and reflective problem-solving through a structured thinking process.85.8k
- 6Timemodelcontextprotocol/serversA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.85.8k