Langfuse MCP server enables AI agents to query Langfuse trace data for enhanced debugging and observability. Operations teams benefit from improved AI agent performance monitoring and troubleshooting. Integrates with Langfuse for trace data analysis and supports Claude agents.
git clone https://github.com/avivsinai/langfuse-mcp.gitLangfuse MCP is a Model Context Protocol server that connects Claude, Cursor, and other AI agents directly to Langfuse observability data. It provides 48 tools for inspecting traces, finding exceptions, analyzing sessions, managing prompts, and working with datasets without leaving your agent workflow. Operations teams use it to answer production questions: what failed, why was it slow, which prompt version ran, and what happened in a user's session. The server runs locally via stdio or HTTP and includes an agent skill with ready-made debugging playbooks. It focuses on compact trace inspection and token efficiency compared to broader hosted alternatives.
[{"step":"Set up the Langfuse MCP server and authenticate it with your Langfuse project. Use the server’s configuration to specify the project ID and API key.","action":"Run `langfuse-mcp-server --project-id your_project_id --api-key your_api_key` in your terminal or configure it in your agent’s environment."},{"step":"Identify the agent or trace you want to analyze. Use placeholders like [AGENT_NAME] or [TIME_PERIOD] in your prompt to scope the query.","action":"Replace [AGENT_NAME] with the exact name of your agent (e.g., 'CustomerSupportAgent') and [TIME_PERIOD] with a duration (e.g., 'last 3 days')."},{"step":"Define the metrics or thresholds to focus on. Common examples include latency, error rates, or tool call failures.","action":"Specify [SPECIFIC_METRIC] (e.g., 'latency') and [THRESHOLD] (e.g., '5 seconds') to filter traces automatically."},{"step":"Review the AI’s output and extract actionable insights. Cross-reference the trace data with your agent’s logs or code to validate findings.","action":"Use the suggested fixes to update your agent’s configuration, tooling, or prompts. Test the changes in a staging environment before deploying to production."},{"step":"Monitor the agent’s performance post-fix using the same Langfuse queries to confirm improvements.","action":"Re-run the query after 24-48 hours to compare latency, error rates, and user satisfaction metrics. Adjust thresholds or queries as needed."}]
Debug failing agent runs by querying Langfuse traces and inspecting observations
Find and triage exceptions, slow generations, and high-latency spans in production
Analyze user sessions and journeys to understand agent behavior
Manage prompt versions and datasets during agent development
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/avivsinai/langfuse-mcpCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Query the Langfuse trace data for [AGENT_NAME]'s recent runs to identify performance bottlenecks or errors. Focus on traces from the last [TIME_PERIOD] where [SPECIFIC_METRIC] fell below [THRESHOLD]. For each problematic trace, extract the input/output pairs, latency metrics, and any error messages. Suggest 2-3 actionable fixes based on the patterns observed.
Here’s a summary of the trace analysis for the 'CustomerSupportAgent' over the last 7 days where latency exceeded 5 seconds: **Top 3 Slowest Traces:** 1. Trace ID: `tr_987654321` (Latency: 12.4s) - Input: User query about 'refund policy for order #12345' - Output: Incorrect response (recommended 'store credit' instead of 'full refund') - Error: Missing context from order database - Root Cause: Database query timeout (3.2s) due to unoptimized query 2. Trace ID: `tr_555666777` (Latency: 8.1s) - Input: User complaint about 'late delivery' - Output: Generic apology without tracking info - Error: No integration with shipping API - Root Cause: Fallback to slow manual lookup 3. Trace ID: `tr_111222333` (Latency: 6.7s) - Input: User asking about 'product compatibility' - Output: Incomplete answer (missing 3/5 compatibility rules) - Error: Fragmented tool calls - Root Cause: Agent split complex query into sequential steps **Recommended Fixes:** 1. Optimize the order database query by adding an index on `order_id` (estimated 60% latency reduction). 2. Integrate the shipping API directly into the agent’s toolset to avoid manual lookups. 3. Implement a caching layer for frequently asked questions (e.g., refund policy) to reduce redundant computations. **Performance Impact:** Applying these fixes could reduce average latency from 7.2s to 2.1s (71% improvement) based on similar optimizations in other agents.
Open-source LLM observability and evaluation
AI helpers for patient intake and benefits checks
Get more done every day with Microsoft Teams – powered by AI
Automate your spreadsheet tasks with AI power
Agentic AI Workflow platform
Connected workspace for docs, wikis, and projects
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan