What is Langfuse MCP?
Langfuse MCP is an agent-facing Model Context Protocol server and skill for Langfuse observability. It lets AI agents query traces, inspect generations, debug exceptions, analyze sessions, manage prompts, browse datasets, and understand what agents did in production.
How to use Langfuse MCP?
Install via uvx langfuse-mcp with Python 3.10+ and the uv runtime. Set environment variables LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, and LANGFUSE_HOST (defaults to Langfuse Cloud). Add the server to an MCP client (Claude Code, Codex, Cursor) using the provided configuration commands or JSON files. Start the MCP client, then invoke tools directly or use the included agent skill for ready‑made debugging playbooks.
Key features of Langfuse MCP
- 48 tools covering traces, observations, sessions, exceptions, prompts, datasets, annotation queues, scores, metrics, and schema.
- Selective tool loading via
--tools flag to reduce token overhead.
- Read‑only mode (
--read-only) disables all write operations.
- Default output mode (
--default-output-mode) for compact, full JSON string, or file output.
- Support for HTTP transport with per‑project credentials via
Authorization header.
- Included agent skill with playbooks for trace debugging, exception triage, latency analysis, prompt management, and dataset work.
Use cases of Langfuse MCP
- Debug failing agent runs by querying Langfuse traces and observations.
- Find exceptions, slow generations, high‑latency spans, and affected users.
- Inspect sessions and user journeys without leaving the agent workflow.
- Manage prompt versions, labels, datasets, annotation queues, and scores.
- Answer questions like “what failed?”, “why was this slow?”, or “which prompt version ran?”
评论