About langfuse
langfuse is a read-only MCP server for inspecting Langfuse traces and observations. It supports filtering and detailed analysis of nested trace data, including model usage, costs, and latency; large fields are saved to temporary files with searchable references.
Key features
- 01Filter traces by metadata
- 02Inspect nested traces and scores
- 03Filter observations by type and model
- 04Retrieve observation inputs and outputs
- 05Save oversized fields to temporary files
- 06Read-only access
Use cases
- 01Debug LLM pipelines using trace details
- 02Analyze model costs and latency
- 03Search large prompts and completions
MCP support
It exposes tools for listing and inspecting Langfuse traces and observations, plus a `langfuse://config` resource. MCP clients can use the read-only interface to analyze trace data.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
npx -y langfuse-observability-mcp-serverLANGFUSE_SECRET_KEYSecretLangfuse secret key for authentication.LANGFUSE_PUBLIC_KEYSecretLangfuse public key for authentication.LANGFUSE_BASE_URLLangfuse API base URL.Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.
Tools
4Saved tool list · updated 2w ago
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | No | Filter by trace name (exact match). |
| page | number | No | Page number (starts at 1). Default: 1. |
| tags | array | No | Filter to traces containing ALL specified tags. Example: ["production", "important"]. |
| limit | number | No | Number of traces per page (1-100). Default: 10. Use smaller values to reduce response size. |
| userId | string | No | Filter by user ID associated with traces. |
| orderBy | string | No | Sort order as "field.direction". Fields: id, timestamp, name, userId, release, version, public, bookmarked, sessionId. Direction: asc, desc. Example: "timestamp.desc". |
| release | string | No | Filter by release version string. |
| version | string | No | Filter by trace version string. |
| sessionId | string | No | Filter by session ID. |
| environment | array | No | Filter by environment(s). Example: ["production", "staging"]. |
| toTimestamp | string | No | Only include traces created before this ISO 8601 datetime. Example: "2025-02-01T00:00:00Z". |
| fromTimestamp | string | No | Only include traces created on or after this ISO 8601 datetime. Example: "2025-01-01T00:00:00Z". |
Details
From the project READMELangfuse MCP Server
MCP server for readonly analysis of Langfuse LLM traces and observations. Designed to help agents deeply inspect trace data, debug LLM pipelines, and analyze costs and latency.
Highlights
- Browse and filter traces by name, user, session, tags, timestamps, and environment
- Drill into full trace details including all nested observations and scores
- List and filter observations by type (GENERATION, SPAN, EVENT), model, level, and more
- Automatic truncation of large payloads (>1000 chars) to /tmp files with grep-friendly references
- Read-only — no write operations, safe to use without risk of data modification
Capabilities
Tools
| Tool | Description |
|---|---|
get_traces | List traces with filtering and pagination. Returns minimal summary (no I/O fields). |
get_trace_detail | Get full trace by ID including observations, scores, input/output, and metadata. |
get_observations | List observations with filtering by traceId, type, level, etc. Returns minimal summary. |
get_observation | Get full observation by ID including input, output, model parameters, usage, and cost details. |
Resources
| Resource | Description |
|---|---|
langfuse://config | Server configuration and status (for debugging) |
Large Payload Handling
Trace and observation data often contains very large input/output fields (full prompts, completions, etc.). This server automatically:
- Truncates any string field longer than 1000 characters
- Saves the full content to a
/tmp/langfuse_*.txtfile - Includes the file path in the truncated output
Agents can then use grep to search within these files for specific content without loading the entire payload into context.
Configuration
Environment Variables
| Variable | Required | Description | Default |
|---|---|---|---|
LANGFUSE_SECRET_KEY | Yes | Langfuse secret key (sk-lf-...) | - |
LANGFUSE_PUBLIC_KEY | Yes | Langfuse public key (pk-lf-...) | - |
LANGFUSE_BASE_URL | No | Langfuse API base URL | https://cloud.langfuse.com |
Claude Desktop Configuration
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"langfuse": {
"command": "npx",
"args": ["-y", "langfuse-observability-mcp-server"],
"env": {
"LANGFUSE_SECRET_KEY": "sk-lf-your-secret-key",
"LANGFUSE_PUBLIC_KEY": "pk-lf-your-public-key",
"LANGFUSE_BASE_URL": "https://us.cloud.langfuse.com"
}
}
}
}
Development
# Install dependencies
npm run install-all
# Build
npm run build
# Development mode
npm run dev
# Run functional tests
npm test
# Run integration tests
npm run test:integration
# Run manual tests (requires .env with real credentials)
npm run test:manual
License
MIT
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.