Skip to content
Last9 Last9

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

  1. Send logs, metrics, & traces to Last9 using the OpenTelemetry integration

  2. Install the Last9 MCP server

    # Add the Last9 tap
    brew tap last9/tap
    # Install the Last9 MCP CLI
    brew install last9-mcp
  3. Connect to the Last9 MCP server

    1. Open the Claude Desktop app
    2. Go to Settings, then Developer, click Edit Config
    3. Open the claude_desktop_config.json file
    4. Copy and paste the server config to your existing file, then save
    5. Restart Claude, if already running
    {
    "mcpServers": {
    "last9": {
    "command": "/opt/homebrew/bin/last9-mcp",
    "env": {
    "LAST9_AUTH_TOKEN": "your_auth_token",
    "LAST9_BASE_URL": "https://otlp.last9.io"
    }
    }
    }
    }
  4. 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 to context to call these tools on its own. Currently supported tools/use cases:

  1. get_exceptions: Retrieves server-side exceptions over a specified time range.

    Parameters:

    • limit (integer, optional): Maximum number of exceptions to return. Default: 20
    • lookback_minutes (integer, recommended): Number of minutes to look back from now. Default: 60. Examples: 60, 30, 15
    • start_time_iso (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to use lookback_minutes
    • end_time_iso (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time
    • span_name (string, optional): Name of the span to filter by
  2. get_service_graph: Gets the upstream and downstream services for a given span name, along with the throughput for each service.

    Parameters:

    • span_name (string, required): Name of the span to get dependencies for
    • lookback_minutes (integer, recommended): Number of minutes to look back from now. Default: 60. Examples: 60, 30, 15
    • start_time_iso (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to use lookback_minutes
  3. 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 for
    • severity (string, optional): Severity of the logs to get
    • lookback_minutes (integer, recommended): Number of minutes to look back from now. Default: 60. Examples: 60, 30, 15
    • start_time_iso (string, optional): Start time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to use lookback_minutes
    • end_time_iso (string, optional): End time in ISO format (YYYY-MM-DD HH:MM:SS). Leave empty to default to current time
    • limit (integer, optional): Maximum number of logs to return. Default: 20
  4. get_drop_rules: Gets drop rules for logs, which determine what logs get filtered out from reaching Last9.

  5. add_drop_rule: Adds a new drop rule to filter out specific logs at Last9 Control Plane

    Parameters:

    • name (string, required): Name of the drop rule
    • filters (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 escaped
      • value (string, required): The value to filter against
      • operator (string, required): The operator used for filtering. Valid values:
        • “equals”
        • “not_equals”
      • conjunction (string, required): The logical conjunction between filters. Valid values:
        • “and”
  6. More coming soon…

Demo


Troubleshooting

Please get in touch with us on Discord or Email if you have any questions.