The Grafana Cloud MCP
server
connects ADK agents directly to your Grafana Cloud observability stack. Your
agent can query Prometheus metrics, search logs in Loki, trace requests with
Tempo, browse dashboards, manage alerts and incidents, and more, with over 60
tools available.
The server is fully hosted and requires no local installation, Docker
containers, or service account tokens. Authentication uses OAuth 2.1 with user-scoped
permissions through Grafana RBAC.
Investigate incidents: Query metrics, logs, and traces to diagnose
production issues. Correlate Prometheus alerts with Loki log patterns and
Tempo traces in a single conversation.
Manage dashboards: Search, inspect, and update Grafana dashboards
programmatically. Extract panel queries, generate deep links, and render
panels as images.
Monitor infrastructure: List data sources, discover available metrics,
explore label values, and build PromQL or LogQL queries interactively.
Respond to alerts: View firing alert rules, check on-call schedules,
create or update incidents, and add activity notes to incident timelines.
fromgoogle.adk.agentsimportAgentfromgoogle.adk.tools.mcp_toolimportMcpToolsetfromgoogle.adk.tools.mcp_tool.mcp_session_managerimportStreamableHTTPConnectionParamsGRAFANA_URL="https://<your-stack>.grafana.net"root_agent=Agent(model="gemini-flash-latest",name="observability_agent",instruction="Help users investigate issues using Grafana Cloud observability data",tools=[McpToolset(connection_params=StreamableHTTPConnectionParams(url="https://mcp.grafana.com/mcp",headers={"X-Grafana-URL":GRAFANA_URL,},),)],)
import{LlmAgent,MCPToolset}from"@google/adk";constGRAFANA_URL="https://<your-stack>.grafana.net";constrootAgent=newLlmAgent({model:"gemini-flash-latest",name:"observability_agent",instruction:"Help users investigate issues using Grafana Cloud observability data",tools:[newMCPToolset({type:"StreamableHTTPConnectionParams",url:"https://mcp.grafana.com/mcp",transportOptions:{requestInit:{headers:{"X-Grafana-URL":GRAFANA_URL,},},},}),],});export{rootAgent};
Replace <your-stack> with your Grafana Cloud stack name. The X-Grafana-URL
header is optional but recommended because it skips the URL entry step during OAuth
authorization and redirects directly to the consent page.
Note
When the agent first connects, you'll be prompted to authorize the
connection in your browser. Your OAuth token is valid for 1 hour and
refreshes automatically for 30 days.
For self-hosted Grafana instances, use the open source Grafana MCP
server instead. It runs locally and
connects to any Grafana instance using a service account token.