Last9 MCP
Ask your agent to bring production context to your local environment, debug issues, and fix them.
What is Model Context Protocol?
MCP is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications. Just as USB-C provides a standardized way to connect your devices to various peripherals and accessories, MCP provides a standardized way to connect AI models to different data sources and tools.
Using MCP, the agent in your preferred IDE (Cursor, Windsurf, VS Code) or Claude desktop app can talk to Last9 (or other various products) to fetch additional information.
Why use Last9 MCP?
The core idea was, how do we help with developer productivity?
The Last9 MCP server lets developers bring in context of real-time production issues to their local dev environment and let the agent auto-suggest fixes to their codebase based on the production obeservability data.
Gone are the days of “but this works on my machine”. Read more in our launch blogpost.
Get Started
Environment Variables
The Last9 MCP requires the following environment variables:
LAST9_BASE_URL
: (required) Last9 API URL from OTel integrationLAST9_AUTH_TOKEN
: (required) Authentication token for Last9 MCP server from OTel integrationLAST9_REFRESH_TOKEN
: (required) Refresh Token with Write permissions, needed for accessing control plane APIs from API Access
Setup MCP
-
Send logs, metrics, & traces to Last9 using the OpenTelemetry integration
-
Install the Last9 MCP server
# Add the Last9 tapbrew tap last9/tap# Install the Last9 MCP CLIbrew install last9-mcp# Install globallynpm install -g @last9/mcp-server# Or run directly with npxnpx @last9/mcp-server -
Connect to the Last9 MCP server
- Open the Claude Desktop app, go to Settings, then Developer
- Click Edit Config
- Open the claude_desktop_config.json file
- Copy and paste the server config to your existing file, then save
- Restart Claude
{"mcpServers": {"last9": {"command": "/opt/homebrew/bin/last9-mcp","env": {"LAST9_BASE_URL": "<last9_otlp_host>","LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>","LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"}}}}- Open Cursor, go to Settings, then Cursor Settings
- Select MCP on the left
- Click Add “New Global MCP Server” at the top right
- Copy and paste the server config to your existing file, then save
- Restart Cursor
{"mcpServers": {"last9": {"command": "/opt/homebrew/bin/last9-mcp","env": {"LAST9_BASE_URL": "<last9_otlp_host>","LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>","LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"}}}}- Open Windsurf, go to Settings, then Developer
- Click Edit Config
- Open the windsurf_config.json file
- Copy and paste the server config to your existing file, then save
- Restart Windsurf
{"mcpServers": {"last9": {"command": "/opt/homebrew/bin/last9-mcp","env": {"LAST9_BASE_URL": "<last9_otlp_host>","LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>","LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"}}}}Note: MCP support in VS Code is available starting v1.99 and is currently in preview. For advanced configuration options and alternative setup methods, view the VS Code MCP documentation.
- Open VS Code, go to Settings, select the User tab, then Features, then Chat
- Click “Edit settings.json”
- Copy and paste the server config to your existing file, then save
- Restart VS Code
{"mcp": {"servers": {"last9": {"type": "stdio","command": "/opt/homebrew/bin/last9-mcp","env": {"LAST9_BASE_URL": "<last9_otlp_host>","LAST9_AUTH_TOKEN": "<last9_otlp_auth_token>","LAST9_REFRESH_TOKEN": "<last9_write_refresh_token>"}}}}} -
Vibe
MCP Tools
Tools are a powerful primitive in the Model Context Protocol (MCP) that enable servers to expose executable functionality to clients. Through tools, LLMs can interact with external systems, perform computations, and take actions in the real world.
The agent will have context to call these tools on its own. Currently supported tools/use cases:
For Observability & APM
-
get_exceptions
: Get server-side exceptions over a specified time range.Parameters:
limit
(integer, optional): Maximum number of exceptions to return. Default: 20lookback_minutes
(integer, recommended): Number of minutes to look back from now. Default: 60. Examples: 60, 30, 15start_time_iso
(string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to use lookback_minutesend_time_iso
(string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current timespan_name
(string, optional): Name of the span to filter by
-
get_service_summary
: Get service summary over a given time range. Includes service name, environment, throughput, error rate, and response time. All values are p95 quantiles over the time range.Parameters:
start_time_iso
(string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Default: end_time_iso - 1 hourend_time_iso
(string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Default: Current timeenv
(string, optional): Environment to filter by. Default: ‘prod’
-
get_service_performance_details
: Get detailed performance metrics for a specific service.Parameters:
service_name
(string, required): Service namestart_time_iso
(string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Default: Now - 60 minutesend_time_iso
(string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Default: Current timeenv
(string, optional): Environment. Default: ‘prod’
-
get_service_operations_summary
: Get operations summary for a service like HTTP endpoints, database queries, messaging producer, and HTTP client calls.Parameters:
service_name
(string, required): Service namestart_time_iso
(string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Default: Now - 60 minutesend_time_iso
(string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Default: Current timeenv
(string, optional): Environment. Default: ‘prod’
-
get_service_dependency_graph
: Get service dependency graph showing incoming and outgoing dependencies, including infra. Includes throughput, response times and error rates.Parameters:
service_name
(string, optional): Name of the servicestart_time_iso
(string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Default: now - 60 minutesend_time_iso
(string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Default: Current timeenv
(string, optional): Environment. Default: ‘prod’
For Prometheus/PromQL
-
prometheus_range_query
: Execute Prometheus range queries for metrics over a time period.Parameters:
query
(string, required): Range query to executestart_time_iso
(string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Default: now - 60 minutesend_time_iso
(string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Default: Current time
-
prometheus_instant_query
: Execute Prometheus instant queries for metrics at a specific point in time.Parameters:
query
(string, required): Instant query to executetime_iso
(string, optional): Time in ISO format (YYYY-MM-DD HH:MM:SS). Default: Current time
-
prometheus_label_values
: Get all label values for a specific label name.Parameters:
match_query
(string, required): Valid PromQL filter querylabel
(string, required): Label to get values forstart_time_iso
(string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Default: now - 60 minutesend_time_iso
(string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Default: Current time
-
prometheus_labels
: Get all available label names.Parameters:
match_query
(string, required): Valid PromQL filter querystart_time_iso
(string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Default: now - 60 minutesend_time_iso
(string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Default: Current time
For Log Management
-
get_logs
: Gets logs filtered by optional service name and/or severity level within a specified time range.Parameters:
service
(string, optional): Name of the service to get logs forseverity
(string, optional): Severity of the logs to getlookback_minutes
(integer, recommended): Number of minutes to look back from now. Default: 60. Examples: 60, 30, 15start_time_iso
(string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to use lookback_minutesend_time_iso
(string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current timelimit
(integer, optional): Maximum logs to return. Default: 20
-
get_drop_rules
: Gets drop rules for logs, which determine what logs get filtered out from reaching Last9. -
add_drop_rule
: Adds a new drop rule to filter out specific logs at Last9 Control PlaneParameters:
name
(string, required): Name of the drop rulefilters
(array, required): List of filter conditions to apply. Each filter has:key
(string, required): The key to filter on. Only attributes and resource.attributes keys are supported. For resource attributes, use format:resource.attributes[key_name]
and for log attributes, use format:attributes[key_name]
. Double quotes in key names must be escapedvalue
(string, required): The value to filter againstoperator
(string, required): The operator used for filtering. Valid values:- “equals”
- “not_equals”
- conjunction (string, required): The logical conjunction between filters. Valid values:
- “and”
Demos
Troubleshooting
Please get in touch with us on Discord or Email if you have any questions.