Skip to main content
Glama
langfuse-mcp-java

langfuse-mcp-java

by Log-LogN

Langfuse MCP Server — Java / Spring AI

Spring Boot Spring AI Java Lombok

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/mcp

Get 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.public-key

LANGFUSE_PUBLIC_KEY

✅

—

Langfuse project public key

langfuse.secret-key

LANGFUSE_SECRET_KEY

✅

—

Langfuse project secret key

langfuse.host

LANGFUSE_HOST

✅

—

Langfuse base URL, e.g. https://cloud.langfuse.com

langfuse.timeout

LANGFUSE_TIMEOUT

❌

30s

HTTP request timeout — Spring Duration format, e.g. 30s, 1m, 90s

langfuse.read-only

—

❌

true

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 /sse endpoint 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:latest

After the container starts:

Endpoint

URL

Health check

http://localhost:8080/actuator/health

Ping

http://localhost:8080/ping

MCP endpoint

http://localhost:8080/mcp

Langfuse running in another container on the same host:

-e LANGFUSE_HOST=http://host.docker.internal:3000

Tools 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

fetch_traces

Paginated list of traces. Filter by userId, name, sessionId, tags, fromTimestamp, toTimestamp.

fetch_trace

Full detail of a single trace including nested observations, input/output, metadata, latency, and token usage. Requires traceId.

find_exceptions

Traces whose level equals ERROR. Supports time range and pagination.

find_exceptions_in_file

Error-level traces whose metadata contains a given file name substring. Requires fileName.

get_exception_details

Full detail of a single error trace. Requires traceId.

get_error_count

Count of ERROR-level traces in a time range (scans up to 500 traces).

delete_trace

Permanently deletes a single trace by ID. Irreversible.

delete_traces

Permanently deletes multiple traces. Pass a comma-separated list of trace IDs. Irreversible.


Sessions (3 tools)

Tool

Description

fetch_sessions

Paginated list of sessions with optional time range filter.

get_session_details

Full session detail including all its traces. Requires sessionId.

get_user_sessions

All sessions for a specific user with pagination. Requires userId.


Prompts (5 tools)

Tool

Description

list_prompts

Paginated list of all prompts in the project.

get_prompt

Fetch a prompt by name. Optionally pin to a version number or a label (e.g. production, staging).

create_prompt

Create a new prompt or append a new version to an existing prompt. type is text (plain string) or chat (JSON array of {role, content} messages). Supports comma-separated labels and tags.

delete_prompt

Delete prompt versions by name. Scope to a specific label or version; omit both to delete all versions. Irreversible.

update_prompt_labels

Replace the full label set on a specific prompt version. Supply an empty string to remove all labels. The latest label is reserved by Langfuse.


Datasets (7 tools)

Tool

Description

list_datasets

Paginated list of all evaluation datasets.

get_dataset

Fetch a dataset by exact name.

create_dataset

Create a new dataset. Optionally supply description, metadataJson, inputSchemaJson, and expectedOutputSchemaJson (all as JSON strings).

list_dataset_items

Paginated list of items in a dataset. Requires datasetName.

get_dataset_item

Fetch a single dataset item by ID.

create_dataset_item

Create or upsert a dataset item. Optionally link to a sourceTraceId or sourceObservationId. Supports itemId for upsert semantics.

delete_dataset_item

Permanently delete a dataset item by ID. Irreversible.


Dataset Runs (5 tools)

Tool

Description

list_dataset_runs

Paginated list of experiment runs for a dataset. Requires datasetName.

get_dataset_run

Full run detail including all run items. Requires datasetName and runName.

delete_dataset_run

Delete a run and all its items. Irreversible. Requires datasetName and runName.

list_dataset_run_items

Paginated list of items in a run. Requires datasetId and runName.

create_dataset_run_item

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

get_cost_metrics

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

get_scores

Paginated list of evaluation scores. Filter by traceId, observationId, name, dataType (NUMERIC|CATEGORICAL|BOOLEAN), and time range.

get_score

Fetch a single score by ID.

get_score_configs

Paginated list of score config schemas.

get_score_config

Fetch a single score config by ID.

create_score_config

Create a score config. NUMERIC supports optional minValue/maxValue. CATEGORICAL accepts a categoriesJson array of {label, value} objects.

update_score_config

Update an existing score config. Optionally set isArchived to archive it.


Annotation Queues (8 tools)

Tool

Description

list_annotation_queues

Paginated list of annotation queues.

get_annotation_queue

Fetch a single queue by ID.

create_annotation_queue

Create a queue for human-in-the-loop review. Optionally link a scoreConfigId.

list_annotation_queue_items

Paginated list of items in a queue. Optionally filter by status (PENDING|COMPLETED). Requires queueId.

get_annotation_queue_item

Fetch a specific queue item by queueId and itemId.

create_annotation_queue_item

Add a trace, observation, or session to a queue for review. objectType is TRACE, OBSERVATION, or SESSION.

update_annotation_queue_item

Update the status of a queue item (PENDING|COMPLETED).

delete_annotation_queue_item

Remove an item from a queue. Irreversible.


Comments (3 tools)

Tool

Description

get_comments

Paginated list of comments. Optionally filter by objectType (TRACE|OBSERVATION) and objectId.

get_comment

Fetch a single comment by ID.

create_comment

Attach a comment to a trace, observation, session, or prompt. objectType values: TRACE, OBSERVATION, SESSION, PROMPT.


Models (4 tools)

Tool

Description

list_models

Paginated list of all model definitions (Langfuse-managed and custom).

get_model

Fetch a model definition by ID.

create_model

Create a custom model for cost tracking. Requires modelName, matchPattern (regex), and unit (TOKENS|CHARACTERS|MILLISECONDS|SECONDS|IMAGES|REQUESTS). Optionally set per-unit USD prices.

delete_model

Delete a custom model definition. Langfuse-managed models cannot be deleted. Irreversible.


LLM Connections (2 tools)

Tool

Description

list_llm_connections

Paginated list of LLM provider connections (secret keys are masked in the response).

upsert_llm_connection

Create or update a provider connection by provider name (e.g. openai, anthropic, azure, google). Upserts by provider — if a connection already exists it is updated.


Project (1 tool)

Tool

Description

get_projects_for_api_key

Returns the project(s) visible to the configured API key. Useful for confirming credentials and project metadata.


Users (1 tool)

Tool

Description

get_user_traces

All traces for a specific Langfuse user ID with pagination. Requires userId.


Schema (1 tool)

Tool

Description

get_data_schema

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 API

The architecture is strictly layered:

  • client/ — Langfuse integration boundary: HTTP with Basic-Auth (Apache HttpComponents 5), typed exceptions, UriComponentsBuilder for query params

  • service/ — domain logic: filtering, mapping, pagination, error translation into ApiResponse

  • tools/ — MCP surface: agent-friendly descriptions, parameter validation, delegation to services

  • Spring 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

GET

All read operations

POST

Create operations

PATCH

Update operations

DELETE

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 test

Test coverage includes:

  • LangfusePropertiesBindingTest — config binding from application-test.yml and property-level validation

  • PromptWriteServiceImplTest — service logic for prompt create / delete / label update

  • ProjectServiceImplTest — project API response mapping

  • ObservationServiceImplTest — observation fetch and field mapping

  • MetricsServiceImplTest — 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:

  1. LANGFUSE_HOST points to a running Langfuse instance

  2. The host is reachable from the JVM process

  3. For Docker: use host.docker.internal instead of localhost

  4. The scheme matches your server (http:// vs https://)

  5. 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=60s

Agent cannot see the server

  1. Confirm the server is running: curl http://localhost:8080/actuator/health

  2. Confirm the MCP endpoint is reachable: curl http://localhost:8080/ping

  3. Check that the client config URL points to http://localhost:8080/mcp

  4. Inspect 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

License: MIT

Available Tools

55 tools
create_annotation_queuecreate_annotation_queueA
Destructive

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_itemB
Destructive

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_commentA
Destructive

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_datasetB
Destructive

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_itemA
Destructive

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_itemC
Destructive

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_modelC
Destructive

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_promptA
Destructive

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_configA
Destructive

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_itemA
Destructive

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_itemA
Destructive

Deletes a dataset item by its ID. This action is irreversible.

Inputs: itemId (required).

delete_dataset_rundelete_dataset_runA
Destructive

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_modelA
Destructive

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_promptA
Destructive

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_traceA
Destructive

Deletes a single trace by ID. This action is irreversible. traceId is required.

Inputs: traceId (required).

delete_tracesdelete_tracesA
Destructive

Deletes multiple traces in one request. Pass a comma-separated list of trace IDs. This action is irreversible.

Inputs: traceIdsCsv (required).

fetch_sessionsfetch_sessionsC
Destructive

Paginated list of all sessions with optional time range filter. Read-only.

Inputs: page (required), limit (required), fromTimestamp (required), toTimestamp (required).

fetch_tracefetch_traceA
Destructive

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_tracesB
Destructive

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_exceptionsB
Destructive

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_fileB
Destructive

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_queueC
Destructive

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_itemC
Destructive

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_commentC
Destructive

Returns a single comment by its ID. Returns: id, objectType, objectId, content, authorUserId, createdAt, updatedAt. commentId is required.

Inputs: commentId (required).

get_commentsget_commentsB
Destructive

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_metricsA
Destructive

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_schemaA
Destructive

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_datasetC
Destructive

Get a Langfuse dataset by name. Read-only.

Inputs: datasetName (required).

get_dataset_itemget_dataset_itemC
Destructive

Get a single dataset item by ID. Read-only.

Inputs: itemId (required).

get_dataset_runget_dataset_runC
Destructive

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_countA
Destructive

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_detailsA
Destructive

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_modelC
Destructive

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_keyB
Destructive

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_promptB
Destructive

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_scoreC
Destructive

Fetch a single evaluation score by ID. Read-only.

Inputs: scoreId (required).

get_score_configget_score_configC
Destructive

Get a specific score config schema by ID. Read-only.

Inputs: configId (required).

get_score_configsget_score_configsC
Destructive

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_scoresC
Destructive

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_detailsC
Destructive

Full details of one session including all its traces. Read-only.

Inputs: sessionId (required).

get_user_sessionsget_user_sessionsC
Destructive

All sessions for a specific user with pagination. Read-only.

Inputs: userId (required), page (required), limit (required).

get_user_tracesget_user_tracesC
Destructive

All traces for a specific user with pagination. Read-only.

Inputs: userId (required), page (required), limit (required).

list_annotation_queue_itemslist_annotation_queue_itemsC
Destructive

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_queuesB
Destructive

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_itemsC
Destructive

List items in a dataset with pagination. Read-only.

Inputs: datasetName (required), page (required), limit (required).

list_dataset_run_itemslist_dataset_run_itemsB
Destructive

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_runsC
Destructive

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_datasetsC
Destructive

List all evaluation datasets in the Langfuse project. Read-only.

Inputs: page (required), limit (required).

list_llm_connectionslist_llm_connectionsB
Destructive

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_modelsB
Destructive

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_promptsC
Destructive

List all prompts in the Langfuse project with pagination. Read-only.

Inputs: page (required), limit (required).

update_annotation_queue_itemupdate_annotation_queue_itemB
Destructive

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_labelsA
Destructive

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_configC
Destructive

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_connectionC
Destructive

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

    B3.2/5.0

    Scored across 55 tools

    Disambiguation4/5

    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.

    Naming Consistency5/5

    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.

    Tool Count2/5

    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.

    Completeness5/5

    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

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      A
      maintenance
      MCP server for Langfuse observability. Query traces, debug exceptions, analyze sessions, and manage prompts and datasets for your LLM applications.
      48
      3,306 PyPI
      112
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables 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.
      -