Purpose: langfuse-mcp is an MCP (Model Context Protocol) server that wraps the Langfuse REST API as tools, enabling Claude or other MCP clients to query Langfuse project data directly within a conversation, without leaving the assistant interface. It is suitable for scenarios such as investigating why a certain trace failed, listing recent error records, summarizing generation costs by model, and viewing the production version of a prompt.
Main capabilities: All tools are read-only and call the Langfuse Public API via HTTPS using project API keys for Basic Auth. It covers data such as traces and observations, sessions, scores, prompts, datasets, metrics, models, projects, and comments; it provides tools such as getHealth to confirm whether the connection is working properly.
Usage: Requires Node.js 20 or newer, as well as an API key for a Langfuse project (created in the Langfuse UI under Settings → API Keys; keys are distinguished by project and region). The server reads three environment variables, and automatically loads a .env file when one exists in the working directory. It can be run with zero installation via npx or installed globally. It can be started as a subprocess by any MCP client over stdio. It supports configuration and use in clients such as Claude Desktop, Claude Code, Cursor, Cline (VS Code), Continue, and Windsurf; after configuration, the corresponding client must be restarted.
Applicable scenarios: Asking in a conversation, e.g. "why did trace abc123 fail and show its observations step by step", "list a certain user's most recent 5 traces with level=ERROR", "summarize today's generation costs by model", "show the production version of the prompt customer-support-v2", etc.
Limitations and notes: Provides read-only access only and does not modify Langfuse data. A 401 Unauthorized usually stems from a region mismatch (EU and US are separate accounts); LANGFUSE_BASE_URL must match the region in which the key was created, and must include a protocol header (https://)的完整 URL; for self-hosted instances, the complete base URL must be provided, and it must not include paths such as /api or /public. The npx cache may cause an older version to be used; @latest can be used to force a refresh. Node versions lower than 20 will report errors such as ERR_REQUIRE_ESM. For more information, refer to CONTRIBUTING.md, SECURITY.md, and the Code of Conduct in the repository.