2. The MCP server #
Connecting Claude and other agents.
The principle #
Observa ships a Model Context Protocol server on POST /api/mcp (Streamable HTTP transport, JSON-RPC 2.0). An agent (Claude Code, Claude Desktop, or any MCP client) connects with an obs_… service account token and inherits exactly its rights.
Connecting an agent #
claude mcp add --transport http observa https://observa.example.com/api/mcp \
--header "Authorization: Bearer obs_xxxxxxxx"{
"mcpServers": {
"observa": {
"type": "http",
"url": "https://observa.example.com/api/mcp",
"headers": { "Authorization": "Bearer obs_xxxxxxxx" }
}
}
}Then, in natural language: “Which critical alerts are firing on checkout, and who is on call?”, “Show the checkout error rate over the last hour”.
Testing by hand #
OBS=https://observa.example.com; TOKEN=obs_xxxxxxxx
H=(-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream')
curl -s "${H[@]}" $OBS/api/mcp -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"1.0"}}}'
curl -s "${H[@]}" $OBS/api/mcp -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
curl -s "${H[@]}" $OBS/api/mcp -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"list_datasources","arguments":{}}}'Good to know : If theinitializeresponse contains anMcp-Session-Idheader, send it back on the following requests; responses may come as JSON or as an event stream (text/event-stream).
Security #
- One service account per agent, named, with the minimal role.
- A multi-tenant scope on that account if the agent must see only one customer.
- Regular review of the audit log (
mcp.tool) and revocation of unused tokens. - Never a token in a Git repository or a shared configuration file.
Watch out : An agent with an Editor token can silence alerts: a misunderstood prompt (or an injection in content read by the agent) would be enough to hide an outage. Keep that right for supervised uses.
Sources #
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
AI and SRE agents with ClickStack: AI Notebooks, MCP server, ClickHouse Agents and governance
Investigating with AI in ClickStack: AI Notebooks, the ClickStack MCP server for Claude Code, Cur...
Discovering Observa: the self-hosted observability console
What Observa is, what it adds to Grafana OSS, its five-service architecture, its parity with Graf...
Grafana Assistant: AI at the service of observability
Discover Grafana Assistant, Grafana's AI assistant (Cloud, OSS and Enterprise). Learn how this la...
Securing Observa: authentication, roles and multi-tenancy
Configure access to Observa: local accounts, LDAP and Active Directory, OIDC, SAML, auth proxy, r...
Connecting sources and collecting telemetry for Observa
Declare data sources in Observa (UI or provisioning), handle authentication, PKI, mTLS and proxy,...
Dashboards, Explore and Drilldown in Observa
Build Grafana v2 dashboards in Observa: visualizations, variables, transformations, import from g...
Alerting in Observa: rules, notifications, built-in alerts, SLA and Sigma
Write alert rules in Prometheus format, route notifications in Alertmanager format, enable the 1,...
SLOs, on-call and incidents in Observa
Define SLOs in Observa (error budget, burn rate, multi-window alerts), organize on-call and escal...
Observa best practices
Best practices to run Observa in production: deployment, security, sources, dashboards, alerting,...