The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Langfuse MCP listing page.
An MCP server that exposes the Langfuse REST API as tools, so Claude (or any MCP client) can query your traces, observations, sessions, scores, prompts, datasets, and metrics during a conversation.
Useful when you want to ask things like:
abc123 fail? Walk me through its observations."level=ERROR for user alice@x.com."customer-support-v2."…without leaving your assistant.
node --version).All tools are read-only and call the Langfuse Public API over HTTPS using your project keys for Basic Auth.
| Tool | Description |
|---|---|
listTraces | List traces with filters. Returns summary metadata. |
getTrace | Fetch a single trace by id including the full observation tree. |
listObservations | List spans, generations, and events with filters. |
getObservation | Fetch a single observation by id. |
| Tool | Description |
|---|---|
listSessions | List sessions within a time range. |
getSession | Fetch a session by id, including its traces. |
| Tool | Description |
|---|---|
listScores | List scores with filters. |
getScore | Fetch a single score by id. |
listScoreConfigs | List score configurations (definitions, ranges, categories). |
getScoreConfig | Fetch a score configuration by id. |
| Tool | Description |
|---|---|
listPrompts | List prompt definitions, optionally filtered by name, label, or tag. |
getPrompt | Fetch a prompt by name, optionally pinned to a specific version or label. |
| Tool | Description |
|---|---|
listDatasets | List datasets configured in Langfuse. |
getDataset | Fetch a dataset by name. |
listDatasetItems | List items in a dataset (inputs, expected outputs, metadata). |
getDatasetItem | Fetch a single dataset item by id. |
listDatasetRuns | List evaluation runs for a dataset. |
getDatasetRun | Fetch a specific dataset run by name. |
| Tool | Description |
|---|---|
getMetrics | Run a custom metrics query (counts, latency, cost, token usage). Pass a JSON query string. |
getDailyMetrics | Daily aggregated usage / cost / count metrics. |
listModels | List models known to Langfuse (for cost / token attribution). |
getModel | Fetch a model definition by id. |
listProjects | List projects accessible to the current API key. |
listComments | List comments attached to traces, observations, sessions, or prompts. |
getComment | Fetch a single comment by id. |
getMedia | Fetch metadata for a media attachment (image, audio, file). |
getHealth | Ping the Langfuse public health endpoint — useful for credential validation. |
Zero install with npx:
Or install globally:
The server reads three environment variables:
| Variable | Required | Description |
|---|---|---|
LANGFUSE_PUBLIC_KEY | yes | Project public key (pk-lf-…). |
LANGFUSE_SECRET_KEY | yes | Project secret key (sk-lf-…). |
LANGFUSE_BASE_URL | yes | e.g. https://cloud.langfuse.com (EU) or https://us.cloud.langfuse.com (US) or your self-hosted URL. |
LANGFUSE_ENV_FILE | no | Optional path to a .env file to load instead of ./.env. |
Where do I get my keys? In the Langfuse UI: Settings → API Keys → Create new API keys. Keys are scoped to a single project and a single region (EU vs US are separate accounts — match your
LANGFUSE_BASE_URLto the region you created the keys in).
If a .env file exists in the working directory it will be loaded automatically. See .env.example for a starter file.
Edit claude_desktop_config.json:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.jsonRestart Claude Desktop after editing. The MCP server icon should appear in the chat input.
Project-level (./.mcp.json):
User-level config lives at ~/.claude.json and uses the same shape.
Project-level: .cursor/mcp.json. User-level: ~/.cursor/mcp.json.
In VS Code settings (settings.json):
In ~/.continue/config.json:
In Windsurf's MCP settings, add:
The server speaks MCP over stdio. Any MCP client can launch it as a subprocess:
Once wired up, ask your assistant things like:
getHealth tool to confirm langfuse-mcp is connected."level=ERROR."abc123 with all its observations."alice@example.com receive this week?"customer-support."eval-2026-q1 and tell me which one had the highest accuracy score."401 Unauthorized on the first call
LANGFUSE_BASE_URL matches the region where you created the keys (https://cloud.langfuse.com for EU, https://us.cloud.langfuse.com for US)..env: this server strips surrounding quotes, but a stray space can still break Basic Auth. Re-paste the key.getHealth first to confirm credentials before running other tools.npx keeps using an old version
npx caches packages aggressively. The @latest suffix forces a refresh.
LANGFUSE_BASE_URL must be a full URL error
The most common cause is a missing scheme. Use https://cloud.langfuse.com, not cloud.langfuse.com.
Self-hosted Langfuse
Use the full base URL of your deployment without a trailing slash or path. Example: https://langfuse.mycompany.internal. The server normalizes a single trailing slash, but anything else (/api, /public) will break path joining.
MCP server icon doesn't appear in Claude Desktop
~/Library/Logs/Claude/mcp*.log (macOS) or %APPDATA%\Claude\Logs\ (Windows). The server writes a langfuse-mcp v… connected line to stderr on success.Cryptic ERR_REQUIRE_ESM / Unexpected token on startup
Your Node version is too old. This package requires Node ≥ 20. Run node --version and upgrade if needed (e.g. via nvm).
Other scripts:
| Script | What it does |
|---|---|
npm run build | Compile TypeScript to dist/. |
npm start | Run the built server. |
npm run typecheck | tsc --noEmit. |
npm run lint | ESLint. |
npm run format / npm run format:check | Prettier write / check. |
npm test | Vitest. |
See CONTRIBUTING.md. Bug reports and PRs are welcome — please run npm run typecheck && npm run lint && npm test locally before opening one.
Found a vulnerability? Please report it privately as described in SECURITY.md. Do not open a public issue.
MIT © Hugoles.