> ## Documentation Index
> Fetch the complete documentation index at: https://docs.uselemma.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP

> Connect your AI coding tools to Lemma using the Model Context Protocol

Give your coding agent direct access to your traces, metrics, and monitors. Instead of switching between your editor and the Lemma dashboard, your agent can pull the exact runs and errors it needs to understand what's going wrong and fix it in place.

## Prerequisites

* A [Lemma](https://uselemma.ai) account with at least one project sending traces
* An MCP-compatible IDE or tool (Cursor, Claude Desktop, Claude Code, or any client that supports MCP)

## Setup

<Steps>
  <Step title="Get your API key">
    Go to your project settings in the Lemma dashboard and copy your API key.

    <Warning>
      Copy your key immediately after creating it — you won't be able to see it again.
    </Warning>
  </Step>

  <Step title="Add to your IDE">
    <Tabs>
      <Tab title="Cursor">
        In **Settings > MCP Servers**, add:

        ```json theme={null}
        {
          "mcpServers": {
            "lemma": {
              "url": "https://api.uselemma.ai/mcp",
              "headers": {
                "Authorization": "Bearer <your-api-key>"
              }
            }
          }
        }
        ```
      </Tab>

      <Tab title="Claude Desktop">
        Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:

        ```json theme={null}
        {
          "mcpServers": {
            "lemma": {
              "type": "http",
              "url": "https://api.uselemma.ai/mcp",
              "headers": {
                "Authorization": "Bearer <your-api-key>"
              }
            }
          }
        }
        ```

        Restart Claude Desktop after saving.
      </Tab>

      <Tab title="Claude Code">
        Run this in your terminal:

        ```bash theme={null}
        claude mcp add --transport http lemma \
          https://api.uselemma.ai/mcp \
          --header "Authorization: Bearer <your-api-key>"
        ```
      </Tab>

      <Tab title="Other">
        For any MCP client that supports Streamable HTTP transport:

        ```json theme={null}
        {
          "mcpServers": {
            "lemma": {
              "url": "https://api.uselemma.ai/mcp",
              "headers": {
                "Authorization": "Bearer <your-api-key>"
              }
            }
          }
        }
        ```
      </Tab>
    </Tabs>

    Replace `<your-api-key>` with the key from your project settings.
  </Step>

  <Step title="Try it out">
    Ask your agent:

    ```
    Use Lemma to show me my last 5 traces, including any errors.
    ```
  </Step>
</Steps>

See the [API Reference](/api-reference) for the full list of available tools and endpoints.
