PMM MCP Server
Provides validated read-only SELECT access to PMM Query Analytics data stored in ClickHouse, with row and time-window limits.
Provides read-only access to MongoDB monitoring metrics through PromQL and Query Analytics via PMM, including slow queries and query details.
Provides read-only access to MySQL monitoring metrics through PromQL and Query Analytics via PMM, including slow queries, per-service load, and query distribution.
Provides read-only access to PostgreSQL monitoring metrics through PromQL and Query Analytics via PMM, including slow queries and query details.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
PMM MCP Server
A community-maintained Model Context Protocol server for Percona Monitoring and Management (PMM 2.x and 3.x). It gives Claude and other MCP clients access to MySQL, MongoDB and PostgreSQL metrics (PromQL), Query Analytics (slowest queries, query details, ClickHouse SQL), alerts and PMM dashboards. It is read-only by default; a few write tools (silences, annotations) can be enabled explicitly, see Read-only or write?.
This is not an official Percona or Anthropic product.
✨ Features
Read-only by default: works with a Grafana Viewer token. Optional write tools (silences, annotations) are off unless
PMM_ALLOW_WRITE=1and always dry-run firstMetrics: instant and range PromQL queries plus label discovery
Query Analytics (QAN): top queries, per-service load, single-query details and distribution over time
Safe SQL: free-form
SELECTagainst QAN's ClickHouse, strictly validated and cappedTLS verified by default, with custom CA bundle support
Cross-platform: Linux, macOS and Windows, with one-command installers
Related MCP server: mcp-read-only-sql
🚀 Installation
Requirements
Python 3.11+ and
uvNetwork access to your PMM server (VPN if needed)
A PMM Grafana token: Administration → Service accounts → role Viewer → Add token
With uvx (no clone needed)
uvx pmm-mcpPut PMM_URL and PMM_TOKEN in the environment (or an env file, see Configuration). To register it with Claude Code:
claude mcp add pmm -- uvx --env-file ~/.config/mcp/pmm.env pmm-mcpLinux / macOS (installer)
git clone https://github.com/hakkiburakalks/pmm-mcp && cd pmm-mcp && ./install.shWindows (PowerShell installer)
git clone https://github.com/hakkiburakalks/pmm-mcp; cd pmm-mcp; powershell -ExecutionPolicy Bypass -File .\install.ps1The installer asks for your PMM URL and token, stores them in ~/.config/mcp/pmm.env (owner-only access) and registers the server with Claude Code under the name pmm. If claude is not installed, it prints the JSON snippet for Claude Desktop instead.
🎯 Quick Start
Claude Desktop / any MCP client
The server is a plain stdio MCP server. Run it with:
uv run --env-file /path/to/pmm.env --directory /path/to/pmm-mcp pmm-mcp(server.py still works as an alias for existing setups) and register that command in your client, for example in claude_desktop_config.json:
{
"mcpServers": {
"pmm": {
"command": "uv",
"args": [
"run", "--quiet",
"--env-file", "C:\\Users\\you\\.config\\mcp\\pmm.env",
"--directory", "C:\\path\\to\\pmm-mcp",
"server.py"
]
}
}
}Use the full path to uv as command if your client does not inherit your PATH.
On macOS the config file is ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"pmm": {
"command": "/opt/homebrew/bin/uv",
"args": [
"run", "--quiet",
"--env-file", "/Users/you/.config/mcp/pmm.env",
"--directory", "/Users/you/pmm-mcp",
"server.py"
]
}
}
}Desktop apps don't inherit your shell PATH, so give the full path to uv (check with which uv; typically /opt/homebrew/bin/uv on Apple Silicon, /usr/local/bin/uv on Intel, ~/.local/bin/uv expanded to an absolute path if installed via the curl script). install.sh prints this snippet for you.
Claude Code
claude mcp add pmm -- uv run --quiet --env-file ~/.config/mcp/pmm.env --directory /path/to/pmm-mcp server.py🔧 Configuration
Create ~/.config/mcp/pmm.env (the installers do this for you) with your own values; the ones below are fake:
PMM_URL=https://pmm.example.com
PMM_TOKEN=glsa_EXAMPLEexampleEXAMPLEexample1234567890_abcdef12
PMM_VERIFY=1
# PMM_CA_BUNDLE=/etc/ssl/certs/my-company-ca.pem
# PMM_ALLOW_WRITE=1 # off by default, see "Read-only or write?" belowSet these environment variables (see pmm.env.example for a commented template):
Variable | Required | Description |
| ✅ | PMM server URL |
| ✅ | Grafana service-account token. Viewer is enough for all read tools; the write tools need Editor or Admin |
| Default | |
| TLS verification, default | |
| Path to a custom CA bundle (preferred over disabling verification) | |
| HTTP timeout in seconds, default | |
| Grafana metrics datasource UID, only if it differs from PMM's default | |
| Grafana ClickHouse datasource UID, only if it differs from PMM's default |
🛠️ Available Tools
Inventory
Tool | Description |
| Monitored databases and their status |
| Identity and role behind the configured token |
Alerting
Tool | Description |
| Currently firing alerts, optionally filtered by label |
| Alert rules and their state |
| Active silences |
Query Analytics
Tool | Description |
| How much query time each database spends |
| Heaviest queries, filterable by service, database, node, user, client host or text |
| A single query's example and its distribution over time |
| Actual columns of |
| Free-form, validated |
Metrics
Tool | Description |
| Instant PromQL query |
| Range PromQL query (point and series caps) |
| Find metric names by substring |
| Help text and type of a metric |
| Discover labels and their values |
Dashboards and context
Tool | Description |
| Find PMM dashboards |
| The PromQL/SQL behind each dashboard panel |
| Deploy/maintenance markers to correlate with changes |
| PMM URL for QAN or a dashboard |
Read-only or write?
Read-only is the default and the recommended setup. With just PMM_URL and a Viewer PMM_TOKEN the model can look at metrics, queries, alerts and dashboards but cannot change anything. To let it silence an alert during maintenance or add a deploy marker, you need all three of: an Editor/Admin token, PMM_ALLOW_WRITE=1, and your approval of each call. Creating alert rules is not supported.
Write tools (opt-in)
Registered only when PMM_ALLOW_WRITE=1 and the token has Editor/Admin rights. Without the flag the model does not even see them.
Tool | Description |
| Silence alerts matching exact labels, max 72 h, comment required |
| Expire a silence |
| Add a deploy/maintenance marker |
Every write tool is a dry run by default: it returns exactly what it would do and changes nothing until it is called again with confirm=true. The tools are also annotated as non-read-only, so MCP clients ask for approval. The model is instructed to confirm with you first, so keep your client's per-tool approval on for these.
💬 Example Queries
Overview
"Which databases does PMM monitor, and are they all healthy?"
"Which service spends the most time running queries?"
Query Analytics
"Show the 10 slowest queries on the production MySQL service"
"Give me the details and time distribution of this query ID"
Metrics
"What is the connection count on
db-prod-1over the last 6 hours?""Compare InnoDB buffer pool hit ratio across all MySQL nodes"
🔒 Security
Use a Viewer token unless you need the write tools; by default the server never writes to PMM. Writes require
PMM_ALLOW_WRITE=1, an Editor/Admin token andconfirm=trueon each call.TLS certificates are verified by default.
pmm_qan_sqlaccepts only a single plainSELECT/WITH. Comments, quoted identifiers,SETTINGS/FORMAT/INTO, table functions (url,file,remote, ...) and system tables are rejected. Row counts and time windows are capped.Tool inputs (labels, service types, limits, time windows) are validated before being used in a query.
The token lives in
~/.config/mcp/pmm.env, created with owner-only permissions. Never commit it.
See SECURITY.md to report a vulnerability.
🐛 Troubleshooting
Symptom | What to check |
Server not listed in the client | Use the full path to |
| Token is invalid, expired, or not a Grafana service-account token |
TLS / certificate errors | Set |
Timeouts | Check VPN/network access, or raise |
Datasource not found | Set |
🔍 Debugging
Launch the server in the MCP Inspector:
npx @modelcontextprotocol/inspector uv run --env-file /path/to/pmm.env --directory /path/to/pmm-mcp server.py🧪 Development
uv sync --extra dev
uv run pytest📝 Notes
Tested against PMM 2 (Grafana 9.2) and PMM 3 (Grafana 12.4) with the default datasource UIDs, using Viewer and Admin tokens, and QAN on MySQL, PostgreSQL (
pg_stat_statements) and MongoDB (profiler). Not covered: alerts in firing state, ProxySQL/HAProxy.PMM's
/v1API rejects Viewer tokens (observed on PMM 2; PMM 3 was not checked for this), so everything goes through the Grafana datasource proxy.The same queryid can appear in several services; group by service when aggregating.
In MySQL QAN the
max_ms/p99fields are 0 (a perfschema limitation).
📄 License
MIT: free for anyone to use, modify and distribute, including commercially.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only access to a Lumin project's logs, metrics, uptime checks, alerts and infrastructure.
Read-only MCP access to sessions, funnels, campaigns, errors, live visitors, and anomalies.
Read-only access to your Infrly services, deploys, logs, metrics and billing.
Provides read access to your GKE and Kubernetes resources.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables read-only MySQL database access, allowing listing databases, tables, describing schemas, and executing SELECT/SHOW/DESCRIBE/EXPLAIN queries.730 npm4MIT
- AlicenseNot gradedqualityBmaintenanceProvides secure read-only SQL access to PostgreSQL and ClickHouse databases with built-in safety features like read-only enforcement, timeouts, and managed result files.241 PyPIMIT
- AlicenseNot gradedqualityCmaintenanceGives AI agents read-only access to any QuestDB instance, enabling schema discovery, time-series querying, and monitoring of partitions, WAL state, symbols, and ingestion health through MCP.Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables read-only interaction with a Databricks workspace, exposing catalog metadata and bounded SQL querying while preserving caller identity through OAuth-protected authorization.MIT