Langfuse MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Langfuse MCP Server analyze failure rates for last 24 hours"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Langfuse MCP Server
Model Context Protocol server for Langfuse observability. Query traces, analyze accuracy, detect failures, track costs, debug latency, manage prompts and datasets.
56 tools across data access and analytics. Multi-project support so one instance can serve several Langfuse projects. Works with Claude Code, Codex CLI, Cursor, and any MCP-compatible client.
Why this MCP server?
Comparison with official Langfuse MCP (as of March 2026):
Capability | This server | Official Langfuse MCP |
Traces & Observations | Yes | No |
Sessions & Users | Yes | No |
Exception Tracking | Yes | No |
Prompt Management | Yes | Yes |
Dataset Management | Yes | No |
Annotation Queues | Yes | No |
Scores v2 API | Yes | No |
Score Write-back | Yes | No |
Multi-project support | Yes | No |
Accuracy Metrics | Yes | No |
Failure Detection | Yes | No |
Token Percentiles | Yes | No |
Cost Breakdown | Yes | No |
Latency Analysis | Yes | No |
Session Analytics | Yes | No |
Context Breach Scanning | Yes | No |
User Group Aggregation | Yes | No |
The official MCP focuses on prompt management. This server provides a full observability and analytics toolkit — traces, observations, sessions, scores, exceptions, prompts, datasets, annotation queues, plus 9 built-in analytics tools that compute insights server-side and return LLM-sized summaries. Multi-project routing lets a single instance serve several Langfuse projects behind one connector URL.
Related MCP server: langfuse-mcp
Quick Start
1. Get your API keys
Langfuse Cloud: cloud.langfuse.com → Settings → API Keys
Self-hosted: Your Langfuse instance → Settings → API Keys. Set
LANGFUSE_HOSTto your instance URL (e.g.,https://langfuse.yourcompany.com)
2. Add the MCP server
Claude Code
claude mcp add \
-e LANGFUSE_PUBLIC_KEY=pk-lf-... \
-e LANGFUSE_SECRET_KEY=sk-lf-... \
-e LANGFUSE_HOST=https://cloud.langfuse.com \
--scope project \
langfuse-mcp -- uvx langfuse-mcp-serverCodex CLI
codex mcp add langfuse-mcp \
--env LANGFUSE_PUBLIC_KEY=pk-lf-... \
--env LANGFUSE_SECRET_KEY=sk-lf-... \
--env LANGFUSE_HOST=https://cloud.langfuse.com \
-- uvx langfuse-mcp-serverCursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"langfuse-mcp": {
"command": "uvx",
"args": ["langfuse-mcp-server"],
"env": {
"LANGFUSE_PUBLIC_KEY": "pk-lf-...",
"LANGFUSE_SECRET_KEY": "sk-lf-...",
"LANGFUSE_HOST": "https://cloud.langfuse.com"
}
}
}
}3. Verify
Restart your CLI, then test with /mcp (Claude Code) or codex mcp list (Codex).
Manual install (alternative to uvx)
pip install langfuse-mcp-server
langfuse-mcp-serverHosting as a remote service
Run as a long-lived HTTP service so multiple users connect to a single instance — required for Claude.ai custom Connectors, and useful for team-wide access without distributing Langfuse API keys per user.
Enabled via env vars; no code changes.
Minimum setup
MCP_TRANSPORT=streamable-http
MCP_BASE_URL=https://mcp.yourcompany.com
LANGFUSE_PUBLIC_KEY=pk-lf-...
LANGFUSE_SECRET_KEY=sk-lf-...
LANGFUSE_HOST=https://your-langfuse-instance.exampleWithout OAuth env vars, the endpoint is unauthenticated — suitable only for local testing. See Google OAuth setup below for production.
Docker
A production-ready Dockerfile is checked into the repo (non-root user, pinned base, .dockerignore to prevent secret leakage). Each tagged release auto-publishes a multi-arch image to GitHub Container Registry via .github/workflows/docker-publish.yml.
Pull the published image:
docker pull ghcr.io/drishtantkaushal/langfusemcp:latestOr build from source:
docker build -t langfuse-mcp .Run (all secrets injected via -e, never baked into the image):
docker run -d \
--name langfuse-mcp \
--restart unless-stopped \
-p 8000:8000 \
-e MCP_TRANSPORT=streamable-http \
-e MCP_BASE_URL=https://mcp.yourcompany.com \
-e LANGFUSE_PUBLIC_KEY=pk-lf-... \
-e LANGFUSE_SECRET_KEY=sk-lf-... \
-e LANGFUSE_HOST=https://cloud.langfuse.com \
-e GOOGLE_CLIENT_ID=... \
-e GOOGLE_CLIENT_SECRET=... \
-e ALLOWED_EMAIL_DOMAINS=yourcompany.com \
ghcr.io/drishtantkaushal/langfusemcp:latestReverse proxy
Terminate TLS in front (nginx, Caddy, Cloudflare). MCP endpoint is at /mcp/ (trailing slash). Because responses stream, the proxy must:
Disable response buffering — nginx:
proxy_buffering off;Allow read timeout ≥ 5 minutes — some analytics queries legitimately run several minutes
Speak HTTP/1.1 with keepalive upstream
Google OAuth
In your Google Cloud project:
APIs & Services → OAuth consent screen
User type: Internal (restricts sign-in to your Google Workspace domain)
Scopes:
openid,https://www.googleapis.com/auth/userinfo.email
Credentials → Create OAuth client ID → Web application
Authorized redirect URI:
https://{your-base-url}/auth/callbackCopy the Client ID and Client Secret
Set:
GOOGLE_CLIENT_ID=....apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=GOCSPX-...OAuth activates when GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, and MCP_BASE_URL are all set. With an Internal consent screen, Google rejects non-Workspace sign-ins at the identity layer — the server never sees those attempts.
Optional email allowlist
For narrower control than "anyone in the Workspace":
# either, or both
ALLOWED_EMAIL_DOMAINS=yourcompany.com
ALLOWED_EMAILS=alice@yourcompany.com,bob@yourcompany.comWhen set, every tool call verifies the caller's email_verified claim and checks membership before proceeding. When unset, the server trusts whatever the OAuth provider returns.
Adding to Claude.ai
Once hosted at https://mcp.yourcompany.com:
Claude.ai → Settings → Connectors → Add custom connector
Remote MCP server URL:
https://mcp.yourcompany.com/mcp/Leave the OAuth Client ID / Secret fields empty — the server uses Dynamic Client Registration; those fields are for a different deployment pattern.
Click Add → Google sign-in popup → done.
Verifying the deploy
Auth enabled, expect 401:
curl -i -X POST https://mcp.yourcompany.com/mcp/ \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"curl","version":"0"}}}'OAuth metadata endpoint returns JSON (used by Claude.ai to auto-register):
curl https://mcp.yourcompany.com/.well-known/oauth-authorization-serverLiveness/readiness probe — unauthenticated GET /health returns HTTP 200 with {"status": "ok"}, suitable for Kubernetes probes:
curl -i https://mcp.yourcompany.com/healthMulti-project support
A single server instance can route to multiple Langfuse projects. Every tool accepts an optional project argument; when omitted, the server-configured default is used. Call list_projects to discover what's available.
Configuring projects
Declare each project via indexed env vars. Project names are data, not part of variable names — use whatever scheme you like.
LANGFUSE_PROJECT_1_NAME=production
LANGFUSE_PROJECT_1_PUBLIC_KEY=pk-lf-...
LANGFUSE_PROJECT_1_SECRET_KEY=sk-lf-...
LANGFUSE_PROJECT_1_HOST=https://cloud.langfuse.com
LANGFUSE_PROJECT_2_NAME=staging
LANGFUSE_PROJECT_2_PUBLIC_KEY=pk-lf-...
LANGFUSE_PROJECT_2_SECRET_KEY=sk-lf-...
LANGFUSE_PROJECT_2_HOST=https://cloud.langfuse.com
LANGFUSE_DEFAULT_PROJECT=productionUsage from the client
Claude: "Show me failing traces in production today."
→ fetch_traces(project="production", ...) routed to project 1's credentials.
Claude: "Compare that with staging."
→ fetch_traces(project="staging", ...) routed to project 2's credentials.Each project has its own cache, rate limiter, and connection pool. Claude.ai sees one connector; users authenticate once via OAuth and can query any configured project within the session.
Single-project (legacy) mode
If LANGFUSE_PROJECT_1_NAME is not set, the server falls back to the legacy LANGFUSE_PUBLIC_KEY / LANGFUSE_SECRET_KEY / LANGFUSE_HOST vars and registers them as a project called default. Existing deployments keep working without changes.
Configuration
Env Variable | Default | Description |
| (required) | Langfuse public API key |
| (required) | Langfuse secret API key |
|
| Langfuse instance URL (cloud or self-hosted) |
|
| Comma-separated internal domains to exclude from analytics (e.g., |
|
| Disable write operations ( |
|
| Traces per API page |
| (unset) | Multi-project: name for project N (e.g. |
| (unset) | Public key for project N. |
| (unset) | Secret key for project N. |
|
| Host URL for project N. |
| first configured | Default project name used when a tool call omits |
|
|
|
|
| Bind address when |
|
| Port when |
| (unset) | Public base URL of the hosted server. Required for Google OAuth. |
| (unset) | Google OAuth client ID. OAuth activates when all three Google vars are set. |
| (unset) | Google OAuth client secret. |
| (unset) | Comma-separated emails allowed to call tools. Requires OAuth. |
| (unset) | Comma-separated email domains allowed to call tools. Requires OAuth. |
Tools
Analytics (9 tools)
Tools that compute insights server-side and return compact summaries. These go beyond raw data access — they aggregate, detect patterns, and compute statistics so the LLM can reason over results without hitting context window limits.
Tool | Description | Key Parameters |
| Aggregate trace metrics by user group. Returns per-group: trace count, unique sessions, unique users, accuracy rate, average latency, total cost. |
|
| Compute accuracy from feedback scores. Accuracy = correct / (correct + incorrect). Supports grouping and time bucketing for trend analysis. |
|
| Detect LLM output quality failures using pattern matching ("unable to", "I can't", etc.) and negative feedback scores. NOT Python exceptions — use |
|
| Compute token usage percentiles (TP50/TP90/TP95/TP99) at trace level. Fetches generation observations for accurate per-trace token counts. |
|
| Scan for traces where any single generation exceeds a token threshold. Catches context window overflow causing degraded LLM performance or silent truncation. |
|
| Analyze multi-turn session behavior. Returns session count, depth distribution (single vs multi-turn), engagement metrics, and session-level cost/latency. |
|
| Compute cost breakdown using Langfuse's built-in |
|
| Analyze latency distribution at trace level and optionally per LLM generation. Identifies which model is the bottleneck. |
|
| Write scores back to Langfuse. Use after analysis to annotate traces with findings — tag failures for review, mark high-quality traces for dataset creation. |
|
Data Access (25 tools)
Full Langfuse API coverage for querying and managing your observability data.
Traces
Tool | Description |
| List traces with filters — user ID, name, tags, time range, ordering. Returns paginated results. |
| Get a single trace by ID with full details including all observations (spans, generations, events). |
| Compare two traces side-by-side (name, user, latency, cost, tags, release, version). |
Observations
Tool | Description |
| List observations with filters — trace ID, type (GENERATION/SPAN/EVENT), name, time range. |
| Get a single observation by ID. Returns input/output, token usage, model, latency, and cost. |
Sessions
Tool | Description |
| List sessions with optional time filters. |
| Get full details of a session including all its traces. |
| Get sessions for a specific user. Fetches user's traces and extracts unique sessions. |
Errors
Tool | Description |
| Find observations with error status. For LLM output quality issues, use |
| Get full error details for a trace — returns all observations with error status highlighted. |
| Get total error count within a time period. |
Scores
Tool | Description |
| List scores/evaluations with filters — trace ID, score name, time range. |
| v2 Scores API with richer filters (session ID, dataset run ID, queue ID, config ID, operator/value, etc.). |
| Get a single score by ID via the v2 Scores API. |
Prompts
Tool | Description |
| List all prompts in the project with optional name filter. |
| Fetch a specific prompt by name, version, or label. |
| Fetch a prompt with placeholders/dependencies intact (debugging prompt composition). |
| Create a new text prompt version with optional labels and model config. |
| Create a new chat prompt version with message array and optional config. |
| Update labels for a specific prompt version (e.g., promote to "production"). |
Datasets
Tool | Description |
| List all datasets in the project. |
| Get metadata for a specific dataset. |
| List items in a dataset with pagination. |
| Get a single dataset item by ID. |
| Create a new dataset with optional description and metadata. |
| Create or upsert a dataset item. Supports linking to source traces. |
| Delete a dataset item by ID. |
Annotation Queues
Tool | Description |
| List all annotation queues in the project. |
| Create a new annotation queue with attached score configs. |
| Get a queue by ID. |
| List items in a queue (optionally filtered by status). |
| Get a queue item by ID. |
| Add a trace or observation to a queue for review. |
| Change a queue item's status (PENDING / COMPLETED). |
| Remove an item from a queue. |
| Assign a reviewer to a queue. |
| Remove a reviewer from a queue. |
Metrics
Tool | Description |
| Langfuse's pre-aggregated daily rollup (trace count, cost, tokens per day). Faster than per-trace aggregation for long windows. |
Users
Tool | Description |
| Top users by trace count over a time window (defaults to last 30 days). Wraps the Langfuse |
Comments
Tool | Description |
| List comments attached to traces/observations/sessions/prompts, with filters. |
| Get a single comment by ID. |
| Create a markdown comment on a trace/observation/session/prompt. |
Models
Tool | Description |
| List model definitions in Langfuse's models registry (pricing + tokenizer config). |
| Get a single model definition by ID. |
Projects
Tool | Description |
| Discovery: returns the list of configured Langfuse projects and the default project. |
Schema
Tool | Description |
| Get the data schema for the Langfuse project — available fields and types for traces, observations, scores, sessions. |
Sample Questions
Once connected, ask your AI assistant questions like these:
Agent & Pipeline Health
"Which agents failed the most this week?"
"What's the failure rate by agent name?"
"Which agent has the worst accuracy?"
"Show me the top 5 agents by trace volume"
"Are any agents consistently slower than others?"
"Compare all agents by accuracy, latency, and cost"
Accuracy & Quality
"What's our overall accuracy this week?"
"What's the accuracy trend by week for the last 30 days?"
"Compare accuracy across different agents"
"What's the daily accuracy breakdown?"
"Which users are getting the worst accuracy?"
"What percentage of traces have feedback scores?"
Failures & Debugging
"Show me failure examples from today"
"What are the most common failure patterns?"
"Which users are seeing the most failures?"
"What's the failure rate by agent?"
"Are failures increasing or decreasing this week vs last?"
"Show me traces where the LLM said 'unable to' or 'I can't'"
Token Usage
"What are the P90 and P99 token usage stats?"
"Which agents consume the most tokens?"
"Compare token usage across user groups"
"Are any users hitting unusually high token counts?"
Context Window Breaches
"Are any generations exceeding the 128K context window?"
"Show me traces with token usage above 200K per generation"
"What's the breach severity distribution?"
"Which users trigger the most context window breaches?"
Sessions & Engagement
"What's our multi-turn rate?"
"How deep are sessions on average?"
"Which users have the deepest sessions?"
"How many single-turn vs multi-turn sessions this week?"
"What's the average session cost?"
Cost
"How much are we spending per day this week?"
"What's the weekly cost trend for the last 30 days?"
"Which agent is the most expensive?"
"Which users are costing the most?"
"What's the average cost per trace?"
Latency
"What's the P95 latency?"
"Is latency getting worse over time?"
"Which model is the slowest?"
"Compare latency across agents"
"Show me per-generation latency breakdown by model"
"Which users are experiencing the highest latency?"
Annotation & Write-back
"Score all failing traces from today with 'needs-review'"
"Tag these trace IDs as 'high-quality' for dataset creation"
"Mark trace abc-123 with a score of 0 and comment 'hallucinated output'"
Lookups & Exploration
"Fetch the last 20 traces"
"Show me trace abc-123 with all its observations"
"List sessions for user alice@example.com"
"What errors happened in the last 24 hours?"
"How many errors occurred this week?"
"Show me all prompts in the project"
"List all datasets"
"What fields are available on traces and observations?"
Grouping Options
The group_by parameter controls how traces are segmented in analytics tools:
Value | What it groups by | When to use |
| Trace/agent name (default) | Compare performance across different agents or pipelines |
| Per-user breakdown | Identify users with issues or high usage |
| Email domain extracted from userId | Multi-tenant apps where users have email-based IDs (e.g., |
| Trace tags | Compare across tagged environments, versions, or experiments |
Selective Tool Loading
Load only the tool groups you need to reduce token overhead:
# Only load traces and analytics tools
LANGFUSE_TOOLS=traces,analytics langfuse-mcp-server
# Only load prompts and datasets
LANGFUSE_TOOLS=prompts,datasets langfuse-mcp-server
# In Claude Code
claude mcp add \
-e LANGFUSE_PUBLIC_KEY=pk-lf-... \
-e LANGFUSE_SECRET_KEY=sk-lf-... \
-e LANGFUSE_TOOLS=traces,observations,analytics \
langfuse-mcp -- uvx langfuse-mcp-serverAvailable groups:
Group | Tools | Count |
|
| 2 |
|
| 2 |
|
| 3 |
|
| 3 |
|
| 1 |
|
| 5 |
|
| 7 |
| All 10 annotation queue tools | 10 |
|
| 1 |
|
| 1 |
|
| 3 |
|
| 2 |
|
| 1 |
|
| 1 |
| All 9 analytics tools | 9 |
If LANGFUSE_TOOLS is not set, all 56 tools are loaded.
Read-Only Mode
Disable write operations (score_traces, create_dataset, create_dataset_item, delete_dataset_item, create_text_prompt, create_chat_prompt):
LANGFUSE_MCP_READ_ONLY=trueHow it Compares
vs Official Langfuse MCP
Capability | This server | Official Langfuse MCP |
Traces & Observations | Yes | No |
Sessions & Users | Yes | No |
Exception Tracking | Yes | No |
Prompt Management | Yes | Yes |
Dataset Management | Yes | No |
Score Write-back | Yes | No |
Selective Tool Loading | Yes | No |
Accuracy Metrics | Yes | No |
Failure Detection | Yes | No |
Token Percentiles | Yes | No |
Cost Breakdown | Yes | No |
Latency Analysis | Yes | No |
Session Analytics | Yes | No |
Context Breach Scanning | Yes | No |
User Group Aggregation | Yes | No |
The official Langfuse MCP (5 tools) focuses on prompt management. This server provides full observability coverage plus 9 analytics tools.
vs Other Langfuse MCP Implementations
Capability | This server | Others |
Data access (traces, observations, sessions) | Yes | Yes |
Prompt & dataset management | Yes | Yes |
Exception tracking | Yes | Yes |
Annotation queues | Yes | Partial |
Selective tool loading | Yes | Yes |
Multi-project support | Yes | No |
Accuracy metrics | Yes | No |
LLM failure detection | Yes | No |
Token percentiles (TP50/P90/P95/P99) | Yes | No |
Cost breakdown by group/time | Yes | No |
Latency analysis with per-model breakdown | Yes | No |
Multi-turn session analytics | Yes | No |
Context window breach scanning | Yes | No |
User/tenant group aggregation | Yes | No |
Score write-back | Yes | No |
Other implementations provide data access (fetching raw traces, observations, sessions) using synchronous HTTP clients. This server adds a compute layer — analytics tools that aggregate, detect patterns, and compute statistics server-side — plus an async architecture that's fundamentally faster.
Architecture | This server | Others |
Async HTTP client | Yes (httpx.AsyncClient) | No (sync requests/httpx) |
Concurrent observation fetching | Yes (asyncio.gather) | No (sequential per-trace) |
TTL caching | Yes (live 5min, historical 1hr) | No |
Adaptive rate limiting | Yes (token bucket, 429 backoff) | No (fixed sleep) |
Batch observation queries | Yes (with auto-fallback) | No (N+1 per-trace) |
Claude Code sub-agent | Yes (.claude/agents/) | No |
vs Platform-Embedded AI (Braintrust Loop, LangSmith Insights, Arize Alyx)
Capability | This server | Platform AI assistants |
Open source | Yes | No |
Works with any MCP client | Yes | Platform-locked |
Self-hosted Langfuse support | Yes | N/A |
Real-time conversational | Yes | Varies (some batch-only) |
Custom grouping/segmentation | Yes | Limited |
Write-back to Langfuse | Yes | Platform-specific |
Free | Yes | Paid tiers |
Architecture
Why async httpx instead of the Langfuse SDK?
The Langfuse Python SDK is excellent for writing traces (it batches and sends asynchronously in the background). But for reading traces at scale — which is what an analytics MCP server does — the SDK has a limitation: its read API is synchronous, built on the requests library.
This server uses httpx.AsyncClient instead, which enables:
Concurrent observation fetching — fetch observations for 100 traces simultaneously via
asyncio.gather, not one-by-oneNon-blocking pagination — paginate through thousands of traces without blocking the event loop
Rate-limited concurrency —
asyncio.Semaphore+ token bucket controls throughput withouttime.sleep()blocking
Measured impact: analyze_latency with per-generation breakdown dropped from 110s to 20s (5.4x faster) on a self-hosted instance with 2.4M daily observations.
Caching strategy
Two-tier in-memory TTL cache using cachetools.TTLCache:
Data age | TTL | Rationale |
Today's data | 5 minutes | Still changing, short cache |
Historical data (before today) | 1 hour | Won't change, cache aggressively |
The cache operates at the API page level. If you call aggregate_by_group then compute_accuracy for the same time range, the second call hits cache for all trace pages — only scores are fetched fresh.
Configure via LANGFUSE_CACHE_TTL and LANGFUSE_CACHE_TTL_HISTORICAL (seconds).
Rate limiting
A global token bucket rate limiter respects Langfuse API limits:
Instance type | Default RPM | Behavior |
Self-hosted | Unlimited (0) | No artificial throttling. Full speed, limited only by your server. |
Langfuse Cloud (Hobby) | 30 req/min | Conservative default for Hobby tier |
Langfuse Cloud (Pro/Team) | Set | Higher throughput for paid plans |
On HTTP 429 responses, the limiter automatically halves the RPM and reads the Retry-After header. This means the server adapts to any rate limit — cloud or self-hosted — without manual configuration.
Observation fetching: batch vs concurrent
Analytics tools that need per-generation data (token percentiles, context breaches, latency breakdown) face the N+1 problem: one API call per trace to fetch its observations.
This server uses a two-step strategy:
Try batch fetch — fetch ALL observations for the time range in one paginated call, group by traceId in memory
If volume is too high (>5000 pages / 500K+ observations) — fall back to concurrent per-trace fetch using
asyncio.gatherwith semaphore-controlled concurrency
This means the server handles both small projects (batch is faster) and large-scale deployments (concurrent targeted fetching avoids downloading millions of irrelevant observations).
Context isolation via sub-agent
The server ships with a Claude Code custom agent at .claude/agents/langfuse-analyst.md. When a user asks a Langfuse-related question, Claude Code can delegate to this agent, which:
Only loads Langfuse MCP tools (not other tools in the session)
Has a specialized system prompt with tool taxonomy and workflow patterns
Runs in an isolated context window, keeping the main conversation clean
Returns a summary to the parent conversation
This prevents 33 tool schemas (~5000 tokens) from polluting every conversation.
Contributing
See CONTRIBUTING.md for development setup, code style guidelines, and areas for contribution.
Security
See SECURITY.md for the security policy, vulnerability reporting, and API key handling.
Code of Conduct
See CODE_OF_CONDUCT.md.
License
MIT — see LICENSE.
Available Tools
58 toolsaggregate_by_groupA
Aggregate trace metrics by user group.
Returns per-group: trace count, unique sessions, unique users, accuracy rate, average latency, total cost. Sorted by trace count.
group_by options:
'name': trace/agent name (default — works for everyone)
'userId': per-user breakdown
'domain': extracts domain from email-based user IDs (e.g. user@acme.com → acme.com)
'tag': groups by trace tags
Set exclude_internal=true and LANGFUSE_INTERNAL_DOMAINS env var to filter out internal team users (only relevant with group_by='domain').
Inputs: tags, top_n, project, end_date, +4 more. Returns: object
analyze_latencyA
Analyze latency distribution across traces and optionally per generation.
Returns: latency percentiles (P50/P90/P95/P99), average, max. group_by: 'domain', 'name', 'model'. Set include_per_generation=true to also analyze per-LLM-call latency (slower, fetches observations). Identifies which model is the bottleneck.
Inputs: tags, project, end_date, group_by, +4 more. Returns: object
analyze_sessionsC
Analyze multi-turn session behavior.
Returns: session count, depth distribution (single vs multi-turn), average traces per session, session-level cost/latency, and engagement metrics.
Inputs: tags, project, end_date, group_by, +2 more. Returns: object
compute_accuracyA
Compute accuracy from feedback scores. Accuracy = correct / (correct + incorrect).
group_by: 'domain', 'name', 'userId'. bucket_by: 'week', 'day' for trends. score_name: filter to a specific score (default: all scores).
Inputs: tags, project, end_date, group_by, +4 more. Returns: object
compute_token_percentilesA
Compute token usage percentiles (TP50/TP90/TP95/TP99) across traces.
Fetches generation observations to get per-trace token counts. Optionally group by 'domain' or other trace attribute.
NOTE: Fetches observations per trace — can be slow for large date ranges. Use last_7_days or smaller for real-time results.
Inputs: tags, project, end_date, group_by, +3 more. Returns: object
create_annotation_queueB
Create a new annotation queue.
score_config_ids: comma-separated score config IDs to attach to the queue.
Inputs: name (required), score_config_ids (required), project, description. Returns: object
create_annotation_queue_assignmentB
Assign a reviewer (user) to an annotation queue.
Inputs: user_id (required), queue_id (required), project. Returns: object
create_annotation_queue_itemB
Add a trace or observation to an annotation queue for review.
object_type: 'TRACE' or 'OBSERVATION'. status: optional initial status (defaults to PENDING).
Inputs: queue_id (required), object_id (required), object_type (required), status, +1 more. Returns: object
create_chat_promptC
Create a new chat prompt version. messages: JSON string of [{role, content}].
Inputs: name (required), messages (required), config, labels, +1 more. Returns: object
create_commentB
Create a comment on a trace, observation, session, or prompt.
project_id: the Langfuse project ID (different from the MCP project
argument — find it in your Langfuse dashboard URL).
object_type: 'trace' | 'observation' | 'session' | 'prompt'.
content: markdown body, up to 5000 characters.
Inputs: content (required), object_id (required), project_id (required), object_type (required), +2 more. Returns: object
create_datasetC
Create a new dataset. metadata: JSON string.
Inputs: name (required), project, metadata, description. Returns: object
create_dataset_itemC
Create or upsert a dataset item. input/expected_output: JSON strings.
Inputs: input (required), dataset_name (required), item_id, project, +4 more. Returns: object
create_text_promptA
Create a new text prompt version. labels: comma-separated.
Inputs: name (required), prompt (required), config, labels, +1 more. Returns: object
delete_annotation_queue_assignmentB
Remove a reviewer assignment from an annotation queue.
Inputs: user_id (required), queue_id (required), project. Returns: object
delete_annotation_queue_itemC
Remove an item from an annotation queue.
Inputs: item_id (required), queue_id (required), project. Returns: object
delete_dataset_itemC
Delete a dataset item by ID.
Inputs: item_id (required), project. Returns: object
detect_context_breachesA
Scan for traces where token usage exceeds a context window threshold.
Default: 256K tokens. Set check_per_generation=true to check if any SINGLE generation exceeds the limit (not just trace aggregate). Catches context window overflow causing degraded performance or truncation.
Inputs: tags, project, end_date, threshold, +3 more. Returns: object
detect_failuresA
Detect LLM output failures using pattern matching and feedback scores.
Finds traces where output contains failure signals ('unable to', 'I can't', 'error occurred', etc.) OR where feedback score = 0.
This catches LLM quality failures, NOT Python exceptions. Use find_exceptions for code errors.
Inputs: tags, project, end_date, group_by, +4 more. Returns: object
diff_tracesA
Compare two traces side-by-side. Fetches both in parallel and returns a summary of how their high-level fields differ (name, user, session, latency, cost, token usage, tags, model, status).
Useful for answering 'why did trace X take longer than trace Y?' or 'what's different between these two runs?'.
Inputs: trace_id_a (required), trace_id_b (required), project. Returns: object
estimate_costsA
Compute cost breakdown from Langfuse totalCost field.
Groups by 'domain', 'name', 'userId', or time buckets ('day', 'week'). Returns: total cost, average per trace, per group breakdown.
Inputs: tags, project, end_date, group_by, +3 more. Returns: object
fetch_observationA
Get a single observation by ID. Returns full details including input/output, token usage, model, latency, and cost.
Inputs: observation_id (required), project. Returns: object
fetch_observationsB
Fetch observations (spans, generations, events) with filters.
Use observation_type='GENERATION' to get LLM calls specifically. Use trace_id to get all observations within a specific trace.
Inputs: name, page, limit, project, +4 more. Returns: object
fetch_scoresC
Fetch scores/evaluations with optional filters.
Inputs: name, page, limit, project, +3 more. Returns: object
fetch_sessionsB
List sessions with optional time filters.
Inputs: page, limit, project, to_timestamp, +1 more. Returns: object
fetch_traceA
Get FULL details for a single trace including input, output, and all observations.
Use this when you have a trace ID and want to inspect the complete trace. For listing traces, use fetch_traces (returns compact metadata).
Inputs: trace_id (required), project. Returns: object
fetch_tracesA
Fetch traces from Langfuse. Returns compact metadata (no input/output content).
For analytical questions (accuracy, failures, costs), use the analytics tools instead. For user queries, use list_user_queries. For keyword search, use search_trace_content. Use fetch_trace(trace_id) to get full details for a specific trace.
Inputs: name, tags, limit, offset, +6 more. Returns: object
find_exceptionsA
Find observations with error status. Use detect_failures for LLM output quality issues instead.
Inputs: limit, project, to_timestamp, from_timestamp. Returns: object
find_slow_tracesA
Find the slowest traces. Returns actual trace IDs and metadata.
Use this to answer: 'Which traces were slowest?', 'Show me traces taking >30s', 'What's causing high latency today?'.
domain: filter by email domain (e.g. 'acme.com'). If threshold_seconds is set, returns all traces above that threshold. Otherwise returns the top_n slowest traces. group_by: 'name' (agent), 'userId', 'domain'.
Inputs: tags, top_n, domain, project, +5 more. Returns: object
get_annotation_queueB
Get a single annotation queue by ID.
Inputs: queue_id (required), project. Returns: object
get_annotation_queue_itemC
Get a single queue item by ID.
Inputs: item_id (required), queue_id (required), project. Returns: object
get_commentB
Get a single comment by ID.
Inputs: comment_id (required), project. Returns: object
get_daily_metricsA
Fetch Langfuse's pre-aggregated daily metrics rollup.
Returns per-day totals (trace count, cost, token usage) computed by Langfuse server-side. Faster than aggregating traces yourself when you want high-level trends over a long window.
Inputs: tags, project, user_id, to_timestamp, +1 more. Returns: object
get_data_schemaA
Get the data schema for the Langfuse project. Useful for understanding available fields and data types.
Inputs: no named parameters. Returns: object
get_datasetB
Get metadata for a specific dataset.
Inputs: dataset_name (required), project. Returns: object
get_dataset_itemB
Get a single dataset item by ID.
Inputs: item_id (required), project. Returns: object
get_error_countC
Get total error count within a time period.
Inputs: project, to_timestamp, from_timestamp. Returns: object
get_exception_detailsA
Get full exception/error details for a specific trace. Returns the trace with all observations, highlighting errors.
Inputs: trace_id (required), project. Returns: object
get_modelA
Get a single model definition by ID, including pricing and tokenizer config.
Inputs: model_id (required), project. Returns: object
get_promptB
Fetch a specific prompt by name. Optionally specify version or label.
Inputs: name (required), label, project, version. Returns: object
get_prompt_unresolvedA
Fetch a prompt without resolving placeholders or linked dependencies.
Use this for debugging prompt composition (seeing the raw template with
{{variable}} placeholders intact). For production runtime fetches, use
get_prompt which resolves by default.
Inputs: name (required), label, project, version. Returns: object
get_score_v2C
Get a single score by ID via the v2 Scores API.
Inputs: score_id (required), project. Returns: object
get_session_detailsC
Get full details of a session including all its traces.
Inputs: session_id (required), project. Returns: object
get_user_sessionsA
Get sessions for a specific user. Fetches user's traces and extracts unique sessions to understand their interaction history.
Inputs: user_id (required), limit, project, to_timestamp, +1 more. Returns: object
list_annotation_queue_itemsB
List items in an annotation queue. status: PENDING or COMPLETED.
Inputs: queue_id (required), page, limit, status, +1 more. Returns: object
list_annotation_queuesC
List all annotation queues in the project.
Inputs: page, limit, project. Returns: object
list_commentsB
List comments attached to traces, observations, sessions, or prompts.
object_type: 'trace' | 'observation' | 'session' | 'prompt'. object_id requires object_type to also be set.
Inputs: page, limit, project, object_id, +2 more. Returns: object
list_dataset_itemsB
List items in a dataset.
Inputs: dataset_name (required), page, limit, project. Returns: object
list_datasetsC
List all datasets in the project.
Inputs: page, limit, project. Returns: object
list_modelsB
List model definitions in the Langfuse models registry.
Returns both Langfuse-managed models and any custom pricing/tokenizer configs the project has added.
Inputs: page, limit, project. Returns: object
list_projectsA
List all Langfuse projects configured on this server.
Returns the available project names and the default project (used when
a tool call omits the project argument).
Inputs: no named parameters. Returns: object
list_promptsC
List all prompts in the project.
Inputs: name, page, limit, project. Returns: object
list_scores_v2A
List scores using the v2 Scores API. Richer filters than fetch_scores.
trace_tags / score_ids: comma-separated values. operator: comparator used with value (e.g. '>', '>=', '=', '<').
Inputs: name, page, limit, value, +16 more. Returns: object
list_user_queriesA
List user queries extracted from trace inputs.
Use this to answer: 'What are merchants asking?', 'What queries came in today?', 'What did users ask about?', 'Show star insurance queries'. Returns extracted query text with metadata.
domain: filter by email domain (e.g. 'starinsurance.in'). Use this when the user asks about a company/org by name instead of a specific user email. group_by: 'name' (agent), 'userId', 'domain'. Set exclude_internal=true to filter internal team users.
Inputs: name, tags, limit, domain, +7 more. Returns: object
list_usersA
List users in the project with per-user trace counts.
Langfuse does not expose a dedicated /users endpoint — this queries the metrics API (grouping traces by userId) and returns the top users by trace count. Use fetch_traces(user_id=...) for a specific user's traces.
If timestamps are omitted, defaults to the last 30 days.
Inputs: top_n, project, to_timestamp, from_timestamp. Returns: object
score_tracesA
Write scores back to Langfuse traces. trace_ids: comma-separated.
Use this after analysis to annotate traces with findings. Example: score failing traces with 'needs-review'.
Inputs: trace_ids (required), score_name (required), score_value (required), comment, +1 more. Returns: object
search_trace_contentA
Search trace inputs and outputs for keywords.
Use this to answer: 'Find traces mentioning refund', 'Which queries asked about payment failures?', 'Show traces related to order ID X'.
domain: filter by email domain (e.g. 'acme.com'). search_in: 'input', 'output', or 'both' (default). query: keyword or phrase to search for (case-insensitive).
Inputs: query (required), tags, limit, domain, +5 more. Returns: object
update_annotation_queue_itemC
Update a queue item's status. status: PENDING or COMPLETED.
Inputs: status (required), item_id (required), queue_id (required), project. Returns: object
update_prompt_labelsC
Update labels for a specific prompt version. labels: comma-separated.
Inputs: labels (required), version (required), prompt_name (required), project. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 58 tools
Most tools target distinct resource+action pairs, and descriptions contain helpful cross-references (e.g., fetch_traces vs fetch_trace vs search_trace_content). However, fetch_scores and list_scores_v2 both list scores and differ only by API version, and the error-related tools (find_exceptions, get_error_count, get_exception_details) have somewhat fuzzy boundaries that descriptions must work hard to clarify.
Nearly all names follow a verb_noun pattern with descriptive nouns, but the retrieval verbs are used inconsistently: get_prompt/get_dataset/get_model vs fetch_trace/fetch_observations/fetch_sessions for the same kind of operation, and list_scores_v2 sits alongside fetch_scores. The mixed get/fetch/list convention creates avoidable confusion.
58 tools is far above the comfortable range and will strain agent tool-selection accuracy and context budgets. While Langfuse is a broad platform, this surface spans CRUD, analytics, and management concerns that could be split into separate servers or consolidated (e.g., the 10+ analytics tools repeatedly fetch and aggregate traces in overlapping ways).
The surface covers the core Langfuse domains well: traces, sessions, observations, scores (read/write), prompts, datasets, comments, models, and annotation queues, plus a robust analytics layer. Minor gaps exist (no delete for comments/prompts/datasets, no model creation), but these align with Langfuse API constraints and don't create dead ends for common workflows.
Maintenance
Related MCP Connectors
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
A Model Context Protocol server for Wix AI tools
Enable secure connectivity between Sentry issues and debugging data, and LLM clients, using a Model Context Protocol (MCP) server.
Cloud hosted Okahu MCP server that helps you manage genAI trace data
Related MCP Servers
AlicenseAqualityCmaintenanceA Model Context Protocol server that enables LLMs to retrieve and analyze OpenTelemetry traces and metrics from Logfire, supporting exception tracking and custom SQL queries against telemetry data.425,821 PyPI162MIT- AlicenseCqualityAmaintenanceMCP server for Langfuse observability. Query traces, debug exceptions, analyze sessions, and manage prompts and datasets for your LLM applications.483,201 PyPI112MIT
- AlicenseAqualityCmaintenanceComprehensive MCP server for Langfuse, enabling AI assistants to access and manage traces, observations, scores, datasets, and sessions for observability.2415 npm1MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server for comprehensive monitoring and observability of systems using Langfuse.1MIT