Grafana MCP
MCP server for Grafana that provides tools to interact with dashboards, data sources, alerts, and more.
README
Grafana MCP
This project provides MCP server for Grafana, including MCP tools to interact with Grafana dashboards, data sources, alerts, and more.
The package includes a dashboard template resource that is properly bundled with the package for use when installed.
Usage
Installation
- Create a virtual environment (recommended)
python -m venv venv
source venv/bin/activate
- Install this package directly from GitHub using pip:
pip install -e git+https://github.com/izaitsevfb/grafana-mcp.git#egg=grafana_mcp
(Alternatively, you can install it locally with pip install -e .)
- Configure Grafana authentication
Create a .env file with your Grafana URL and API token:
cp .env.example .env
Then edit the .env file to add your actual Grafana URL and API token:
GRAFANA_URL=http://your-grafana-server:3000
GRAFANA_API_TOKEN=your-api-token-here
You can generate an API token in Grafana by navigating to: Configuration → API Keys → New API key.
- After installation, the MCP server can be run as:
python -m grafana_mcp
- Add this MCP server to Claude Code:
claude mcp add-json grafana '{ "type": "stdio", "command": "python", "args": [ "-m", "grafana_mcp" ], "env": {} }'
Note: By default, MCP config applies only to the current directory. If you want to use it globally, add --scope user to the command above:
claude mcp add-json --scope user grafana '{ "type": "stdio", "command": "python", "args": [ "-m", "grafana_mcp" ], "env": {} }'
- Run Claude Code as usual:
claude
Development
Development Installation
- Clone the repository
- Install in development mode:
pip install -e .
The package uses Python's package resource management system to include the dashboard template. The dashboard.json file is stored in the src/grafana_mcp/ directory and is accessed using importlib.resources when the package is installed.
Testing
Run unit tests:
python -m unittest discover tests
For testing with token authentication, ensure you have created a .env file with your Grafana credentials as described above. The test suite includes mocked tests that don't require an actual Grafana instance.
Tools
The Grafana MCP provides the following tools:
Available Tools
Dashboard Management
get_grafana_info(): Get information about the connected Grafana instance including version and connection statuslist_dashboards(): List all dashboards from the connected Grafana instanceget_dashboard(uid): Get details about a specific dashboard by UID
Organization Management
get_organization(): Get information about the current organization
Data Source Management
list_datasources(): List all available data sources
Requirements
grafana-client: Python client for Grafana APIpython-dotenv: For loading environment variables from.envfilemcp: Model Context Protocol server implementation
Authentication
This package uses token authentication with the Grafana API. To configure authentication:
- In your Grafana instance, create an API key with appropriate permissions
- Create a
.envfile with the following variables:GRAFANA_URL=http://your-grafana-url:3000 GRAFANA_API_TOKEN=your-api-token-here - The MCP server will automatically load these credentials when started
More tools and features will be added in future versions.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.