# Langfuse MCP server

> Read-only analysis of Langfuse LLM traces and observations lets agents inspect trace data, debug LLM pipelines, and analyze costs and latency.

- Repository: https://github.com/pulsemcp/mcp-servers
- Page: https://hostedmcp.org/servers/pulsemcp/langfuse
- Official: yes
- Transport: stdio
- Stars: 81
- License: MIT
- Latest version: 0.1.3

## Install

### Claude Code

```sh
claude mcp add --env 'LANGFUSE_PUBLIC_KEY=<YOUR_LANGFUSE_PUBLIC_KEY>' --env 'LANGFUSE_SECRET_KEY=<YOUR_LANGFUSE_SECRET_KEY>' langfuse -- npx -y langfuse-observability-mcp-server
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "langfuse": {
      "command": "npx",
      "args": [
        "-y",
        "langfuse-observability-mcp-server"
      ],
      "env": {
        "LANGFUSE_PUBLIC_KEY": "<YOUR_LANGFUSE_PUBLIC_KEY>",
        "LANGFUSE_SECRET_KEY": "<YOUR_LANGFUSE_SECRET_KEY>"
      }
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "langfuse": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "langfuse-observability-mcp-server"
      ],
      "env": {
        "LANGFUSE_PUBLIC_KEY": "<YOUR_LANGFUSE_PUBLIC_KEY>",
        "LANGFUSE_SECRET_KEY": "<YOUR_LANGFUSE_SECRET_KEY>"
      }
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"langfuse","type":"stdio","command":"npx","args":["-y","langfuse-observability-mcp-server"],"env":{"LANGFUSE_PUBLIC_KEY":"<YOUR_LANGFUSE_PUBLIC_KEY>","LANGFUSE_SECRET_KEY":"<YOUR_LANGFUSE_SECRET_KEY>"}}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "langfuse": {
      "command": "npx",
      "args": [
        "-y",
        "langfuse-observability-mcp-server"
      ],
      "env": {
        "LANGFUSE_PUBLIC_KEY": "<YOUR_LANGFUSE_PUBLIC_KEY>",
        "LANGFUSE_SECRET_KEY": "<YOUR_LANGFUSE_SECRET_KEY>"
      }
    }
  }
}
```

### Codex

```sh
codex mcp add langfuse --env 'LANGFUSE_PUBLIC_KEY=<YOUR_LANGFUSE_PUBLIC_KEY>' --env 'LANGFUSE_SECRET_KEY=<YOUR_LANGFUSE_SECRET_KEY>' -- npx -y langfuse-observability-mcp-server
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.langfuse]
command = "npx"
args = ["-y", "langfuse-observability-mcp-server"]

[mcp_servers.langfuse.env]
LANGFUSE_PUBLIC_KEY = "<YOUR_LANGFUSE_PUBLIC_KEY>"
LANGFUSE_SECRET_KEY = "<YOUR_LANGFUSE_SECRET_KEY>"
```

### Gemini CLI

```sh
gemini mcp add -s user -e 'LANGFUSE_PUBLIC_KEY=<YOUR_LANGFUSE_PUBLIC_KEY>' -e 'LANGFUSE_SECRET_KEY=<YOUR_LANGFUSE_SECRET_KEY>' langfuse npx -- -y langfuse-observability-mcp-server
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "langfuse": {
      "command": "npx",
      "args": [
        "-y",
        "langfuse-observability-mcp-server"
      ],
      "env": {
        "LANGFUSE_PUBLIC_KEY": "<YOUR_LANGFUSE_PUBLIC_KEY>",
        "LANGFUSE_SECRET_KEY": "<YOUR_LANGFUSE_SECRET_KEY>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `LANGFUSE_PUBLIC_KEY` | yes | yes | Langfuse public key for authentication. |
| `LANGFUSE_SECRET_KEY` | yes | yes | Langfuse secret key for authentication. |
| `LANGFUSE_BASE_URL` | no | no | Langfuse API base URL. |

## Tools (4)

- `get_traces`
- `get_trace_detail`
- `get_observations`
- `get_observation`

## FAQ

### What tools does the Langfuse MCP server expose?

It exposes get_traces, get_trace_detail, get_observations, and get_observation for listing and inspecting traces and observations.

### Does the Langfuse MCP server modify any data?

No, it is read-only and performs no write operations, so it is safe to use without risk of data modification.

### How does the server handle very large trace payloads?

Any string field longer than 1000 characters is truncated, with the full content saved to a /tmp/langfuse_*.txt file and the path included so agents can grep it.
