MCP Server

Uptrace ships with a built-in Model Context Protocol (MCP) server. It exposes your observability data as MCP tools and resources so AI assistants — Claude, Cursor, Continue, and others — can query telemetry, inspect alerts and incidents, and manage monitors and dashboards directly from your Uptrace project.

Quick start

Step 1. Open Project Settings → MCP and select your AI assistant. The page shows the project's endpoint and a command for that client.

Step 2. When browser sign-in is available, copy the command without a token. For Claude Code:

sh
claude mcp add --transport http uptrace https://<your-uptrace-api-host>/mcp/<project_id>

Open the sign-in URL shown by your client, sign in to Uptrace, and approve access to the project. Your organization can use SSO during this browser flow.

Step 3. If your client cannot open a browser, select Use a token instead on the MCP page. Choose or create a token, then copy the command it shows. For Claude Code:

sh
claude mcp add --transport http uptrace https://<your-uptrace-api-host>/mcp/<project_id> \
  --header "Authorization: Bearer <your-token>"

You can also configure a token-based client in mcp.json:

json
{
  "mcpServers": {
    "uptrace": {
      "url": "https://<your-uptrace-api-host>/mcp/<project_id>",
      "headers": {
        "Authorization": "Bearer <your-token>"
      }
    }
  }
}

Use the API URL from your Uptrace deployment for the MCP endpoint. It can differ from the web UI URL.

Authentication

The MCP server accepts an OAuth access token from browser sign-in or an API token in the Authorization: Bearer header.

  • Browser sign-in. The client opens Uptrace's login and consent pages. OAuth grants expire, apply to one project, and carry read or write scopes. You can revoke a grant from your account settings.
  • API tokens. The token alternative is useful for clients without browser sign-in. A user token follows that user's project permissions and does not expire automatically. Treat it like a password.
  • Project access. The <project_id> in the URL selects the project. Your account must have access to it. Write tools also require write permission.

Self-hosted operators can configure these methods with mcp and oauth settings.

Tools

Spans, logs, and events

ToolDescription
list_spansReturn individual span records matching a UQL query. Best for inspecting details.
list_span_groupsAggregate spans into groups with metrics (count, error rate, percentiles).
list_tracesFind individual traces using correlated sub-queries across multiple span types.
list_trace_groupsAggregate traces into groups using correlated multi-span sub-queries.
get_spanGet one span with its event and log children and a formatted SQL query.
get_traceGet one trace as a span tree, with its log and event records.
list_logsReturn individual log records matching a query.
list_log_groupsAggregate log records into groups, for example to find which service writes the most errors.
list_eventsReturn individual event records, such as messages and Sentry breadcrumbs.
list_event_groupsAggregate event records into groups.

The list tools accept Uptrace's full search syntax (word/phrase/AND/OR/exclude, regex, scoped attribute search) and UQL filters such as where service_name = 'api', system filters (httpserver:all, db:postgresql, log:error), and duration filters in milliseconds.

Alerts and monitors

ToolDescription
list_alertsList alerts with filtering by status, priority, type, activity, or monitor.
get_alertGet a single alert by ID with full event history and assignees.
list_monitorsList monitors with type, state, query, channels, and active alerts.
get_monitor_yamlExport one monitor as a YAML document.
preview_monitor_seriesRun a draft monitor query and return the series it selects, with sparklines. Creates nothing.
create_threshold_monitorCreate a monitor that fires when a metric leaves a fixed range.
create_anomaly_monitorCreate a monitor that fires on a departure from a model fitted on the metric's history.
create_outlier_monitorCreate a monitor that fires when one series of a grouped query departs from its peers.
create_forecast_monitorCreate a monitor that fires when a projected crossing falls within the forecast horizon.
create_error_monitorCreate a monitor that fires on the log records a query selects.
create_slo_monitorCreate an SLO monitor from a good-events query and a total-events query.
update_threshold_monitor, update_anomaly_monitor, update_outlier_monitor, update_forecast_monitorReplace a metric monitor. A metric monitor can change to another of these four types.
update_error_monitorReplace an error monitor.
update_slo_monitorReplace an SLO monitor.
delete_monitorPermanently delete a monitor and its alerts.

Incidents

ToolDescription
list_incidentsList incidents, filtered by status, priority, assignee, or text.
count_incidentsCount incidents per status and priority for the same filters.
get_incidentGet one incident, optionally with a preview of its alerts, events, and recommendations.
list_incident_alertsList the alerts attached to an incident.
list_incident_eventsList an incident's timeline: status and priority changes, alerts, notes, and assignments.
get_incident_analysisGet the generated analysis of an incident and the evidence behind it.
list_incident_recommendationsList the recommended actions for an incident and their decision state.
list_project_recommendationsList the recommendations awaiting a decision across the project.
decide_incident_recommendationAccept or reject a pending recommendation.
create_incident_from_alertsCreate an incident from one or more existing alerts.
attach_alert_to_incidentAttach alerts to an existing incident.
remove_alert_from_incidentRemove alerts from an incident.
merge_incidentsMerge one incident into another.
resolve_incidents, reopen_incidents, close_incidentsChange the status of one or more incidents.
archive_incidents, unarchive_incidentsFile incidents away, until a time or permanently, and take them back.
update_incident_detailsUpdate an incident's title and summary.
update_incident_priorityOverride an incident's priority, or restore the derived one.
assign_incidentSet the owners of an incident.
add_incident_note, update_incident_note, delete_incident_noteManage notes on the incident timeline.

Metrics

ToolDescription
explore_metricsDiscover metrics: name, instrument, unit, description, attributes, library.
list_metric_attributesList attribute keys available for metrics, with kind, unit, and counts.
list_metric_attribute_valuesList distinct values for a specific metric attribute key.

Dashboards

ToolDescription
list_dashboardsList all dashboards in the current project.
list_dashboard_tagsList dashboard tags used in the project.
get_dashboard_yamlExport an existing dashboard as YAML.
create_dashboardCreate a new dashboard from a YAML definition.
update_dashboardReplace an existing dashboard's definition with new YAML.
delete_dashboardPermanently delete a dashboard by ID.
list_dashboard_templatesList built-in dashboard templates.
get_dashboard_templateGet a built-in dashboard template by ID.

Dashboard tools use the same YAML format as the dashboard import/export feature.

Resources

The MCP server also exposes resources that AI assistants can read directly:

ResourceURIDescription
create_dashboarduptrace://skills/create-dashboardSkill guide for the dashboard creation workflow.
dashboard_template_schemauptrace://dashboard-templates/schemaJSON Schema for validating dashboard YAML.
create_monitoruptrace://skills/create-monitorSkill guide for creating monitors: the monitor types, their settings, query preview, and which create tool to use.