What you will learn in this TP
- Create a service account and a Viewer token
- Discover and call MCP tools
- Connect an AI agent
- Trace calls in the audit and revoke the token
All steps and instructions are shown. Recommended for this lab: semi-guided
Introduction #
Context. The team wants to query Observa from an AI agent (“which alerts are firing?”) without giving it more rights than a reader.
Prerequisites: Docker Compose v2, curl, jq and a browser · Estimated time: 30 min
Setup #
Guided steps, with their solution.
1. Create a service account
Why? The agent inherits exactly the token's rights: the Viewer role is enough to analyse, without being able to change anything.
In administration, create theagent-tpservice account with the Viewer role, generate a token (obs_prefix) and keep it in an environment variable.2. Talk to the MCP server
Why? Seeing the JSON-RPC exchanges helps understand what an agent does, and diagnose a failing connection.
Initialize the session, list tools, calllist_datasources, then callquery_datasourcewith the arguments described bytools/list(upquery on the “Prometheus démo” source).3. Check the role
Why? A negative test proves least privilege really works.
Callsilence_alertwith this Viewer token: the call must be refused.4. Connect Claude Code
Why? An agent combines the tools on its own to answer a natural-language question.
Add the MCP server to Claude Code (or your MCP client), then ask: “Which data sources are configured, and which alerts are firing?”.5. Audit and revoke
Why? Every tool call is logged: you know what an agent looked at, and an unneeded token gets revoked.
Open the audit log and filter onmcp.tool. Optionally, enable the AI assistant (variables below) and use Analyse with AI on a panel. Finally revoke the token and remove the server from Claude Code.
Validate your work
Check that each goal above is reached and that you get the result described in the introduction.
Difficulty level : ●●●○○ (3/5)
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
Observa's AI assistant and MCP server
Configure Observa's AI assistant (Claude, OpenAI, Azure OpenAI or local model), use it to analyse...
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...
Data sources in Grafana: connect and unify your data
Learn how to extend Grafana's capabilities with data sources. Discover essential plugins such as ...
Securing Observa: authentication, roles and multi-tenancy
Configure access to Observa: local accounts, LDAP and Active Directory, OIDC, SAML, auth proxy, r...
Costs, usage and Private Data Source Connect in Grafana Cloud
Costs, usage and Private Data Source Connect in Grafana Cloud: billing units, free tier, usage tr...
Grafana Assistant: AI at the service of observability
Discover Grafana Assistant, Grafana's AI assistant (Cloud, OSS and Enterprise). Learn how this la...
Automating Grafana: HTTP API, Terraform and dashboard lifecycle
Industrializing Grafana: HTTP API (folders, dashboards, users, data sources), Terraform provider,...
Visualizing and automating Zabbix: dashboards, Grafana and API
Build dashboards and maps in Zabbix, use Grafana's Zabbix plugin, and automate configuration with...
Advanced OpenSearch security: authentication, roles and audit
Securing OpenSearch in depth: transport and API TLS, internal, LDAP, OpenID Connect and SAML auth...