RousselTMLEARNING

TP · Observa: from discovery to expertise

Lab: Connect an AI agent through the MCP server

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
Mode :

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

Use the Lab 1 stack. Claude Code is optional: any MCP client works, and the JSON-RPC steps use curl.

Setup #

Guided steps, with their solution.

  1. 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 the agent-tp service account with the Viewer role, generate a token (obs_ prefix) and keep it in an environment variable.
  2. 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, call list_datasources, then call query_datasource with the arguments described by tools/list (up query on the “Prometheus démo” source).
  3. 3. Check the role

    Why? A negative test proves least privilege really works.

    Call silence_alert with this Viewer token: the call must be refused.
  4. 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. 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 on mcp.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

  • ⏱ Estimated time : ≈ 30 min

Sign in to track your progress and take notes. Sign in

⭐ Rate this lesson

5.0 initial rating from the teaching team

Sign in to rate this lesson →

💬 Questions about this lesson

No questions yet: be the first to ask for help or share your configuration.

Ask a question about this lesson →

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...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!