Documentation

AI

Monocle MCP

Let Claude Code, Cursor, and other AI assistants query your production telemetry

Monocle supports the Model Context Protocol (MCP), enabling AI assistants like Claude Code, Cursor, and others to interact directly with your observability data. Let your AI tools help you debug issues, analyze traces, and explore your application's telemetry.

This server reads the data stored in Monocle cloud. For telemetry from your local development environment, use the Studio MCP server that ships with Monocle Studio.

Authentication

Monocle uses OAuth 2.1 to authenticate MCP connections. Your MCP client handles the full authorization flow — you just approve access in your browser.

OAuth users are not tied to a single application. You can navigate between organizations, applications, and environments using the list_apps and list_environments tools.

Getting Started

Terminal
npx add-mcp https://api.monocle.sh/mcp

This works with any MCP client that supports OAuth (Claude Code, Claude Desktop, Cursor, etc.).

Start Asking Questions

Once connected, you can ask your AI assistant questions about your application:

  • "What exceptions occurred in the last hour?"
  • "Show me the slowest API endpoints"
  • "Find traces with errors from the checkout service"
  • "What's the P95 latency for the /api/users endpoint?"

Available Tools

Your AI assistant has access to the following tools:

ToolDescription
whoamiGet current authentication context (org, app, environment)
list_appsList applications in your organization
list_environmentsList available environments for your application

Setup

ToolDescription
setup_serviceCreate a service (or reuse the one with the same name) and get its DSN with install steps, so your agent can instrument a repository

Traces

ToolDescription
list_tracesList distributed traces with filters (time range, status, service, search)
get_traceGet all spans for a specific trace by ID

Logs

ToolDescription
list_logsList application logs with filtering (severity, service, time range, trace ID)
search_logsFull-text search across log messages

Exceptions

ToolDescription
list_exceptionsList exception groups with occurrence counts and affected users
get_exceptionGet detailed info about an exception group (stacktrace, timeline, affected routes)
list_occurrencesList the occurrences of an exception group, with their trace ID, timestamp, user, and route
archive_exceptionArchive an exception group to hide it from the default list (duration: 1h, 1d, 1w, 30d, or forever)
create_issueCreate an issue to track one or more exceptions with priority and assignees
update_issueUpdate an issue's status (open, resolved, ignored), priority, or assignees

Uptime and status incidents

Monocle separates the outages it detects from the status incidents your team declares. An outage is a period when a monitor failed. A status incident is what your status page shows.

ToolDescription
list_monitorsList the uptime monitors of the environment, with their status, uptime, and median latency over the last 24 hours
get_monitorGet a monitor with its statistics over 24 hours, 7 days, or 30 days, its 10 latest outages, and its 10 latest isolated failed checks
get_checkInspect one check: its HTTP response, its health report, the checks around it, its outage, and its trace ID
list_outagesList detected outages, ongoing or recent, with the incidents they are linked to. Filter by monitor, by age (up to 90 days), or on outages not declared yet
get_outageGet an outage, with its failed checks grouped by reason
list_status_incidentsList declared status incidents, newest first. Resolved and cancelled incidents are left out by default.
get_status_incidentGet a status incident with its updates, the affected monitors, and the linked outages
declare_status_incidentDeclare a status incident from one or more outages, with a title, a message, and whether it is public
post_status_incident_updatePost an update to a status incident and set its status: investigating, identified, monitoring, or resolved

A public incident publishes its title and messages on your status page. post_status_incident_update doesn't manage scheduled maintenance.

Deployments

ToolDescription
list_deploymentsList the deployments of the environment, filtered by service, source, or version
get_deploymentGet a deployment with its timeline, the previous deployment, and the versions observed around it

Metrics

ToolDescription
list_instancesList service instances (pods/replicas) reporting metrics
list_metricsDiscover all available metrics (gauges, sums, histograms, summaries) with their types and units
get_metricQuery time-series data for any metric with aggregation (avg, sum, min, max, p50–p99), filtering, and grouping
get_metric_attributesDiscover attribute keys and values for a metric to use as filters or groupBy in get_metric

Endpoints

ToolDescription
list_endpointsList HTTP endpoint patterns with request count, avg/p95 duration, and error rate. Supports sorting, search, and method filtering
get_endpoint_statsGet detailed stats for a specific endpoint: latency percentiles, error rates, throughput, and time-series data

Database Queries

ToolDescription
list_db_queriesList database query patterns with execution count, avg/p95/max duration, error count, and slow query detection
get_db_query_detailGet details for a specific query pattern: recent executions with trace IDs and related HTTP routes

Background Jobs

ToolDescription
list_jobsList background job executions with published/processed counts, error rate, and avg/p95 processing time
get_job_detailGet details for a specific job: recent executions with duration, queue time, status, and error messages

Cache

ToolDescription
list_cache_statsList cache keys with hit/miss rates, operation counts, and avg/p95 latency
get_cache_key_detailGet detailed metrics for a specific cache key: hit/miss time series, duration, and operation breakdown

External Calls

ToolDescription
list_external_callsList third-party API domains with request count, avg/p95 latency, error rate, and status code breakdown
get_external_call_detailGet details for a specific domain: URL patterns, recent requests with trace IDs, and performance metrics

Custom Dashboards

Build and manage custom dashboards with metric widgets directly from your AI assistant. Dashboards use a 12-column grid layout.

ToolDescription
list_dashboardsList all custom dashboards with widget counts
get_dashboardGet a dashboard with all its widgets (data sources, display config, layout)
create_dashboardCreate a new empty dashboard
update_dashboardUpdate a dashboard's name, description, or icon
delete_dashboardPermanently delete a dashboard and all its widgets
add_widgetAdd a widget to a dashboard (chart, stat, table, sparkline, pie, or bar-gauge)
update_widgetUpdate a widget's metric, aggregation, display, or layout
remove_widgetRemove a widget from a dashboard

Write access

Tools that create or change data need the mcp:write or mcp:full scope, and manager access to the project. Without one of these scopes, your client doesn't see them. The write tools are:

  • setup_service
  • archive_exception, create_issue, and update_issue
  • declare_status_incident and post_status_incident_update
  • create_dashboard, update_dashboard, delete_dashboard, add_widget, update_widget, and remove_widget

Example Queries

  • What exceptions occurred in the last hour?
  • What's the P95 latency for POST /api/orders?
  • Search logs for "payment failed"
  • Which database queries are the slowest?
  • Create an issue for the recurring TypeError in checkout
  • Create a dashboard with charts for request latency and error rate
  • Why did the API health monitor go down last night?
  • Declare a public incident for the ongoing checkout outage and post an update once it's fixed

Search documentation

Search pages and sections of the Monocle documentation