SuperAPI AI Directory

langfuse-mcp-java

Query Langfuse traces and observations, debug exceptions, analyze sessions, scores and datasets, and manage prompts.

Open website

About this tool

Purpose: Connect any MCP-compatible AI agent to Langfuse observability data, and use natural language to query traces, debug errors, inspect sessions, manage prompts, run evaluations, annotate data, and configure models.

Key capabilities: Provides 55 tools, covering Traces (8), Sessions (3), Prompts (5), Datasets (7), Dataset Runs (5), Metrics (1), Scores (6), Annotation Queues (8), Comments (3), Models (4), LLM Connections (2), Project (1), Schema (1). All tools return a unified ApiResponse<T> wrapper, and paginated lists use PagedResponse<T>; pagination starts at 1, limit defaults to 20, with some upper limits at 100. The Metrics tool accepts a single required parameter, query, which must be a JSON string conforming to the Metrics API schema.

Usage: Requires Java 21 or later, Maven 3.9+ (or build with Docker, no local Maven required), and a Langfuse account with an API key pair (public-key + secret-key). Credentials are obtained from Langfuse Cloud → Settings → API Keys; for self-hosting, set LANGFUSE_HOST to the instance URL. Configuration is driven by environment variables (locally, application.yml can be used to override). The transport is Streamable HTTP, port 8080, compatible with Cursor, Claude Desktop, VS Code / GitHub Copilot, and any MCP client that supports HTTP transport. The MCP endpoint is /mcp; the legacy SSE /sse endpoint is not used. The Dockerfile is a multi-stage build that compiles the Spring Boot jar inside Docker and runs it on port 8080.

Architecture and limitations: Layered into client/ (HTTP Basic-Auth, typed exceptions), service/ (filtering, mapping, pagination, error conversion), tools/ (MCP interface, parameter validation), Spring Boot (runtime and transport wrapper). Errors are converted into structured ApiResponse.error, and the agent does not see raw stack traces. When testing, set spring.ai.mcp.server.enabled=false. Common issues: TRACE_FETCH_ERROR is mostly a connectivity problem; check LANGFUSE_HOST, reachability, use host.docker.internal under Docker, the protocol scheme, and you can confirm with curl $LANGFUSE_HOST/api/public/health; INVALID_INPUT indicates a missing required parameter; connection timeouts can be resolved by increasing the timeout; if the agent cannot see the server, you can check curl http://localhost:8080/actuator/health and curl http://localhost:8080/ping,并用 npx @modelcontextprotocol/inspector http://localhost:8080/mcp to view tools. Langfuse hosted models cannot be deleted; delete_model only applies to self-built custom models; if you need to override hosted model pricing, you can create a new custom model with the same modelName.