π Quick Start
Langfuse Model Context Protocol (MCP) server enables AI agents to read/write project data directly. Choose between the native HTTP endpoint (https://langfuse.com/api/public/mcp) or the extended community CLI (npx langfuse-mcp-server).
For CLI agents (e.g., Claude Code), install the skill directly via npx skills add avivsinai/langfuse-mcp -g -y.
π§ Configuration
Bind the MCP server in your client configuration (e.g., claude_desktop_config.json). Supply LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, and LANGFUSE_BASE_URL as environment variables.
{
"mcpServers": {
"langfuse": {
"command": "npx",
"args": ["langfuse-mcp-server"],
"env": {
"LANGFUSE_PUBLIC_KEY": "pk-...",
"LANGFUSE_SECRET_KEY": "sk-...",
"LANGFUSE_BASE_URL": "https://cloud.langfuse.com"
}
}
}
}π¦ Dependencies
Requires an MCP-compatible client like Cursor or Claude Desktop. The langfuse-mcp-server NPM package is required when executing locally via npx.
π‘ Best Practices
Use the MCP server for βin-the-flowβ conversational debugging and live context retrieval. Restrict agent scope by allow-listing only read or list tools if write access is unnecessary.
Switch to the Langfuse CLI/SDK for heavy data processing. The SDK is superior when pre-filtering massive datasets inside a sandboxed terminal.
π¨ Gotchas / Warnings By default, the MCP server provides full read/write access to project data including scores and annotations. Secure your API keys aggressively and use environment variables rather than hardcoding them.
The native URL-based integration primarily manages prompts. You may need the community npx server for extended observability features like datasets and sessions.
π Research / References
- Source:
https://langfuse.com/docs/mcp - Supported Capabilities: Observations (traces/spans), Scores (numeric/categorical logging), and Metrics (cost/latency/quality).
- Extended Objects: Datasets, dataset runs, annotation queues, comments, models, and media access.