Logfire MCP Server Setup Guide

Prerequisites
  1. Install uv:

    • Ensure uv is installed on your system. Refer to the uv installation docs for guidance.
    • If you have an older version, update it using:
      uv self update
       
  2. Obtain a Logfire Read Token:

    • Create a “read token” in the “Read Tokens” section of your project settings in Logfire:
      Logfire Read Tokens

Running the MCP Server

  1. Manually Run the Server:
    • Use the following command to start the MCP server, replacing YOUR_READ_TOKEN with your actual read token:
      LOGFIRE_READ_TOKEN=YOUR_READ_TOKEN uvx logfire-mcp
       
    • Alternatively, use the --read-token flag:
      uvx logfire-mcp --read-token=YOUR_READ_TOKEN
       

Configuration with MCP Clients

Configure for Cursor

  1. Create a .cursor/mcp.json file in your project root with the following content:
    {
      "mcpServers": {
      "logfire": {
      "command": "uvx",
      "args": ["logfire-mcp", "--read-token=YOUR-TOKEN"]
      }
      }
     }
     

Configure for Claude Desktop

  1. Add the following to your Claude settings:
    {
      "command": ["uvx"],
      "args": ["logfire-mcp"],
      "type": "stdio",
      "env": {
      "LOGFIRE_READ_TOKEN": "YOUR_TOKEN"
      }
     }
     

Configure for Cline

  1. Add to your cline_mcp_settings.json:
    {
      "mcpServers": {
      "logfire": {
      "command": "uvx",
      "args": ["logfire-mcp"],
      "env": {
      "LOGFIRE_READ_TOKEN": "YOUR_TOKEN"
      },
      "disabled": false,
      "autoApprove": []
      }
      }
     }
     

Customization

  1. Base URL:
    • Override the default Logfire API URL by using the --base-url argument:
      uvx logfire-mcp --base-url=https://your-logfire-instance.com
       
    • Or set the environment variable:
      LOGFIRE_BASE_URL=https://your-logfire-instance.com uvx logfire-mcp
       

Getting Started

  1. Obtain a Logfire Read Token:

  2. Run the MCP Server:

    uvx logfire-mcp --read-token=YOUR_TOKEN
     
  3. Configure Your Preferred Client:

    • Use the configuration examples provided above for Cursor, Claude Desktop, or Cline.
  4. Start Using the MCP Server:

    • Analyze your OpenTelemetry traces and metrics.
Share this post: