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.
Usage: 12,518 PyPI downloads last month (pypistats, 2026-08-19). v0.10.1.
Local MCP server and skill for Langfuse. Debug traces, sessions, and exceptions from Claude Code, Codex, Cursor, or any MCP client.
Use this for local debug: first-class traces, sessions, and exceptions; route-decision tools; compact / file-dump output; plus the included langfuse skill.
Use official Langfuse MCP for hosted, zero-install access to the broader API (score writes, comments, models, media).
As of June 2026:
| langfuse-mcp | Native Langfuse MCP | |
|---|---|---|
| Primary fit | Local debug: traces, sessions, exceptions | Hosted, zero-install API surface |
| Deployment | Local stdio or HTTP, via the Langfuse Python SDK | Native streamable HTTP at /api/public/mcp |
| Trace / session / exception tools | First-class | Observation/API-oriented access |
| Route-decision tools | Yes | No |
| Token & output control | Compact summaries, truncation, file-dump mode, tool-group gating | Hosted tool response + client |
| Metrics & dataset runs | Yes | Yes |
| Prompt, dataset, queue & score reads | Yes | Yes |
| Score writes, comments, models, media | No | Yes |
langfuse-mcp for local debug. Native MCP for hosted breadth.
Install is uvx langfuse-mcp plus Langfuse API keys — Quick Start for Claude Code, Codex, Cursor, or Docker.
After the client restarts, ask:
That maps to existing tools:
find_exceptions returns {group, count, observation_id, trace_id} (top 50 groups) — each group carries a representative observation/trace ID, and find_exceptions_in_file also yields full error records. Then optionally:
The exception tools detect errors by observation level == "ERROR" (strict; a non-empty status_message alone does not count). Counts describe error-level observations, not individual exception events — get_error_count returns exception_count: null for that reason. Exception details come from recorded metadata (exception.type / exception.message / exception.stacktrace, top-level or under metadata.attributes); absent values are null. Results are not a point-in-time snapshot.
Requires uv (for uvx) and Python 3.10 or newer. CI verifies Python 3.10 through 3.14.
Get credentials from Langfuse Cloud → Settings → API Keys. If self-hosted, use your instance URL for LANGFUSE_HOST.
To pin a CI-verified interpreter explicitly, add --python 3.14 before langfuse-mcp.
Restart your CLI, then verify with /mcp (Claude Code) or codex mcp list (Codex).
This repo ships a first-party langfuse skill for Claude Code and Codex. The skill gives agents concrete playbooks for trace debugging, exception triage, latency analysis, prompt management, and dataset work.
Install it when you want the agent to know when to reach for Langfuse and which MCP tools to call first.
Via skills (recommended):
Via skild:
Manual install:
After installing the skill, try:
The MCP server provides the tools; the skill provides the agent-facing workflow. See skills/langfuse/SKILL.md, skills/langfuse/references/setup.md, and skills/langfuse/references/tool-reference.md.
| Category | Tools |
|---|---|
| Traces | fetch_traces, fetch_trace |
| Observations | fetch_observations, fetch_observation |
| Routing | find_route_decisions, get_route_decision, summarize_route_decisions, find_low_confidence_route_decisions |
| Sessions | fetch_sessions, get_session_details, get_user_sessions |
| Exceptions | find_exceptions, find_exceptions_in_file, get_exception_details, get_error_count |
| Prompts | list_prompts, get_prompt, get_prompt_unresolved, create_text_prompt, create_chat_prompt, update_prompt_labels |
| Datasets | list_datasets, get_dataset, list_dataset_items, get_dataset_item, create_dataset, create_dataset_item, delete_dataset_item, list_dataset_runs, get_dataset_run, list_dataset_run_items, create_dataset_run_item, delete_dataset_run |
| Annotation Queues | list_annotation_queues, create_annotation_queue, get_annotation_queue, list_annotation_queue_items, get_annotation_queue_item, create_annotation_queue_item, update_annotation_queue_item, delete_annotation_queue_item, create_annotation_queue_assignment, delete_annotation_queue_assignment |
| Scores | list_scores_v2, get_score_v2 |
| Metrics | query_metrics, get_metrics_schema |
| Schema | get_data_schema |
Langfuse uses upsert for dataset items. To edit an existing item, call create_dataset_item with item_id. If the ID exists, it updates; otherwise it creates a new item.
query_metrics aggregates telemetry server-side (cost, latency, tokens, counts, score values) so agents can answer "what did inference cost?" or "what's p95 latency by model?" without pulling raw traces. Call get_metrics_schema for the full view/dimension/measure catalog.
High-cardinality fields (id, traceId, userId, sessionId) must be used in filters, not dimensions. The v2 metrics endpoint is Langfuse Cloud-only; self-hosted instances may return 404.
Load only the tool groups you need to reduce token overhead:
Available groups: traces, observations, routing, sessions, exceptions, prompts, datasets, annotation_queues, scores, metrics, schema
The routing group is router-neutral. It reads Langfuse span observations with
metadata.schema_version: "mcp.route_decision.v1" and filters on route-decision
fields stored in observation metadata, such as decision_id, router_name,
provider, and capability_id.
Disable all write operations for safer read-only access:
This disables: create_text_prompt, create_chat_prompt, update_prompt_labels, create_dataset, create_dataset_item, delete_dataset_item, create_dataset_run_item, delete_dataset_run, create_annotation_queue, create_annotation_queue_item, update_annotation_queue_item, delete_annotation_queue_item, create_annotation_queue_assignment, delete_annotation_queue_assignment
Set the MCP-exposed default output_mode so clients that omit the parameter automatically use your preferred mode:
Supported values: compact, full_json_string, full_json_file
This updates the default shown in MCP tool schemas. Clients can still override it per call by passing output_mode explicitly.
Create .cursor/mcp.json in your project (or ~/.cursor/mcp.json for global):
Run one persistent server instance and route each MCP client to its own Langfuse
project by passing credentials in the Authorization header.
Security note:
--bind-host 0.0.0.0exposes the port on all interfaces. In production, place the server behind a TLS-terminating reverse proxy (nginx, Caddy, Cloudflare Tunnel) that enforces HTTPS. TheAuthorizationheader containing your keys is transmitted in plaintext over plain HTTP. If startup credentials are set, the proxy must enforce authentication; otherwise unauthenticated callers without anAuthorizationheader can use the default project. For shared public HTTP deployments, omit defaultLANGFUSE_PUBLIC_KEY/LANGFUSE_SECRET_KEYcredentials unless the fronting proxy authenticates every request.
Register each project separately in your MCP client, passing its credentials as a
Basic auth header (base64(public_key:secret_key)):
Auth semantics: Basic here carries Langfuse API keys, not user passwords. An
absent header falls back to startup env credentials (LANGFUSE_PUBLIC_KEY /
LANGFUSE_SECRET_KEY). Any malformed header is rejected outright — there is no
silent fallback to a different project.
| Variable | Default | Description |
|---|---|---|
LANGFUSE_MAX_AGE_DAYS | 7 | Caps the lookback window for time-based tools (fetch_traces, fetch_observations, etc.). Set to match your Langfuse instance's data retention — e.g. 30 if your retention is 30 days. |
LANGFUSE_MCP_TRACE_TIMEOUT_SECONDS | 120 | Per-request read timeout (seconds) for single-trace fetches (fetch_trace). Raise it if large traces with include_observations=True time out. Must be a positive integer. |
MIT