SuperAPI AI Directory

last9-mcp-server

Bring real-time production logs, metrics and traces from Last9 into your local environment to fix code.

Open website

About this tool

Purpose

Last9 MCP Server solves the problem that AI agents don't know what is actually broken in production. It connects production observability data collected by Last9 into AI assistants that support MCP, so agents stop guessing and instead read real signals to locate and fix code.

The officially described supported clients include Claude, Cursor, Windsurf, and "any other AI assistant that supports MCP." The data types that can be connected include logs, metrics, traces, exceptions, database queries, alerts, and deployments.

Main Capabilities

The server is divided into several tool groups by function:

  • APM Service Observability: get_service_summary (request volume ranked by service and environment, throughput RPM, HTTP 4xx/5xx and gRPC error counts), get_service_environments (available environments; the official recommendation is to run this tool first), get_service_performance_details (throughput, error rate, p50/p90/p95/avg/max, apdex, availability), get_service_operations_summary (operations grouped by HTTP endpoint, database call, message, HTTP client), get_service_dependency_graph (dependency graph of upstream/downstream and infrastructure, including throughput, latency, error rate), get_apm_service_deviations (compares the current window with an equal-length baseline, providing regression/improvement, Apdex reconciliation, and final conclusions).
  • Exceptions: get_exceptions, supports filtering by service and span.
  • Database Observability: get_databases (discover databases, including type, host, throughput, p95 latency, error rate, number of dependent services; databases without traces can be discovered from infrastructure metrics such as CloudWatch), get_database_slow_queries (slowest query executions sorted by duration, with trace ID), get_database_queries (query patterns and aggregations), get_database_server_metrics (server-side metrics of the database host, depending on the database system). The official documentation states support for PostgreSQL, MySQL, MongoDB, Redis, Aerospike, and any OTel trace with a db_system attribute.
  • Prometheus / PromQL: prometheus_range_query, prometheus_instant_query, prometheus_label_values, prometheus_labels, can switch to a non-default data source/cluster via LAST9_DATASOURCE.
  • Logs: get_logs (full JSON pipeline log query), get_service_logs (raw log lines filtered by severity level and body), get_log_attributes (log schema attribute catalog), get_log_attributes_for_pipeline, get_drop_rules, add_drop_rule (reduce log volume at the source).
  • Traces: get_traces, get_service_traces (by trace ID or service name; the official recommendation is to use this tool when a trace ID is available because it is faster), get_trace_attributes, get_trace_attributes_for_pipeline, get_trace_attribute_values, get_trace_attribute_deviations, get_trace_waterfall (parent/child waterfall chart, including interval-merged self time and slowest span).
  • Change Events and Alerts: get_change_events (deployments, configuration changes, rollbacks), get_alert_groups, get_alert_config, get_alerts (alerts currently firing within a time window), get_alert_rule_state, get_notification_channels.
  • Custom Dashboards: list_dashboards, get_dashboard, validate_dashboard (read-only validation), create_dashboard, update_dashboard, delete_dashboard, as well as snapshot-related tools.
  • Continuous profiling: The organization must enable this feature. First call get_profile_services, then call get_flamegraph, get_top_functions, and get_profile_summary.
  • Grafana dashboards: Read-only tools, accessed through Last9's Grafana proxy; credential fields are not returned to the model; requires setting LAST9_TOOLSETS=grafana to enable.
  • Fuzzy name resolution: did_you_mean, returns the closest entity name matches (up to 3, with similarity scores). The server automatically calls it when most tool name lookups return empty.
  • Service profile: get_service_profile, to first understand the actual shape of the service's telemetry data before querying (which signals exist, language and runtime, deployment environment, log format, and recommended instrumentation fixes).

In addition, every tool response returns a deep_link field, pointing to the direct URL for that query and time range in the Last9 dashboard.

How to use

Hosted method (30-second setup): No need to install a binary, no need to manage a token; one URL plus browser OAuth is enough. You first need to find the organization slug from the Last9 URL (in the form app.last9.io/<org_slug>/...). In an MCP-capable client: In Cursor, enter /mcp, select last9, and authenticate; in Windsurf, go to Settings > MCP > Add New MCP Server and click Connect to complete OAuth (requires v1.99+), or run MCP: Add Server in the Command Palette, paste the URL, and authenticate; you can also configure it directly in settings.json; in Claude Web/Desktop, go to Settings > Connectors > Add custom connector, name it last9, paste the URL, and authenticate (requires a Claude organization administrator permission).

Self-hosted (STDIO): Suitable for scenarios where the MCP client does not support HTTP transport or where a local server is required. You can download the binary from GitHub Releases (Windows/manual), or use NPM. Steps to obtain a Refresh Token: Only administrators can create tokens; go to API Access, click Generate Token, and grant Write permission. The NPM method uses "command": "npx" and adds "args": ["-y", "@last9/mcp-server@latest"]; the official note says the NPM method is easier on Windows, with no need to manage paths.

HTTP mode: The server starts at http://localhost:8080/mcp。Streamable The HTTP handler runs in stateless mode, where any request is processed independently; the initialize handshake and Mcp-Session-Id header are optional (they are accepted but ignored), and clients can directly call tools/list or tools/call. Because the server does not send server→client notifications, GET /mcp (SSE stream) returns 405.

Building from source: The official instructions state that LAST9_HTTP=true is only for local development; for actual use, a managed HTTP endpoint is recommended.

Time parameter rules: Absolute time (start_time_iso / end_time_iso or time_iso) takes precedence over lookback_minutes; use lookback_minutes for relative windows; use RFC3339/ISO8601 for absolute windows (example: 2026-02-09T15:04:05Z); the legacy YYYY-MM-DD HH:MM:SS format is accepted only for compatibility.

Toolsets: By default, all tools are exposed. Automation hosts that only perform investigation can set LAST9_TOOLSETS=investigate (or pass --toolsets=investigate) to keep tools/list concise. The named packages include logs, traces, metrics, alerts, dashboards, profiles, grafana, investigate, and all; unknown names fail fast. The official documentation specifically notes that the metrics package itself does not include list_datasources and did_you_mean; when these discovery helper tools are needed, use investigate or a combined toolset.

Other behavior: Large results are processed in chunks rather than truncated; get_logs defaults to a limit of 5000 entries, configurable via LAST9_MAX_GET_LOGS_ENTRIES. Longer manuals (logjson/tracejson/service-logs/metrics) are provided as MCP resources (last9://reference/logjson, etc.) rather than always being injected into tool descriptions; key query rules remain in the tool descriptions. Organization-specific fields need to be discovered through get_log_attributes / get_log_attributes_for_pipeline (and the corresponding trace tools).

Applicable Scenarios and Limitations

The applicable scenarios are: production environment investigation in AI assistants that support MCP, including service performance and deviation analysis, anomaly localization, slow query and database performance analysis, log and trace queries, alert and change correlation, performance profiling, and Grafana dashboard inspection.

Limitations and considerations (all from the official documentation):

  • The managed approach requires completing OAuth in the browser; custom connectors for Claude Web/Desktop require Claude organization administrator permissions.
  • Refresh Tokens can only be created by administrators and require Write permission to be granted.
  • Continuous performance profiling requires the organization to have this feature enabled.
  • Grafana tools are read-only and need to be enabled via LAST9_TOOLSETS=grafana.
  • Updating a dashboard is a full replacement, and read-only system dashboards will return an error; validate_dashboard is read-only and will not create or update dashboards.
  • The env parameter of some APM tools accepts PromQL regular expressions; exact matching requires anchors (such as ^prod$).
  • Specific pricing and billing methods: not yet provided.