Grafana MCP Server

DevOpsstdiossev0.4.2
代码仓库

MCP server for Grafana's observability platform. Enables AI agents to query metrics from Prometheus, search and analyze logs from Loki, query traces, list and manage dashboards, and investigate incidents. Useful for debugging production issues, building monitoring dashboards, and performing root cause analysis with AI assistance across the full Grafana LGTM stack.

连接

将此配置添加到 .claude/mcp.json

传输方式:
{
  "mcpServers": {
    "grafana": {
      "command": "go",
      "args": [
        "run",
        "github.com/grafana/mcp-grafana@latest"
      ],
      "env": {
        "GRAFANA_URL": "<YOUR_GRAFANA_URL>",
        "GRAFANA_API_KEY": "<YOUR_GRAFANA_API_KEY>"
      }
    }
  }
}

工具 (4)

query_prometheus

Execute a PromQL query against Prometheus datasource.

{
  "type": "object",
  "required": [
    "expr"
  ],
  "properties": {
    "end": {
      "type": "string",
      "description": "End time (ISO 8601 or 'now')"
    },
    "expr": {
      "type": "string",
      "description": "PromQL expression to evaluate"
    },
    "step": {
      "type": "string",
      "description": "Query resolution step (e.g., '15s', '1m')"
    },
    "start": {
      "type": "string",
      "description": "Start time (ISO 8601 or relative like 'now-1h')"
    }
  }
}

query_loki

Execute a LogQL query against Loki datasource.

{
  "type": "object",
  "required": [
    "expr"
  ],
  "properties": {
    "end": {
      "type": "string",
      "description": "End time for the query range"
    },
    "expr": {
      "type": "string",
      "description": "LogQL expression to query logs"
    },
    "limit": {
      "type": "integer",
      "description": "Maximum number of log lines to return"
    },
    "start": {
      "type": "string",
      "description": "Start time for the query range"
    }
  }
}

list_dashboards

List all Grafana dashboards with optional search filter.

{
  "type": "object",
  "properties": {
    "tag": {
      "type": "string",
      "description": "Filter by dashboard tag"
    },
    "query": {
      "type": "string",
      "description": "Search query to filter dashboards"
    }
  }
}

list_alerts

List active and pending alert rules.

{
  "type": "object",
  "properties": {
    "state": {
      "enum": [
        "firing",
        "pending",
        "inactive"
      ],
      "type": "string",
      "description": "Filter alerts by state"
    }
  }
}

资源

此服务器未提供任何资源。

提示词

此服务器未提供任何提示词。

服务器信息

作者
Grafana Labs (@grafana)
代码仓库
https://github.com/grafana/mcp-grafana
许可证
Apache-2.0
版本
0.4.2
星标
2,100
最后更新
2026年5月26日