Skip to content
← All guides

Is the Grafana MCP server safe? What it can reach

The Grafana MCP server uses a service account token. See its write tools, the read-only flag and how to limit it in Claude Code and Codex.

4 min read

The Grafana MCP server, mcp-grafana, lives in Grafana’s own GitHub organization. It authenticates with a Grafana service account token, so the agent can do whatever that account’s role allows. Its README suggests the built-in Editor role as a simple option and says that role grants broad read and write access. The safer setup is a service account with only the roles you need, plus the --disable-write flag, which the README describes as read-only mode. Grafana holds queries, logs, alert rules and on-call data, so decide what the agent may touch before you start it.

How it connects

You set GRAFANA_URL and GRAFANA_SERVICE_ACCOUNT_TOKEN. The README requires Grafana 9.0 or later. The default transport is stdio. With sse or streamable-http, it listens on localhost:8000 by default and serves /mcp. In those modes a missing caller token produces a logged security error, and the README says a future major release will refuse to start. It recommends setting MCP_GRAFANA_SERVER_TOKEN. You can also point GRAFANA_SERVICE_ACCOUNT_TOKEN_FILE at a file, which is re-read on every request.

What the tools can do

The README groups its tools by category.

GroupExamples
Read and querysearch_dashboards, query_prometheus, query_loki_logs, search_tempo_traces, query_pyroscope, get_annotations
Writeupdate_dashboard, create_folder, create_datasource, update_datasource, create_incident, update_incident, alerting_rules_write, alerting_routing_write, alerting_silences_write, update_alert_group, create_annotation, delete_annotation, create_snapshot, delete_snapshot, install_plugin
Catch-allgrafana_api_request

The README doesn’t label every write tool, so the write list above comes from tool names and its notes. grafana_api_request is a general API call, and the README doesn’t say what it can write. Several categories are off by default, including admin, notebook, SQL, CloudWatch and Assistant. You turn them on with --enabled-tools.

Flags that limit it

FlagEffect
--disable-writedisables create and update tools, read-only mode
--disable-querydisables tools that execute a query, keeps metadata tools
--disable-<category>for example --disable-oncall
--enable-write-toolskeeps named tools under --disable-write
--configa YAML file that selects tools

Read-only mode also removes the raw SQL tools query_sql and query_influxdb, because they can write when the datasource credentials permit it. The README adds that other enabled tools can bypass its Prometheus and Loki query matchers, so also disable grafana_api_request, rendering and Assistant tools if you rely on those restrictions. Anonymous usage stats are on by default. Opt out with --usage-stats=disabled or DO_NOT_TRACK=1.

The risks

Logs and dashboards contain text from your services and users, and that text can carry instructions. Queries can return secrets that were logged by accident. The result goes to your model provider. A write-capable token also lets an injected instruction edit dashboards, silence alerts or change incidents.

Limit it in Claude Code

Rules take the form mcp__<server>__<tool>. Here the server was added as grafana.

{
  "permissions": {
    "deny": [
      "mcp__grafana__update_dashboard",
      "mcp__grafana__alerting_silences_write",
      "mcp__grafana__grafana_api_request"
    ]
  }
}

Add the server with claude mcp add --env GRAFANA_URL=... --env GRAFANA_SERVICE_ACCOUNT_TOKEN=... grafana -- uvx mcp-grafana --disable-write, the uvx form the README shows. Keep the scope at local or user. Project scope writes .mcp.json into the repository, which you shouldn’t fill with a token.

Limit it in Codex

[mcp_servers.grafana]
command = "uvx"
args = ["mcp-grafana", "--disable-write"]
env_vars = ["GRAFANA_URL", "GRAFANA_SERVICE_ACCOUNT_TOKEN"]
disabled_tools = ["grafana_api_request"]

env_vars forwards variables from your shell, which keeps the token out of the file.

Checklist

  • Create a service account with the smallest role that works.
  • Run with --disable-write first.
  • Disable grafana_api_request.
  • Leave the off-by-default categories off.
  • Rotate the token when you finish.

Checked against the vendor documentation on November 25, 2026. mcp-grafana · Claude Code MCP · Claude Code permissions · Codex MCP

What Excellent covers

Excellent doesn’t inspect MCP servers themselves, so it can’t tell you what a server exposes. Its free scan reads supported logs on the Mac and reports findings for review. It reads the session logs of Claude Code, Codex, Grok Build, GitHub Copilot CLI, Gemini CLI and Qwen Code, which shows what an agent did after it used a server. For a local report without installing an app, run the free scan. Its script uses Python 3.9 or later when your Mac has it and the shell when it doesn’t, reads the logs locally and makes no network requests. See a sample report.

Excellent Pro adds checks before supported actions. Claude Code can display an ask prompt. With Codex, an Excellent “ask” refuses the action and tells the agent to ask you. Commands sent into an already running Codex shell fall outside that check. Agent coverage · Pricing. Pro is US-only for now.

Related guides

View all