langfuse-mcp-java
The langfuse-mcp-java server connects MCP-compatible AI agents to Langfuse, enabling natural language querying and management of LLM pipeline observability data. It provides 54 tools covering all major Langfuse capabilities — including write operations not available in the official Python version.
Traces & Observations
List, filter (by user, name, session, tags, time), and fetch full trace details including nested observations, input/output, latency, token usage, and cost
Find ERROR-level traces, filter by file name in metadata, and get error counts
Fetch individual observations by ID or filter by type (GENERATION, SPAN, EVENT)
Delete single or multiple traces
Sessions & Users
List sessions with time filters; get full session details including all traces
Retrieve all sessions or traces for a specific user
Prompts
List, fetch (by name, version, or label), create, update labels, and delete prompt versions
Supports text and chat types, versioning, labels (e.g.
production,staging), and tags
Datasets & Runs
List, fetch, create datasets and dataset items; upsert items linked to traces/observations
List, create, and delete dataset runs and run items
Scores & Score Configs
List and fetch scores filtered by trace, observation, name, data type, or time range
Create and update score config schemas (numeric, categorical, boolean)
Annotation Queues
Create and manage human-in-the-loop review queues linked to score configs
Add traces/observations/sessions to queues, update item status, and remove items
Comments
List and fetch comments; attach comments to traces, observations, sessions, or prompts
Models & LLM Connections
List, create, and delete custom model definitions for cost tracking
List and manage LLM provider connections (OpenAI, Anthropic, Azure, Google) with masked secret keys
Project & Schema Introspection
Retrieve project metadata and verify API key access
Fetch the full Langfuse data model schema (entity types, fields, enum values)
Deployment: Runs as a standalone Java 21/Spring Boot application or Docker container, compatible with Cursor, Claude Desktop, VS Code/GitHub Copilot, and any MCP-compatible client.
Langfuse MCP Server — Java / Spring AI
A production-grade MCP server that connects any MCP-compatible AI agent to your Langfuse observability data.
Query traces, debug errors, inspect sessions, manage prompts, run evaluations, annotate data, and configure models — all through natural language.
Transport: Streamable HTTP on port 8080, compatible with Cursor, Claude Desktop, VS Code / GitHub Copilot, and any MCP client that supports HTTP transport.
Why this server?
Capability | This server | Official Langfuse MCP |
Traces & Observations | ✅ | ❌ |
Sessions & Users | ✅ | ❌ |
Exception tracking | ✅ | ❌ |
Prompt management (read + write) | ✅ | ✅ read-only |
Dataset & run management | ✅ | ❌ |
Scores & score configs | ✅ | ❌ |
Annotation queues | ✅ | ❌ |
Comments | ✅ | ❌ |
Model definitions | ✅ | ❌ |
LLM connections | ✅ | ❌ |
Project introspection | ✅ | ❌ |
Schema introspection | ✅ | ❌ |
Java / Spring AI | ✅ | ❌ (Python) |
Related MCP server: Langfuse MCP Server
Prerequisites
Java 21 or later
Maven 3.9+ (or use the Docker build — no local Maven required)
A Langfuse account with an API key pair (
public-key+secret-key)
Quick Start
# 1. Build
mvn clean package -DskipTests
# 2. Set credentials
export LANGFUSE_PUBLIC_KEY=pk-lf-...
export LANGFUSE_SECRET_KEY=sk-lf-...
export LANGFUSE_HOST=https://cloud.langfuse.com
# 3. Run (Streamable HTTP transport — port 8080)
java -jar target/langfuse-mcp-1.0.0.jar
# 4. Verify
curl http://localhost:8080/actuator/health
# 5. Inspect all tools
npx @modelcontextprotocol/inspector http://localhost:8080/mcpGet credentials from Langfuse Cloud → Settings → API Keys.
Self-hosted Langfuse? Set LANGFUSE_HOST to your instance URL.
Configuration
All configuration is driven by environment variables (or application.yml for local overrides).
Property | Env var | Required | Default | Description |
|
| ✅ | — | Langfuse project public key |
|
| ✅ | — | Langfuse project secret key |
|
| ✅ | — | Langfuse base URL, e.g. |
|
| ❌ |
| HTTP request timeout — Spring Duration format, e.g. |
| — | ❌ |
| Informational flag; write operations are available through specific tools |
Trailing slash handling
LANGFUSE_HOST may be specified with or without a trailing slash — the server normalises it automatically.
Client Configuration
Cursor (.cursor/mcp.json)
{
"mcpServers": {
"langfuse": {
"url": "http://localhost:8080/mcp"
}
}
}Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"langfuse": {
"url": "http://localhost:8080/mcp"
}
}
}On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
VS Code / GitHub Copilot
URL mode:
{
"github.copilot.chat.mcp.servers": {
"langfuse": {
"url": "http://localhost:8080/mcp"
}
}
}Command mode (stdio-only clients):
{
"github.copilot.chat.mcp.servers": {
"langfuse": {
"command": "java",
"args": ["-jar", "/absolute/path/to/langfuse-mcp-1.0.0.jar"],
"env": {
"LANGFUSE_PUBLIC_KEY": "pk-lf-...",
"LANGFUSE_SECRET_KEY": "sk-lf-...",
"LANGFUSE_HOST": "https://cloud.langfuse.com"
}
}
}
}Note: The MCP endpoint is
/mcp(streamable HTTP). The legacy SSE/sseendpoint is not used by this server.
Docker
The Dockerfile is a multi-stage build: it compiles the Spring Boot jar inside Docker and runs the MCP server on port 8080. No local Maven installation is needed.
# Build image (compiles inside Docker)
docker build -t langfuse-mcp:latest .
# Run
docker run --rm -p 8080:8080 \
-e LANGFUSE_PUBLIC_KEY=pk-lf-... \
-e LANGFUSE_SECRET_KEY=sk-lf-... \
-e LANGFUSE_HOST=https://cloud.langfuse.com \
langfuse-mcp:latestAfter the container starts:
Endpoint | URL |
Health check |
|
Ping |
|
MCP endpoint |
|
Langfuse running in another container on the same host:
-e LANGFUSE_HOST=http://host.docker.internal:3000Tools Reference (55 total)
Every tool returns a consistent ApiResponse<T> envelope:
{ "success": true, "data": { ... }, "timestamp": "2025-01-15T10:30:00Z" }
{ "success": false, "errorCode": "TRACE_NOT_FOUND", "errorMessage": "...", "timestamp": "..." }Paginated list responses wrap their items in a PagedResponse<T>:
{
"data": [ ... ],
"meta": { "page": 1, "limit": 20, "totalItems": 142, "totalPages": 8 }
}Pagination is 1-based (page defaults to 1). limit defaults to 20 and is capped at 100 where noted. To page through results, increment page while keeping limit fixed.
Traces (8 tools)
Tool | Description |
| Paginated list of traces. Filter by |
| Full detail of a single trace including nested observations, input/output, metadata, latency, and token usage. Requires |
| Traces whose |
| Error-level traces whose metadata contains a given file name substring. Requires |
| Full detail of a single error trace. Requires |
| Count of |
| Permanently deletes a single trace by ID. Irreversible. |
| Permanently deletes multiple traces. Pass a comma-separated list of trace IDs. Irreversible. |
Sessions (3 tools)
Tool | Description |
| Paginated list of sessions with optional time range filter. |
| Full session detail including all its traces. Requires |
| All sessions for a specific user with pagination. Requires |
Prompts (5 tools)
Tool | Description |
| Paginated list of all prompts in the project. |
| Fetch a prompt by name. Optionally pin to a |
| Create a new prompt or append a new version to an existing prompt. |
| Delete prompt versions by name. Scope to a specific |
| Replace the full label set on a specific prompt version. Supply an empty string to remove all labels. The |
Datasets (7 tools)
Tool | Description |
| Paginated list of all evaluation datasets. |
| Fetch a dataset by exact name. |
| Create a new dataset. Optionally supply |
| Paginated list of items in a dataset. Requires |
| Fetch a single dataset item by ID. |
| Create or upsert a dataset item. Optionally link to a |
| Permanently delete a dataset item by ID. Irreversible. |
Dataset Runs (5 tools)
Tool | Description |
| Paginated list of experiment runs for a dataset. Requires |
| Full run detail including all run items. Requires |
| Delete a run and all its items. Irreversible. Requires |
| Paginated list of items in a run. Requires |
| Create a run item linking a dataset item to a trace/observation. Creates the run automatically if it does not yet exist. |
Metrics (1 tool)
Tool | Description |
| Query Langfuse cost, token, latency, and usage analytics via the Metrics API v1. Mirrors: GET /api/public/metrics?query=. Pass the full query as a JSON string. All aggregation is server-side. |
This tool accepts a single required parameter query which must be a JSON-serialised string matching the Metrics API schema. Examples (pass these as a single JSON string):
Total cost last 7 days:
{"view":"traces","metrics":[{"measure":"totalCost","aggregation":"sum"}],"fromTimestamp":"2026-03-18T00:00:00Z","toTimestamp":"2026-03-25T23:59:59Z"}
Daily cost trend this week:
{"view":"traces","metrics":[{"measure":"totalCost","aggregation":"sum"},{"measure":"count","aggregation":"count"}],"timeDimension":{"granularity":"day"},"fromTimestamp":"2026-03-18T00:00:00Z","toTimestamp":"2026-03-25T23:59:59Z"}
Cost by model:
{"view":"observations","dimensions":[{"field":"providedModelName"}],"metrics":[{"measure":"totalCost","aggregation":"sum"},{"measure":"totalTokens","aggregation":"sum"}],"fromTimestamp":"2026-03-18T00:00:00Z","toTimestamp":"2026-03-25T23:59:59Z"}
Cost for a specific user:
{"view":"traces","metrics":[{"measure":"totalCost","aggregation":"sum"}],"filters":[{"column":"userId","operator":"=","value":"user-123","type":"string"}],"fromTimestamp":"2026-03-18T00:00:00Z","toTimestamp":"2026-03-25T23:59:59Z"}
Production environment only:
filters: [{"column":"environment","operator":"=","value":"production","type":"string"}]
Scores (6 tools)
Tool | Description |
| Paginated list of evaluation scores. Filter by |
| Fetch a single score by ID. |
| Paginated list of score config schemas. |
| Fetch a single score config by ID. |
| Create a score config. |
| Update an existing score config. Optionally set |
Annotation Queues (8 tools)
Tool | Description |
| Paginated list of annotation queues. |
| Fetch a single queue by ID. |
| Create a queue for human-in-the-loop review. Optionally link a |
| Paginated list of items in a queue. Optionally filter by |
| Fetch a specific queue item by |
| Add a trace, observation, or session to a queue for review. |
| Update the status of a queue item ( |
| Remove an item from a queue. Irreversible. |
Comments (3 tools)
Tool | Description |
| Paginated list of comments. Optionally filter by |
| Fetch a single comment by ID. |
| Attach a comment to a trace, observation, session, or prompt. |
Models (4 tools)
Tool | Description |
| Paginated list of all model definitions (Langfuse-managed and custom). |
| Fetch a model definition by ID. |
| Create a custom model for cost tracking. Requires |
| Delete a custom model definition. Langfuse-managed models cannot be deleted. Irreversible. |
LLM Connections (2 tools)
Tool | Description |
| Paginated list of LLM provider connections (secret keys are masked in the response). |
| Create or update a provider connection by |
Project (1 tool)
Tool | Description |
| Returns the project(s) visible to the configured API key. Useful for confirming credentials and project metadata. |
Users (1 tool)
Tool | Description |
| All traces for a specific Langfuse user ID with pagination. Requires |
Schema (1 tool)
Tool | Description |
| Returns the full Langfuse data model: all entity types, fields, and valid enum values. Call this first to understand the available data structures before running queries. |
Architecture
MCP Client (Cursor / Claude Desktop / Copilot / other)
│ Streamable HTTP transport (/mcp)
▼
Tool class (@McpTool — validates required params, delegates to service)
▼
Service interface + impl (business logic, filtering, error mapping)
▼
LangfuseApiClient (HTTP gateway — GET / POST / PATCH / DELETE, typed exceptions)
▼
Langfuse Public REST APIThe architecture is strictly layered:
client/— Langfuse integration boundary: HTTP with Basic-Auth (Apache HttpComponents 5), typed exceptions,UriComponentsBuilderfor query paramsservice/— domain logic: filtering, mapping, pagination, error translation intoApiResponsetools/— MCP surface: agent-friendly descriptions, parameter validation, delegation to servicesSpring Boot — runtime and transport wrapper only
API Client
LangfuseApiClient supports four HTTP methods. All methods throw LangfuseApiException or ResourceNotFoundException on error, which the service layer converts into structured ApiResponse.error(...) responses — agents never see raw stack traces.
Method | Used for |
| All read operations |
| Create operations |
| Update operations |
| Delete operations |
Package Structure
com.langfuse.mcp
├── LangfuseMcpApplication.java @SpringBootApplication @ConfigurationPropertiesScan
├── config/
│ ├── LangfuseProperties.java @ConfigurationProperties — publicKey, secretKey, host, timeout, readOnly
│ ├── LangfuseClientConfig.java RestClient bean — Basic-Auth, Apache HttpComponents 5, configurable timeout
│ └── JacksonConfig.java Primary ObjectMapper (JSR310, ignore unknown fields)
├── client/
│ └── LangfuseApiClient.java HTTP gateway (GET/POST/PATCH/DELETE); typed exceptions; UriComponentsBuilder queries
├── controller/
│ └── PingController.java GET /ping → {"status":"ok"}
├── exception/
│ ├── LangfuseApiException.java Wraps HTTP/connectivity errors — statusCode + endpoint
│ └── ResourceNotFoundException.java Thrown on HTTP 404
├── dto/
│ ├── common/ ApiResponse · PagedResponse · PaginationMeta
│ ├── request/ Filter/get request classes (12 classes)
│ └── response/ Response classes (19 classes — JsonNode for open-schema fields)
├── service/ Interfaces (15): Trace · Session · Prompt · PromptWrite · Dataset · DatasetRun
│ │ · Score · AnnotationQueue · Comment · Model · LlmConnection · Project · User · Schema · CostMetrics
│ └── impl/ *ServiceImpl (15) — business logic, filtering, error mapping
├── tools/ @McpTool classes (15) — param validation, delegation, agent-friendly descriptions
│ ├── TraceTools.java (8 tools)
│ ├── SessionTools.java (3 tools)
│ ├── PromptTools.java (2 tools)
│ ├── PromptWriteTools.java (3 tools)
│ ├── DatasetTools.java (7 tools)
│ ├── DatasetRunTools.java (5 tools)
│ ├── ScoreTools.java (6 tools)
│ ├── AnnotationQueueTools.java (8 tools)
│ ├── CommentTools.java (3 tools)
│ ├── ModelTools.java (4 tools)
│ ├── LlmConnectionTools.java (2 tools)
│ ├── ProjectTools.java (1 tool)
│ ├── UserTools.java (1 tool)
│ ├── SchemaTools.java (1 tool)
│ └── CostMetricsTools.java (1 tool)
└── util/
└── JsonPageMapper.java Centralised JSON → PagedResponse mapper (no duplication)Running Tests
mvn testTest coverage includes:
LangfusePropertiesBindingTest— config binding fromapplication-test.ymland property-level validationPromptWriteServiceImplTest— service logic for prompt create / delete / label updateProjectServiceImplTest— project API response mappingObservationServiceImplTest— observation fetch and field mappingMetricsServiceImplTest— metrics aggregation logic
Tests run with spring.ai.mcp.server.enabled=false (set in src/test/resources/application-test.yml) so no MCP transport is started during test execution.
Troubleshooting
TRACE_FETCH_ERROR: HTTP/1.1 header parser received no bytes
Connectivity issue — not a code bug. Check:
LANGFUSE_HOSTpoints to a running Langfuse instanceThe host is reachable from the JVM process
For Docker: use
host.docker.internalinstead oflocalhostThe scheme matches your server (
http://vshttps://)Confirm the API is up:
curl $LANGFUSE_HOST/api/public/health
INVALID_INPUT: <param> is required
A required parameter was not provided. All required = true parameters are validated at the tool layer before any HTTP call is made.
Connection timeouts
Increase the timeout:
export LANGFUSE_TIMEOUT=60sAgent cannot see the server
Confirm the server is running:
curl http://localhost:8080/actuator/healthConfirm the MCP endpoint is reachable:
curl http://localhost:8080/pingCheck that the client config URL points to
http://localhost:8080/mcpInspect all available tools:
npx @modelcontextprotocol/inspector http://localhost:8080/mcp
Langfuse-managed models cannot be deleted
delete_model only works for custom model definitions you have created. To override a Langfuse-managed model's pricing, create a new custom model with the same modelName.
License
Available Tools
55 toolscreate_annotation_queuecreate_annotation_queueADestructive
Creates a new annotation queue for human review workflows. Returns the created queue with its assigned ID. name is required. description and scoreConfigId are optional.
Inputs: name (required), description (required), scoreConfigId (required).
create_annotation_queue_itemcreate_annotation_queue_itemBDestructive
Adds an item to an annotation queue for human review. queueId and objectId are required. objectType can be SESSION, TRACE, or OBSERVATION. status is optional PENDING | COMPLETED.
Inputs: queueId (required), objectId (required), objectType (required), status (required).
create_commentcreate_commentADestructive
Creates a comment attached to a trace, observation, session, or prompt. objectType values: TRACE | OBSERVATION | SESSION | PROMPT. Both objectType and objectId are required along with content. Returns the created comment with its assigned ID.
Inputs: objectType (required), objectId (required), content (required).
create_datasetcreate_datasetBDestructive
Creates a new dataset in Langfuse. name is required. description is optional. metadataJson, inputSchemaJson, and expectedOutputSchemaJson must be valid JSON when provided. Returns the created dataset definition.
Inputs: name (required), description (required), metadataJson (required), inputSchemaJson (required), +1 more.
create_dataset_itemcreate_dataset_itemADestructive
Creates or upserts a dataset item in an existing dataset. datasetName is required. inputJson, expectedOutputJson, and metadataJson must be valid JSON when provided. Optional sourceTraceId or sourceObservationId can link the item back to Langfuse data.
Inputs: datasetName (required), inputJson (required), expectedOutputJson (required), metadataJson (required), +4 more.
create_dataset_run_itemcreate_dataset_run_itemCDestructive
Creates a dataset run item and creates or updates the dataset run if needed. runName and datasetItemId are required. traceId is strongly recommended and observationId is optional. metadataJson must be valid JSON when provided.
Inputs: runName (required), datasetItemId (required), traceId (required), observationId (required), +4 more.
create_modelcreate_modelCDestructive
Creates a custom model definition for cost tracking and token pricing. modelName, matchPattern, and unit are required. unit values: TOKENS | CHARACTERS | MILLISECONDS | SECONDS | IMAGES | REQUESTS. Prices are per unit in USD (e.g. inputPrice=0.000001 means $1 per million tokens). Omit prices for models where you do not want cost tracking. startDate format: ISO-8601 date, e.g. 2025-01-01T00:00:00Z.
Inputs: modelName (required), matchPattern (required), unit (required), inputPrice (required), +2 more.
create_promptcreate_promptADestructive
Creates a new version of a prompt. If the prompt name does not exist, a new prompt is created. If it does exist, a new version is appended. type values: text (plain string prompt) | chat (array of message objects). For text prompts, provide prompt as a plain string. For chat prompts, provide prompt as a JSON array of message objects with role and content fields. labels examples: production, staging, latest. The 'latest' label is managed by Langfuse automatically. Returns the created prompt version with its assigned version number. name, type, and prompt are required.
Inputs: name (required), type (required), prompt (required), labels (required), +1 more.
create_score_configcreate_score_configADestructive
Creates a score config definition used to validate or structure future scores. name and dataType are required. For categorical configs, categoriesJson should be a JSON array of {label,value} objects. For numeric configs, minValue and maxValue are optional bounds.
Inputs: name (required), dataType (required), categoriesJson (required), minValue (required), +2 more.
delete_annotation_queue_itemdelete_annotation_queue_itemADestructive
Removes an item from an annotation queue. This action is irreversible. Both queueId and itemId are required.
Inputs: queueId (required), itemId (required).
delete_dataset_itemdelete_dataset_itemADestructive
Deletes a dataset item by its ID. This action is irreversible.
Inputs: itemId (required).
delete_dataset_rundelete_dataset_runADestructive
Deletes a dataset run and all its run items. This action is irreversible. Use this to clean up experiment runs you no longer need. Both datasetName and runName are required.
Inputs: datasetName (required), runName (required).
delete_modeldelete_modelADestructive
Deletes a custom model definition by ID. Note: Langfuse-managed models cannot be deleted. Only custom models you created can be deleted. To override a Langfuse-managed model, create a new custom model with the same modelName instead. modelId is required. This action is irreversible.
Inputs: modelId (required).
delete_promptdelete_promptADestructive
Deletes prompt versions by name. Behaviour depends on which filters are supplied:
Omit both label and version: deletes ALL versions of the prompt.
Supply label only: deletes all versions carrying that label.
Supply version only: deletes that specific version number. promptName is required. This action is irreversible.
Inputs: promptName (required), label (required), version (required).
delete_tracedelete_traceADestructive
Deletes a single trace by ID. This action is irreversible. traceId is required.
Inputs: traceId (required).
delete_tracesdelete_tracesADestructive
Deletes multiple traces in one request. Pass a comma-separated list of trace IDs. This action is irreversible.
Inputs: traceIdsCsv (required).
fetch_sessionsfetch_sessionsCDestructive
Paginated list of all sessions with optional time range filter. Read-only.
Inputs: page (required), limit (required), fromTimestamp (required), toTimestamp (required).
fetch_tracefetch_traceADestructive
Returns the full detail of a single Langfuse trace identified by its ID.
The response includes all observations (spans, generations, events) nested under the trace, as well as input/output payloads, metadata, tags, latency, and token usage.
Use this after fetch_traces to drill into a specific trace. The traceId is required.
Inputs: traceId (required).
fetch_tracesfetch_tracesBDestructive
Returns a paginated list of Langfuse traces.
Each trace represents one end-to-end LLM pipeline execution. The response includes: id, name, userId, sessionId, level (DEFAULT | DEBUG | WARNING | ERROR), latency (seconds), totalTokens, totalCost (USD), tags, timestamp.
All filter parameters are optional. Omit any filter you do not need — omitted filters are ignored and do not narrow the result set.
Pagination: page is 1-based (default 1), limit controls page size (default 20, max 100). To page through results, increment page while keeping limit fixed.
Inputs: page (required), limit (required), userId (required), name (required), +4 more.
find_exceptionsfind_exceptionsBDestructive
Returns only traces whose level field equals ERROR.
Filtering is performed on the server before the response is returned — the result set contains error traces only, never a mix of levels.
Useful for surfacing pipeline failures and debugging production errors. Both time range parameters are optional. Omit them to search across all time. Pagination works the same way as fetch_traces.
Inputs: page (required), limit (required), fromTimestamp (required), toTimestamp (required).
find_exceptions_in_filefind_exceptions_in_fileBDestructive
Returns ERROR-level traces whose metadata contains the given file name as a substring.
Both conditions must be true for a trace to appear in the result: (1) the trace level is ERROR, and (2) the trace metadata JSON contains the fileName string anywhere inside it.
Use this to isolate errors originating from a specific source file. fileName is required. Both time range parameters are optional — omit them to search across the full project history.
Inputs: fileName (required), fromTimestamp (required), toTimestamp (required).
get_annotation_queueget_annotation_queueCDestructive
Returns a single annotation queue by its ID. Returns: id, name, description, scoreConfigId, projectId, createdAt, updatedAt. queueId is required.
Inputs: queueId (required).
get_annotation_queue_itemget_annotation_queue_itemCDestructive
Returns a specific item from an annotation queue by queue ID and item ID. Returns: id, queueId, traceId, observationId, status, annotatorUserId, completedAt. Both queueId and itemId are required.
Inputs: queueId (required), itemId (required).
get_commentget_commentCDestructive
Returns a single comment by its ID. Returns: id, objectType, objectId, content, authorUserId, createdAt, updatedAt. commentId is required.
Inputs: commentId (required).
get_commentsget_commentsBDestructive
List comments filtered by objectType and objectId. objectType values: TRACE | OBSERVATION. Returns: id, objectType, objectId, content, authorUserId, createdAt. Read-only.
Inputs: objectType (required), objectId (required), page (required), limit (required).
get_cost_metricsget_cost_metricsADestructive
Query Langfuse cost, token, latency, and usage analytics via the Metrics API. Mirrors: GET /api/public/metrics?query=
Pass the full query as a JSON string. All aggregation is server-side.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ QUERY STRUCTURE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ { "view": string, // REQUIRED. traces | observations | scores-numeric | scores-categorical "metrics": [...], // REQUIRED. At least one { measure, aggregation, alias? } "fromTimestamp": string, // REQUIRED. ISO-8601 e.g. "2026-03-18T00:00:00Z" "toTimestamp": string, // REQUIRED. ISO-8601 e.g. "2026-03-25T23:59:59Z" "dimensions": [...], // Optional. [{ "field": "..." }] "filters": [...], // Optional. [{ "column", "operator", "value", "type", "key"? }] "timeDimension": {...}, // Optional. { "granularity": "hour|day|week|month|auto" } "config": {...} // Optional. { "bins": 10, "row_limit": 100 } }
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ VIEW ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ traces → end-to-end cost, tokens, latency per request observations → per LLM call; USE for model breakdowns (providedModelName) scores-numeric → numeric/boolean evaluation scores scores-categorical → categorical evaluation scores
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ MEASURES (by view) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ traces: count | observationsCount | scoresCount | latency | totalTokens | totalCost observations: count | latency | totalTokens | totalCost | timeToFirstToken | countScores scores-numeric: count | value scores-categorical: count ⚠ NEVER use inputTokens / outputTokens / promptTokens / completionTokens → 400 error. Use totalTokens.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ AGGREGATIONS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ sum | avg | count | max | min | p50 | p75 | p90 | p95 | p99 sum → cost/token totals avg/p95/p99 → latency count → record counts
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ DIMENSIONS (group-by, by view) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ traces: name | tags | userId | sessionId | release | version | environment | observationName | scoreName observations: providedModelName | type | name | level | version | environment | userId | sessionId | traceName | traceRelease | traceVersion | promptName | promptVersion | scoreName ⚠ HIGH CARDINALITY — use in filters only, not dimensions: id | traceId | observationId
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ FILTERS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Each filter: { "column", "operator", "value", "type", "key"? } type string/stringObject/boolean → operator: = | contains | does not contain | starts with | ends with type number/datetime → operator: = | < | > | <= | >= ⚠ NEVER use != / not_contains / not_equals for string fields → 400 error.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ EXAMPLES ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Total cost last 7 days: {"view":"traces","metrics":[{"measure":"totalCost","aggregation":"sum"}], "fromTimestamp":"2026-03-18T00:00:00Z","toTimestamp":"2026-03-25T23:59:59Z"}
Daily cost trend this week: {"view":"traces","metrics":[{"measure":"totalCost","aggregation":"sum"},{"measure":"count","aggregation":"count"}], "timeDimension":{"granularity":"day"}, "fromTimestamp":"2026-03-18T00:00:00Z","toTimestamp":"2026-03-25T23:59:59Z"}
Cost by model: {"view":"observations","dimensions":[{"field":"providedModelName"}], "metrics":[{"measure":"totalCost","aggregation":"sum"},{"measure":"totalTokens","aggregation":"sum"}], "fromTimestamp":"2026-03-18T00:00:00Z","toTimestamp":"2026-03-25T23:59:59Z"}
Cost for a specific user: {"view":"traces","metrics":[{"measure":"totalCost","aggregation":"sum"}], "filters":[{"column":"userId","operator":"=","value":"user-123","type":"string"}], "fromTimestamp":"2026-03-18T00:00:00Z","toTimestamp":"2026-03-25T23:59:59Z"}
Production environment only: filters: [{"column":"environment","operator":"=","value":"production","type":"string"}]
Inputs: query (required).
get_data_schemaget_data_schemaADestructive
Returns the Langfuse data model schema: all entity types, fields, and valid enum values. Call this first before running any query to understand the available data structures. Read-only.
Inputs: no named parameters.
get_datasetget_datasetCDestructive
Get a Langfuse dataset by name. Read-only.
Inputs: datasetName (required).
get_dataset_itemget_dataset_itemCDestructive
Get a single dataset item by ID. Read-only.
Inputs: itemId (required).
get_dataset_runget_dataset_runCDestructive
Returns a single dataset run including all its run items. Each run item links a dataset item to a trace and optional observation. Returns: id, name, datasetName, metadata, createdAt, updatedAt, datasetRunItems[]. Both datasetName and runName are required.
Inputs: datasetName (required), runName (required).
get_error_countget_error_countADestructive
Returns the total count of ERROR-level traces within the specified time range.
The server scans up to 500 traces (5 pages of 100) and counts those with level=ERROR. The response contains errorCount, fromTimestamp, and toTimestamp.
Both time range parameters are optional. Omit them to count errors across all time. Use this for a quick health signal before drilling into individual traces with find_exceptions.
Inputs: fromTimestamp (required), toTimestamp (required).
get_exception_detailsget_exception_detailsADestructive
Returns the full detail of a single ERROR-level trace identified by its ID.
Equivalent to fetch_trace but semantically scoped to error traces. Use this after find_exceptions to inspect a specific failure in depth — the response includes all nested observations, input/output, metadata, and timing.
The traceId is required.
Inputs: traceId (required).
get_modelget_modelCDestructive
Returns a single model definition by its ID. Returns: id, modelName, matchPattern, unit, inputPrice, outputPrice, totalPrice, startDate, tokenizerId, isLangfuseManaged, projectId. modelId is required.
Inputs: modelId (required).
get_projects_for_api_keyget_projects_for_api_keyBDestructive
Returns the project or projects visible to the currently configured API key. With a project-scoped key this normally returns one project. With broader credentials, use this to confirm which project metadata is available.
Inputs: no named parameters.
get_promptget_promptBDestructive
Fetch a specific prompt by name. Optionally pin to a version number or a label (e.g. 'production', 'staging'). Returns: name, version, type (text|chat), prompt content, labels, tags, config. Read-only.
Inputs: name (required), version (required), label (required).
get_scoreget_scoreCDestructive
Fetch a single evaluation score by ID. Read-only.
Inputs: scoreId (required).
get_score_configget_score_configCDestructive
Get a specific score config schema by ID. Read-only.
Inputs: configId (required).
get_score_configsget_score_configsCDestructive
List all score config schemas. Configs define constraints for NUMERIC (min/max), CATEGORICAL (allowed categories), or BOOLEAN scores. Read-only.
Inputs: page (required), limit (required).
get_scoresget_scoresCDestructive
List evaluation scores with optional filters. dataType values: NUMERIC | CATEGORICAL | BOOLEAN. Returns: id, traceId, observationId, name, value, dataType, comment, source. Read-only.
Inputs: page (required), limit (required), traceId (required), observationId (required), +4 more.
get_session_detailsget_session_detailsCDestructive
Full details of one session including all its traces. Read-only.
Inputs: sessionId (required).
get_user_sessionsget_user_sessionsCDestructive
All sessions for a specific user with pagination. Read-only.
Inputs: userId (required), page (required), limit (required).
get_user_tracesget_user_tracesCDestructive
All traces for a specific user with pagination. Read-only.
Inputs: userId (required), page (required), limit (required).
list_annotation_queue_itemslist_annotation_queue_itemsCDestructive
Returns items in a specific annotation queue, optionally filtered by status. status values: PENDING | COMPLETED. Omit status to return all items regardless of status. Each item contains: id, queueId, traceId, observationId, status, annotatorUserId, completedAt. queueId is required.
Inputs: queueId (required), status (required), page (required), limit (required).
list_annotation_queueslist_annotation_queuesBDestructive
Returns a paginated list of annotation queues in the Langfuse project. Each queue contains: id, name, description, scoreConfigId, projectId, createdAt, updatedAt. Annotation queues are used for human-in-the-loop review workflows. Pagination: page is 1-based (default 1), limit controls page size (default 20).
Inputs: page (required), limit (required).
list_dataset_itemslist_dataset_itemsCDestructive
List items in a dataset with pagination. Read-only.
Inputs: datasetName (required), page (required), limit (required).
list_dataset_run_itemslist_dataset_run_itemsBDestructive
Returns a paginated list of items in a specific dataset run. Each run item links a dataset item to a trace and optional observation for evaluation. Returns: id, datasetRunId, datasetRunName, datasetItemId, traceId, observationId, createdAt. Both datasetId and runName are required.
Inputs: datasetId (required), runName (required), page (required), limit (required).
list_dataset_runslist_dataset_runsCDestructive
Returns a paginated list of runs for a specific dataset. Each run represents one experiment executed against a dataset. Returns: id, name, datasetId, datasetName, metadata, createdAt, updatedAt. datasetName is required. Pagination: page 1-based (default 1), limit (default 20).
Inputs: datasetName (required), page (required), limit (required).
list_datasetslist_datasetsCDestructive
List all evaluation datasets in the Langfuse project. Read-only.
Inputs: page (required), limit (required).
list_llm_connectionslist_llm_connectionsBDestructive
Returns a paginated list of LLM provider connections configured in the Langfuse project. Each connection contains: id, provider, displaySecretKey (masked), baseURL, config. LLM connections define the provider credentials used by Langfuse for evaluations and playground. Pagination: page is 1-based (default 1), limit controls page size (default 20).
Inputs: page (required), limit (required).
list_modelslist_modelsBDestructive
Returns a paginated list of all models in the Langfuse project, including both Langfuse-managed models and custom models you have defined. Each model contains: id, modelName, matchPattern, unit, inputPrice, outputPrice, totalPrice, startDate, tokenizerId, isLangfuseManaged. Pagination: page is 1-based (default 1), limit controls page size (default 20).
Inputs: page (required), limit (required).
list_promptslist_promptsCDestructive
List all prompts in the Langfuse project with pagination. Read-only.
Inputs: page (required), limit (required).
update_annotation_queue_itemupdate_annotation_queue_itemBDestructive
Updates the status of an annotation queue item. status values: PENDING | COMPLETED. Both queueId and itemId are required.
Inputs: queueId (required), itemId (required), status (required).
update_prompt_labelsupdate_prompt_labelsADestructive
Replaces the labels on a specific prompt version. newLabels completely replaces the existing label set on that version. The 'latest' label is reserved and managed by Langfuse — do not include it. Both promptName and version are required. newLabels is required — supply an empty string to remove all labels from this version.
Inputs: promptName (required), version (required), newLabels (required).
update_score_configupdate_score_configCDestructive
Updates an existing score config. configId is required. Provide only the fields you want to change. categoriesJson must be a JSON array of {label,value} objects when supplied.
Inputs: configId (required), name (required), categoriesJson (required), minValue (required), +3 more.
upsert_llm_connectionupsert_llm_connectionCDestructive
Creates or updates an LLM provider connection (upserted by provider name). If a connection for the given provider already exists, it is updated. provider and secretKey are required. provider examples: openai, anthropic, azure, google.
Inputs: provider (required), secretKey (required), adapter (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 55 tools
Most tools are clearly distinct by resource and action, such as create_annotation_queue vs. get_annotation_queue. However, some overlap exists in read operations like fetch_trace and get_exception_details, which both retrieve trace details but with different filters, potentially causing confusion. The descriptions help clarify, but the sheer number of tools (55) increases the risk of misselection.
Tool names follow a highly consistent verb_noun pattern throughout, such as create_annotation_queue, get_annotation_queue, list_annotation_queues, and update_annotation_queue_item. All tools use snake_case without deviation, making the naming predictable and easy to understand. This consistency aids in agent navigation and reduces cognitive load.
With 55 tools, the count is excessive for an MCP server, far beyond the typical well-scoped range of 3-15 tools. This large number suggests over-fragmentation, such as having separate tools for fetch_trace and get_exception_details, which could be consolidated. It will likely overwhelm agents and increase complexity unnecessarily.
The tool set provides comprehensive CRUD and lifecycle coverage for the Langfuse domain, including traces, sessions, datasets, prompts, models, scores, annotation queues, and LLM connections. There are no obvious gaps; every major resource has create, read, update, and delete operations, along with specialized tools for analytics and filtering, ensuring agents can handle full workflows without dead ends.
Maintenance
Related MCP Connectors
Query your AI agent traces, root-cause verdicts and issues, and run investigations, from your agent.
Query your AI agents' traces, errors, cost and alerts in Rius, the agent observability platform.
Observability for AI apps: investigate traces, logs, LLM usage, replays and crashes; manage alerts.
Query Honeycomb observability data: traces, events, metrics, SLOs, triggers, and boards.
Related MCP Servers
- AlicenseCqualityAmaintenanceMCP server for Langfuse observability. Query traces, debug exceptions, analyze sessions, and manage prompts and datasets for your LLM applications.483,306 PyPI112MIT
- FlicenseNot gradedqualityAmaintenanceEnables AI agents and MCP clients to query Langfuse trace data for debugging and observability, with tools for traces, sessions, exceptions, routing decisions, prompts, datasets, scores, and metrics.-
- FlicenseNot gradedqualityAmaintenanceEnables AI agents to query and debug Langfuse trace data, including traces, sessions, exceptions, route decisions, prompts, datasets, and metrics, for enhanced debugging and observability.-
- FlicenseNot gradedqualityAmaintenanceEnables AI agents and developers to query Langfuse trace data for debugging and observability, including traces, sessions, exceptions, route decisions, prompts, datasets, and metrics. Supports local stdio/HTTP access through MCP clients with selective tool loading and read-only mode.-