Skip to main content

Grafana OnCall MCP server — query and manage OnCall schedules, shifts, teams, users, and alert groups via the Model Context Protocol

Project description

grafana-oncall-mcp

A dedicated Grafana OnCall MCP (Model Context Protocol) server written in Go.

Overview

The upstream mcp-grafana project targets Grafana Cloud and no longer supports grafana-oncall-app, which is archived and deprecated upstream. This MCP server exists to maintain compatibility for self-hosted Grafana OnCall instances that still run grafana-oncall-app or its rebranded successor grafana-irm-app. If you are using Grafana Cloud, use the official mcp-grafana from Grafana instead.

Quick Start (Recommended: uvx)

The fastest way to use this server is via uvx, which downloads a small Python wrapper plus the pre-compiled Go binary from PyPI on first invocation (~50MB total) and caches them. Requires uv.

# Install uv if you don't have it yet
curl -LsSf https://astral.sh/uv/install.sh | sh

# Smoke test
uvx --from grafana-oncall-mcp grafana-oncall-mcp -version
# grafana-oncall-mcp 0.1.0

Prerequisites

  • For uvx: uv (Python package manager; handles the Python wrapper + Go binary).
  • For Docker: a working Docker daemon.
  • For source builds: Go 1.26.x.
  • Access to a self-hosted Grafana instance with at least one supported OnCall plugin installed:
    • grafana-oncall-app (legacy, archived upstream) or
    • grafana-irm-app (rebranded successor)
  • Grafana service account token with OnCall permissions.
  • MCP client capable of stdio, SSE, or Streamable HTTP.

Configuration

Use direct OnCall API mode to call the OnCall Application API directly, bypassing the Grafana plugin resource proxy. This is the recommended mode for self-hosted instances.

export GRAFANA_ONCALL_API_URL="https://oncall-prod-us-central-0.grafana.net/oncall"
export GRAFANA_ONCALL_API_KEY="oncall_user_scoped_key"

Get these values from OnCall -> Settings:

  • GRAFANA_ONCALL_API_URL: the OnCall Application endpoint
  • GRAFANA_ONCALL_API_KEY: the user-scoped API key

Alternatively, set the Grafana endpoint and service account token:

export GRAFANA_URL="https://example.grafana.net"
export GRAFANA_SERVICE_ACCOUNT_TOKEN="glsa_..."

GRAFANA_API_KEY may be used instead of GRAFANA_SERVICE_ACCOUNT_TOKEN for compatibility with upstream mcp-grafana configuration conventions.

Optional settings:

# Default is oncall-app; accepted values: oncall-app | irm | unset
export GRAFANA_ONCALL_PLUGIN_PREFERENCE="oncall-app"

export GRAFANA_ONCALL_READ_ONLY=true
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318"

Build

go mod download
go build -o grafana-oncall-mcp ./cmd/oncall-mcp

Speckit setup (contributors)

This project uses Spec Kit for spec-driven development. Spec Kit manages the feature spec, plan, research, tasks, and contract artifacts under specs/.

  1. Install the Specify CLI (requires uv and Python 3.11+):

    uv tool install specify-cli --from git+https://github.com/github/spec-kit.git@v0.10.0
    
  2. Initialize Spec Kit in the project root (this project is already initialized; run only if cloning fresh):

    specify init . --force --integration copilot
    

    This creates .specify/memory/constitution.md (gitignored) and registers the Spec Kit slash-commands (/speckit.constitution, /speckit.specify, /speckit.plan, /speckit.tasks, /speckit.implement) in your AI coding agent.

  3. For each new feature, run the SDD pipeline from a feature spec:

    /speckit.specify <feature description>
    /speckit.plan <tech stack and architecture choices>
    /speckit.tasks
    

    The generated artifacts (plan.md, research.md, data-model.md, contracts/, tasks.md) are committed alongside the spec in specs/<feature-number>-<name>/.

Run

Stdio (default)

./grafana-oncall-mcp -transport=stdio

SSE

./grafana-oncall-mcp -transport=sse -address=:8000

Connect the MCP client to:

http://localhost:8000/sse

Streamable HTTP

./grafana-oncall-mcp -transport=streamable-http -address=:8000

Connect the MCP client to:

http://localhost:8000/mcp

Tools

Read tools:

  • list_oncall_schedules
  • get_oncall_shift
  • get_current_oncall_users
  • list_oncall_teams
  • list_oncall_users
  • list_alert_groups
  • get_alert_group

Write tools (omitted in read-only mode):

  • acknowledge_alert_group
  • resolve_alert_group
  • silence_alert_group
  • unresolve_alert_group

RBAC Notes

The token must have permission to:

  • Read OnCall schedules, shifts, teams, users, and alert groups
  • Write (acknowledge / resolve / silence / unresolve) alert groups

Service account tokens are preferred over API keys. Use read-only mode (GRAFANA_ONCALL_READ_ONLY=true) in environments where the agent must never mutate state.

Running with Docker

A multi-profile docker-compose.yml is provided at the repo root. It supports three transports (stdio / SSE / streamable-HTTP) and reads the same .env file the binary would read directly.

# One-time setup
cp env.example .env
$EDITOR .env                                # fill in GRAFANA_URL + token
docker compose build mcp-stdio              # build the image once

# One-shot stdio (the default profile) — use this from an MCP client:
docker compose run --rm mcp-stdio

# Or run a long-lived HTTP server in the background:
docker compose --profile http up -d
docker compose --profile http logs -f       # check the dual-plugin probe

# Stop the HTTP server
docker compose --profile http down

Coding Agent Setup

The server works with any MCP-aware client (opencode, VS Code Copilot Chat, Claude Desktop, Cursor, Windsurf, etc.). All clients need the same environment variables. The examples below use the recommended direct OnCall API mode (GRAFANA_ONCALL_API_URL + GRAFANA_ONCALL_API_KEY) with GRAFANA_ONCALL_PLUGIN_PREFERENCE="oncall-app" as the default.

Set the env vars in your shell before launching the client:

export GRAFANA_ONCALL_API_URL="https://oncall-<region>.grafana.net/oncall"
export GRAFANA_ONCALL_API_KEY="<OnCall user-scoped API key>"
export GRAFANA_ONCALL_PLUGIN_PREFERENCE="oncall-app"

opencode

Add a server entry to your opencode.json (user-scoped at ~/.config/opencode/opencode.json, or project-scoped at ./opencode.json):

Using uvx (recommended):

{
  "mcp": {
    "grafana-oncall": {
      "type": "local",
      "command": ["uvx", "grafana-oncall-mcp", "-transport=stdio"],
      "environment": {
        "GRAFANA_ONCALL_API_URL": "{{env.GRAFANA_ONCALL_API_URL}}",
        "GRAFANA_ONCALL_API_KEY": "{{env.GRAFANA_ONCALL_API_KEY}}",
        "GRAFANA_ONCALL_PLUGIN_PREFERENCE": "oncall-app"
      },
      "enabled": true
    }
  }
}

Using Docker:

{
  "mcp": {
    "grafana-oncall": {
      "type": "local",
      "command": ["docker", "compose", "-f", "<repo-path>/docker-compose.yml", "--project-directory", "<repo-path>", "run", "--rm", "--no-deps", "--profile", "stdio", "mcp-stdio"],
      "environment": {
        "GRAFANA_ONCALL_API_URL": "{{env.GRAFANA_ONCALL_API_URL}}",
        "GRAFANA_ONCALL_API_KEY": "{{env.GRAFANA_ONCALL_API_KEY}}",
        "GRAFANA_ONCALL_PLUGIN_PREFERENCE": "oncall-app"
      },
      "enabled": true
    }
  }
}

Replace <repo-path> with the absolute path to this repository.

VS Code (GitHub Copilot Chat)

Add to .vscode/mcp.json (workspace-scoped) or VS Code settings.json:

Using uvx (recommended):

{
  "servers": {
    "grafana-oncall": {
      "type": "stdio",
      "command": "uvx",
      "args": ["grafana-oncall-mcp", "-transport=stdio"],
      "env": {
        "GRAFANA_ONCALL_API_URL": "${input:grafanaOncallApiUrl}",
        "GRAFANA_ONCALL_API_KEY": "${input:grafanaOncallApiKey}",
        "GRAFANA_ONCALL_PLUGIN_PREFERENCE": "oncall-app"
      }
    }
  },
  "inputs": [
    {
      "id": "grafanaOncallApiUrl",
      "type": "promptString",
      "description": "OnCall Application endpoint URL",
      "default": "https://oncall-prod-us-central-0.grafana.net/oncall"
    },
    {
      "id": "grafanaOncallApiKey",
      "type": "promptString",
      "description": "OnCall user-scoped API key",
      "password": true
    }
  ]
}

Restart the Copilot Chat session after editing: Command Palette > "Copilot: Restart Chat Session".

Claude Desktop

Add to ~/.claude/claude_desktop_config.json (user-scoped):

Using uvx (recommended):

{
  "mcpServers": {
    "grafana-oncall": {
      "command": "uvx",
      "args": ["grafana-oncall-mcp", "-transport=stdio"],
      "env": {
        "GRAFANA_ONCALL_API_URL": "${GRAFANA_ONCALL_API_URL}",
        "GRAFANA_ONCALL_API_KEY": "${GRAFANA_ONCALL_API_KEY}",
        "GRAFANA_ONCALL_PLUGIN_PREFERENCE": "oncall-app"
      }
    }
  }
}

Using Docker:

{
  "mcpServers": {
    "grafana-oncall": {
      "command": "docker",
      "args": [
        "compose",
        "-f", "<repo-path>/docker-compose.yml",
        "--project-directory", "<repo-path>",
        "run", "--rm", "--no-deps", "--profile", "stdio", "mcp-stdio"
      ],
      "env": {
        "GRAFANA_ONCALL_API_URL": "${GRAFANA_ONCALL_API_URL}",
        "GRAFANA_ONCALL_API_KEY": "${GRAFANA_ONCALL_API_KEY}",
        "GRAFANA_ONCALL_PLUGIN_PREFERENCE": "oncall-app"
      }
    }
  }
}

Restart Claude Desktop after editing the config.

Verifying the connection

After configuring your client, ask the agent:

"List the OnCall teams in my Grafana."

A successful response from list_oncall_teams confirms the connection is healthy.

Release Process (for maintainers)

This repo ships a single Go source tree, but produces two distribution channels from one source:

  1. GitHub Releases (.tar.gz / .zip) — built by GoReleaser from .goreleaser.yaml on every v* tag push.
  2. PyPI (uvx grafana-oncall-mcp) — built by go-to-wheel which bundles the Go binary into a Python wrapper. Eight platform-specific wheels (linux/darwin/windows × amd64/arm64) are produced and uploaded via OIDC trusted publishing.

The CI wiring lives in .github/workflows/release.yml. The two jobs (goreleaser then pypi) run sequentially on every v* tag push.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

grafana_oncall_mcp-0.1.2-py3-none-win_arm64.whl (12.4 MB view details)

Uploaded Python 3Windows ARM64

grafana_oncall_mcp-0.1.2-py3-none-win_amd64.whl (13.5 MB view details)

Uploaded Python 3Windows x86-64

grafana_oncall_mcp-0.1.2-py3-none-musllinux_1_2_x86_64.whl (13.2 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

grafana_oncall_mcp-0.1.2-py3-none-musllinux_1_2_aarch64.whl (12.3 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

grafana_oncall_mcp-0.1.2-py3-none-manylinux_2_17_x86_64.whl (13.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

grafana_oncall_mcp-0.1.2-py3-none-manylinux_2_17_aarch64.whl (12.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

grafana_oncall_mcp-0.1.2-py3-none-macosx_11_0_arm64.whl (12.8 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

grafana_oncall_mcp-0.1.2-py3-none-macosx_10_9_x86_64.whl (13.7 MB view details)

Uploaded Python 3macOS 10.9+ x86-64

File details

Details for the file grafana_oncall_mcp-0.1.2-py3-none-win_arm64.whl.

File metadata

File hashes

Hashes for grafana_oncall_mcp-0.1.2-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 491018ed51b2071242aa40034eb1806b4281ed915a1168ccc3f5f85772ea7a25
MD5 9bdfe515bfcdf5645c03009791b37409
BLAKE2b-256 f3a7d296e6b09504eb0fa93dbedd0e7d72b70b26333198bc93f21ecbe03dd32d

See more details on using hashes here.

Provenance

The following attestation bundles were made for grafana_oncall_mcp-0.1.2-py3-none-win_arm64.whl:

Publisher: release.yml on bangnh1/grafana-oncall-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file grafana_oncall_mcp-0.1.2-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for grafana_oncall_mcp-0.1.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 f0cc5cb449681eb27016878070ed90525c7aa289e86a6fccbd0daf89f39ddb22
MD5 ddc84b010b781fea0feac8d07011b6e4
BLAKE2b-256 2a24e6542808fc7048763da2dbeb9b2db0358090077eea3cacc804950f2238b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for grafana_oncall_mcp-0.1.2-py3-none-win_amd64.whl:

Publisher: release.yml on bangnh1/grafana-oncall-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file grafana_oncall_mcp-0.1.2-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for grafana_oncall_mcp-0.1.2-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 cd459dde69246f2b5cb6042d2a685d29af46076d4ff34f8f7ec4a7fe25bc7f96
MD5 5b307a46795889885f7927de51422c55
BLAKE2b-256 fbc47942fff49c0ff6204fbd3518ad1ad6cf386603d576a56f9b118fce19af52

See more details on using hashes here.

Provenance

The following attestation bundles were made for grafana_oncall_mcp-0.1.2-py3-none-musllinux_1_2_x86_64.whl:

Publisher: release.yml on bangnh1/grafana-oncall-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file grafana_oncall_mcp-0.1.2-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for grafana_oncall_mcp-0.1.2-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 f1c6f0813152e706ad346bf1a13c410941c648b0c5470bfc45485a6417f07312
MD5 3f7479ab67bf8ffbd7da047275592bfc
BLAKE2b-256 e50f5e2f8c5a5b6317b7d5e02c7ce5c4e2fb4d8f0752614cdab2d8c64bb7d439

See more details on using hashes here.

Provenance

The following attestation bundles were made for grafana_oncall_mcp-0.1.2-py3-none-musllinux_1_2_aarch64.whl:

Publisher: release.yml on bangnh1/grafana-oncall-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file grafana_oncall_mcp-0.1.2-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for grafana_oncall_mcp-0.1.2-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 d1f913190c867e2fdd5b46b8337d4d6335d64768db04a593acd6e1555f838af4
MD5 9ec00d79f9852855695fec6313d3975a
BLAKE2b-256 880f323f921d9cd7577c253bd8dcb231bcea3f68c2ef770db20918636390f7a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for grafana_oncall_mcp-0.1.2-py3-none-manylinux_2_17_x86_64.whl:

Publisher: release.yml on bangnh1/grafana-oncall-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file grafana_oncall_mcp-0.1.2-py3-none-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for grafana_oncall_mcp-0.1.2-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 3b1fec289fd6a333563a5c9b325c5c2ae6b86565a890c8632f24e3f597e03c4f
MD5 58391e33f9d6cec50a86e8a3c03bfc60
BLAKE2b-256 8cfadc48ea367cf523cb54c4f54b769740a8eee7b9bef35910c42fb636e1e67e

See more details on using hashes here.

Provenance

The following attestation bundles were made for grafana_oncall_mcp-0.1.2-py3-none-manylinux_2_17_aarch64.whl:

Publisher: release.yml on bangnh1/grafana-oncall-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file grafana_oncall_mcp-0.1.2-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for grafana_oncall_mcp-0.1.2-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9c04b70493ef693ddbcb271d0edb54b32aad1cdb30f9994890475858ab398550
MD5 109c69184b8d56687d85efe03c59615b
BLAKE2b-256 45d44209817fc29662195ad9251c0574ebc9a4c27f7e9091826f42357f9525c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for grafana_oncall_mcp-0.1.2-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on bangnh1/grafana-oncall-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file grafana_oncall_mcp-0.1.2-py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for grafana_oncall_mcp-0.1.2-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a150a514cbdf4f7d7faa0eecc5f7645b160e4261eee27b8683553a075fe6c3fe
MD5 3176a0e661b519c049cc66ceb3d01a43
BLAKE2b-256 7d8eba3b33300470c50704d53b92cc623ab0a9489c844de6c80e9fa6f518e19b

See more details on using hashes here.

Provenance

The following attestation bundles were made for grafana_oncall_mcp-0.1.2-py3-none-macosx_10_9_x86_64.whl:

Publisher: release.yml on bangnh1/grafana-oncall-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page