Langfuse MCP
Inspect recorded AI behavior and manage Langfuse resources through the langfuse-mcp server's 48 tools across 11 groups. Always move from the narrowest read-only discovery query to targeted ID lookups, and preserve exact IDs, filters, and lookback windows (age in minutes) in findings.
References
- All 48 tools, filters, pagination, output modes, and API/SDK caveats: references/tools-reference.md
- Server transports (
stdio/streamable-http), profiles, tool groups, read-only mode, and troubleshooting: references/setup-and-config.md
Diagnostic Workflows
Start broad, then fetch full evidence by ID:
- Errors & exceptions:
find_exceptions(age=1440, group_by="file")→ pick a group →find_exceptions_in_file(filepath=..., age=1440)→get_exception_details(trace_id=...). If a group key is"unknown"(missingcode.filepath), drill down directly with its representativetrace_id— never passfilepath="unknown". - Trace inspection:
fetch_traces(age=60, user_id=...)→fetch_trace(trace_id=..., include_observations=true)→fetch_observation(observation_id=...). - Slow LLM calls:
fetch_observations(age=60, type="GENERATION")orquery_metrics(view="observations", ...)→ inspect latency, tokens, and model on high-latency IDs. Always callget_metrics_schema()before building a newquery_metricsquery. - User sessions:
get_user_sessions(user_id=..., age=1440)orfetch_sessions(age=1440)→get_session_details(session_id=..., include_observations=true). - Routing decisions:
summarize_route_decisions(age=10080)/find_low_confidence_route_decisions()→get_route_decision(decision_id=...)(reads SPAN observations withschema_version="mcp.route_decision.v1"). - Prompts, datasets, queues & scores: Use
list_prompts()/get_prompt()/get_prompt_unresolved(), dataset/run tools,list_annotation_queues(), andlist_scores_v2()/get_score_v2().
Critical Rules & Gotchas
- Read-only vs writes: Only invoke the 14 write tools (prompt creation/labeling, dataset/item/run writes/deletes, annotation-queue mutations) when the user explicitly requests that mutation. Prefer
--read-only/LANGFUSE_MCP_READ_ONLY=truefor pure debugging. - Lookback window (
age):ageis in minutes (1h=60, 24h=1440, 7d=10080) and is capped byLANGFUSE_MAX_AGE_DAYS(default7days =10080). RaiseLANGFUSE_MAX_AGE_DAYSon the server when querying older retention. - Output modes: Tools supporting
output_modedefault tocompact(large fields truncated at 500 chars / responses capped around 20k). Useoutput_mode="full_json_file"(writes to--dump-dir, default/tmp/langfuse_mcp_dumps) orfull_json_string(returns serialized JSON string) only when complete payloads are needed, as exports may contain sensitive user data. - Observations API v2:
fetch_tracesomitstotal_cost,scores, andobservationsby default and omits traces without a root observation; passinclude_observations=truefor full observations and usequery_metricsfor aggregates. Pagination uses cursormetadata.next_pagewithouttotal. - Immutable prompts: Prompts are immutable; create a new version with
create_text_promptorcreate_chat_prompt(usually labeled"staging"), and promote or roll back viaupdate_prompt_labels. Assigning a label removes it from other versions. - Preserve historical evidence: Report recorded model names, timestamps, and metadata verbatim; do not normalize or rewrite historical identifiers.


