BetaFree-to-use OpAMP fleet management for Windows & LinuxQuick Start →

Model Context Protocol (MCP) Server

The CollectorCtrl MCP Server exposes your OpenTelemetry fleet to AI assistants (such as Claude Desktop, Cursor, and custom LLM agents) over the open-standard Model Context Protocol. AI agents can query live fleet health, analyze telemetry cardinality, inspect packages, and safely propose configuration changes using natural language.

Read-First Security Architecture

Phase 1 MCP tools are strictly read-only by default. Every MCP request is authenticated via API tokens, authorized through existing CollectorCtrl RBAC permissions, and recorded to the immutable audit log with the actor attribute mcp:<username>.


1. Protocol Architecture & Endpoints

The MCP server is implemented natively in the Go backend (internal/collectorctrl/uisrv/mcp.go) and supports both Streamable HTTP and stdio transport modes:

AI Client (Claude Desktop / Cursor / Custom LLM)
      │
      │  MCP Protocol (JSON-RPC 2.0 over HTTPS POST or Stdio)
      ▼
CollectorCtrl Server (Port 4321)  ➔  https://<server>:4321/api/mcp
      │
      ├─ 1. Authentication: Bearer Token (SHA-256 hashed API token)
      ├─ 2. Authorization: Per-Tool RBAC Permission Check (requirePermission)
      ├─ 3. Rate Limiter: Per-Token Sliding Window (Read & Mutate budgets)
      ├─ 4. Guardrails: Blast-Radius Selector Cap & Two-Person Approval
      └─ 5. Audit Logging: Every call logged (actor: mcp:<username>)
            │
            ▼
CollectorCtrl Engine (Fleet State, Packages, Governor Analytics, OTel Sinks)

Protocol Specifications

PropertySpecification
EndpointPOST https://<server>:4321/api/mcp
ProtocolJSON-RPC 2.0 over HTTP POST
AuthenticationAuthorization: Bearer cc_<token> (API Token or Session JWT)
Audit Actormcp:<username> or mcp:token:<token_name>
Read Rate LimitDefault: 120 calls / hour per token
Mutate Rate LimitDefault: 20 calls / hour per token

2. API Token Setup & Role Scoping

Every MCP client authenticates with a CollectorCtrl API token. Tools automatically inherit the permissions granted to the token's role:

1

1. Open API Token Settings

In the CollectorCtrl web dashboard, navigate to Settings → SSO & Tokens → API Tokens.

2

2. Generate Scoped Token

Click Generate Token, provide a descriptive name (e.g., claude-desktop-sre), and select an appropriate role (e.g., Viewer for read-only access, or a custom role).

3

3. Save Token Securely

Copy the generated token string (cc_...). Tokens are stored as one-way SHA-256 hashes in the database and cannot be retrieved again after creation.


3. Comprehensive MCP Tools Reference

The tool surface is organized into three progressive security phases:

Phase 1: Read-Only Fleet Visibility (Active by Default)

Phase 1 tools are enabled out of the box and cannot alter system state:

Tool NameParametersScope & OutputRequired Permission
fleet_list_agentsstatus, environment, osLists connected collectors matching status filters (healthy, degraded, unhealthy).fleet:view
fleet_get_agentinstance_id (required)Full real-time metadata, effective config hash, uptime, and assigned policies for a node.fleet:view
fleet_get_sampleslimit (optional)Recent captured telemetry records across logs, metrics, and traces.fleet:view
fleet_list_packages—Available supervisor and collector binaries in the package repository with architecture flags.packages:view
fleet_get_build_status—Status of recent custom collector builds compiled with the integrated OCB builder.builder:view
governor_volume—Live telemetry ingestion rates, volume by service, and throughput analytics.governor:view
governor_cardinality—High-cardinality label and attribute breakdown across active pipelines.governor:view
governor_templates—Active Telemetry Governor pipeline templates, regex drop rules, and sampling policies.governor:view
governor_engine_status—Status summary of the Governor engine, ClickHouse/SQLite health, and tapped agent counts.governor:view
audit_querylimit (optional)Chronological system audit entries with actor attribution, action type, and duration.audit:view
discovery_reports—Service discovery inventory: running ports, services, and network endpoints detected per node.discovery:analyze
supervisors_list—Registered Supervisor agents, versions, host OS, and service daemon status.supervisors:view
instrumentation_list_apps—Applications detected by ZeroTouch auto-instrumentation (Java, .NET, Node.js, Python).discovery:analyze
instrumentation_get_version_policy—Central instrumentation baseline catalog and group version pinning rules.fleet:view
instrumentation_get_rollout_status—Canary rollout status and bytecode injection verification counters across the fleet.fleet:view

Telemetry optimization tools

Read-only, also available to the in-app Copilot. They run the same generator as the Telemetry Insights optimizer, scoped to the token's environment. Examples and patterns pass through secret redaction; a pattern that contained a secret is returned with redacted: true.

Tool NameScope & OutputRequired Permission
governor_top_patternsMost frequent log patterns (signal: logs) or span routes (signal: traces) in the received sample, with count, share, severity or error rate, a redacted example and a suggested_strategy. Counts are received records, not the full stream. Warnings, errors and unknown log severities are suggested normalize (keeps every record), never filter or sample; routes with errors are suggested tail_sampling.governor:view
governor_optimize_previewMeasured impact of a drop (filter), sample, tail_sampling or normalize rule on the newest 5,000 stored records in scope: matched, protected, removed and bytes. Describes only the analyzed samples; no monthly or production projection.governor:view
governor_optimize_configCollector processors YAML, OTTL statements, check results, tested compatibility and how to apply it (nothing is deployed).governor:view
governor_optimize_explain_checksPlain-language explanation of each check: what it verifies, its result and what it does not cover.governor:view

Phase 2: Configuration Validation & Safe Proposals

Phase 2 introduces safe validation and mutating actions behind a mandatory Human-in-the-Loop approval workflow. Enable on the server with:

COLLECTORCTRL_MCP_PHASE2=true
Tool NameParametersAction & Security BehaviorPermission Required
fleet_validate_ottlstatements (array)Validates OpenTelemetry Transformation Language (OTTL) syntax against strict AST grammar without changing configs.governor:view
fleet_preview_configsignal, conditionRuns a dry-run What-If simulation against captured telemetry samples and reports how many sampled records match and the share they make up.governor:view
fleet_push_configselector, config_yamlGenerates a pending proposal. Resolves blast radius (capped at 10 nodes by default). Returns a 15-minute action_id.fleet:configure
fleet_rollback_configselectorProposes rolling back targeted agents to their previous authorized policy version.fleet:control
governor_set_samplingrate, selectorProposes adjusting the sampling rate for matching collectors.fleet:configure
governor_toggle_tapinstance_id, enabledProposes enabling or disabling non-intrusive telemetry tapping on an agent node.governor:configure
fleet_confirm_actionaction_idExecutes an approved proposal. Enforces the Two-Person Rule (the proposer cannot confirm their own action).mcp:approve

Phase 3: Lifecycle Operations & Rollouts

Phase 3 introduces supervised process lifecycle operations, gated behind COLLECTORCTRL_MCP_PHASE3=true:

Tool NameScopePermission Required
fleet_restart_agent / fleet_restart_sidecarRestarts the managed collector or isolated sidecar process.fleet:control
fleet_start_agent / fleet_stop_agentSpawns or gracefully shuts down the managed collector process.fleet:control
fleet_canary_rolloutProposes percentage-based canary rings (e.g. 10%) with automated health gates.fleet:configure
fleet_upgrade_agentTriggers a collector binary upgrade governed by the 3-minute Upgrade Watchdog.fleet:control
supervisor_upgradeUpgrades the edge Supervisor daemon with automatic crash rollback.supervisors:control

4. Connecting Client Applications

A. Claude Desktop (Stdio Adapter)

Use the lightweight collectorctrl-mcp bridge CLI to connect Claude Desktop to your server:

1

1. Build or Download Bridge Binary

Compile the bridge adapter from source:

bash
# Linux / macOS
$go build -o collectorctrl-mcp ./cmd/collectorctrl-mcp
# Windows (PowerShell)
$go build -o collectorctrl-mcp.exe ./cmd/collectorctrl-mcp
2

2. Configure Claude Desktop

Add the server definition to your claude_desktop_config.json:

claude_desktop_config.json
1
2
3
4
5
6
7
8
9
10
11
{
"mcpServers": {
  "collectorctrl": {
    "command": "/usr/local/bin/collectorctrl-mcp",
    "args": [
      "--server-url", "https://your-collectorctrl-server:4321",
      "--api-token", "cc_your_api_token_here"
    ]
  }
}
}
3

3. Restart & Verify

Restart Claude Desktop. In the chat interface, look for the electrical plug icon showing collectorctrl connected, and type: "List my connected OpenTelemetry agents."


B. Cursor IDE Integration

Add CollectorCtrl as a project or global MCP server in Cursor:

  1. Navigate to Cursor Settings → Features → MCP.
  2. Click + Add New MCP Server.
  3. Set Type: command.
  4. Set Command: /path/to/collectorctrl-mcp --server-url https://your-server:4321 --api-token cc_your_token.

C. Direct JSON-RPC over HTTP

Any HTTP client can communicate directly with the /api/mcp endpoint:

List Available Tools
$curl -sk -X POST https://your-server:4321/api/mcp -H "Authorization: Bearer cc_your_token" -H "Content-Type: application/json" -d '{
$ "jsonrpc": "2.0",
$ "id": 1,
$ "method": "tools/list"
$}'
Call Tool: List Unhealthy Collectors
$curl -sk -X POST https://your-server:4321/api/mcp -H "Authorization: Bearer cc_your_token" -H "Content-Type: application/json" -d '{
$ "jsonrpc": "2.0",
$ "id": 2,
$ "method": "tools/call",
$ "params": {
$ "name": "fleet_list_agents",
$ "arguments": {
$ "status": "unhealthy",
$ "environment": "production"
$ }
$ }
$}'

5. Enterprise Guardrails & Approval Workflow

CollectorCtrl enforces strict protocol-level safeguards to guarantee that autonomous AI agents cannot compromise production telemetry:

[ AI Agent ] ➔ fleet_push_config(selector, YAML)
                    │
                    ▼
[ Server ] ➔ 1. Validates YAML & OTTL syntax
           ➔ 2. Calculates blast radius (enforces SelectorCap <= 10)
           ➔ 3. Stages proposal with 15-minute TTL
           ➔ 4. Generates action_id: "act-8f902b1c"
                    │
                    ▼
[ Web Dashboard ] ➔ Settings ➔ Pending AI Actions
                    Operator inspects visual diff & blast radius
                    │
                    ├─ Option A: Human clicks "Approve" (requires mcp:approve)
                    └─ Option B: Human clicks "Reject" (proposal purged)

Safety Rules

  1. Two-Person Security Rule: The human operator confirming an action must be distinct from the identity that created the proposal. A user cannot self-approve their own AI-generated changes.
  2. Blast Radius Limits: The server rejects proposals targeting more than SelectorCap nodes (default: 10) in a single operation, preventing catastrophic fleet-wide misconfigurations.
  3. Automatic Expiry: All pending action proposals expire automatically after 15 minutes if not approved.
  4. Auto-Approve Guard: Unattended auto-approval is disabled for all roles including administrators. Enabling requires both COLLECTORCTRL_MCP_AUTO_APPROVE=true and explicit assignment of the mcp:auto-approve RBAC permission.

6. Example Prompts for AI Assistants

Here are practical prompts you can use with Claude Desktop or Cursor once connected:

  • Incident Triaging: "Which collectors in the production cluster are currently degraded, and what are their error messages?"
  • Recurring Pattern Review: "Which log patterns occur most often in the checkout service's sample over the last 24 hours, and which of them look like noise worth reviewing?"
  • Compliance & Audit: "Show me the last 15 audit events. Were any configurations modified or collector binaries upgraded today?"
  • Dry-Run What-If Simulation: "Simulate dropping logs where severity is INFO and body contains 'healthcheck'. What share of the sampled records would it remove?"
  • Package Inspection: "List all available collector binary packages. Do we have an arm64 build for v0.108.0?"

7. Troubleshooting & Error Codes

JSON-RPC ErrorCauseRecommended Action
401 UnauthorizedMissing, malformed, or expired API token.Check the Authorization: Bearer cc_... header; regenerate token under Settings → API Tokens.
-32003 ForbiddenToken role lacks the permission required by the tool.Grant the required permission to the token's role (see table in §3).
-32601 Tool Not FoundRequested tool does not exist or requires Phase 2/3 flags.Run tools/list to inspect active tools. Set COLLECTORCTRL_MCP_PHASE2=true if using mutating tools.
-32602 Invalid ParamsMissing required parameter (e.g. missing instance_id).Check tool argument schema and provide all required parameters.
429 Too Many RequestsToken exceeded sliding-window rate limit budget.Wait for the rate limit window to refresh or adjust limits in MCP Settings.
Self-confirmation rejectedProposer attempted to confirm their own action.The approval must be confirmed by an independent operator holding mcp:approve.