Langfuse MCP logo

Langfuse MCP

by hugoles

TypeScript MCP server exposing Langfuse Public API for querying traces, observations, sessions, scores, prompts, datasets, and metrics.

Install Langfuse MCP

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "hugoles-langfuse-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "langfuse-mcp"
      ],
      "env": {
        "LANGFUSE_PUBLIC_KEY": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

npx -y langfuse-mcp

No response to initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked 1mo ago.

Overview

This MCP server wraps the Langfuse Public API, providing read-only access to various Langfuse resources such as traces, observations, sessions, scores, prompts, datasets, and metrics. It enables AI agents to query detailed telemetry and evaluation data during conversations without leaving the assistant interface. Use it when you want programmatic, conversational access to Langfuse monitoring and evaluation data.

Use cases

  • Query trace details including full observation trees
  • List recent traces filtered by error level or user
  • Summarize daily generation costs broken down by model
  • Fetch specific prompt versions or labels
  • Retrieve dataset items and evaluation run details

Key features

  • Read-only tools for traces, observations, sessions, and scores
  • Prompt management with version and label filtering
  • Dataset and dataset run listing and retrieval
  • Custom metrics queries and daily aggregated metrics
  • Model and project listing with cost and token attribution
  • Health check endpoint for credential validation

Tools27

What Langfuse MCP lets your agent do. Expand a tool for its parameters.

Self-reported~403 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked 3d ago

Recent health check succeeded.

19/19 checks healthy over the last 80d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 10d ago via OSV.dev · langfuse-mcp (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars1Stargazers on the source repository.
npm downloads480Package downloads in the last 30 days.
Last commit4mo agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.
Tools exposed27Callable tools this server registers over MCP.
Directory activity6 viewsConfig copies, upvotes, and views on AllMCPs.

From the project README

langfuse-mcp

npm version npm downloads CI Node License: MIT

An MCP server that exposes the Langfuse REST API as tools, so Claude (or any MCP client) can query your traces, observations, sessions, scores, prompts, datasets, and metrics during a conversation.

Useful when you want to ask things like:

  • "Why did trace abc123 fail? Walk me through its observations."
  • "List the 5 most recent traces with level=ERROR for user alice@x.com."
  • "Summarize today's generation cost broken down by model."
  • "Show me the production version of prompt customer-support-v2."

…without leaving your assistant.

Requirements

Tools

All tools are read-only and call the Langfuse Public API over HTTPS using your project keys for Basic Auth.

Traces & observations

ToolDescription
listTracesList traces with filters. Returns summary metadata.
getTraceFetch a single trace by id including the full observation tree.
listObservationsList spans, generations, and events with filters.
getObservationFetch a single observation by id.

Sessions

ToolDescription
listSessionsList sessions within a time range.
getSessionFetch a session by id, including its traces.

Scores

ToolDescription
listScoresList scores with filters.
getScoreFetch a single score by id.
listScoreConfigsList score configurations (definitions, ranges, categories).
getScoreConfigFetch a score configuration by id.

Prompts

ToolDescription
listPromptsList prompt definitions, optionally filtered by name, label, or tag.
getPromptFetch a prompt by name, optionally pinned to a specific version or label.

Datasets

ToolDescription
listDatasetsList datasets configured in Langfuse.
getDatasetFetch a dataset by name.
listDatasetItemsList items in a dataset (inputs, expected outputs, metadata).
getDatasetItemFetch a single dataset item by id.
listDatasetRunsList evaluation runs for a dataset.
getDatasetRunFetch a specific dataset run by name.

Metrics, models & misc

ToolDescription
getMetricsRun a custom metrics query (counts, latency, cost, token usage). Pass a JSON query string.
getDailyMetricsDaily aggregated usage / cost / count metrics.
listModelsList models known to Langfuse (for cost / token attribution).
getModelFetch a model definition by id.
listProjectsList projects accessible to the current API key.
listCommentsList comments attached to traces, observations, sessions, or prompts.
getCommentFetch a single comment by id.
getMediaFetch metadata for a media attachment (image, audio, file).
getHealthPing the Langfuse public health endpoint — useful for credential validation.

Install

Zero install with npx:

Terminal
npx -y langfuse-mcp

Or install globally:

Terminal
npm i -g langfuse-mcp
langfuse-mcp --version

Configuration

The server reads three environment variables:

VariableRequiredDescription
LANGFUSE_PUBLIC_KEYyesProject public key (pk-lf-…).
LANGFUSE_SECRET_KEYyesProject secret key (sk-lf-…).
LANGFUSE_BASE_URLyese.g. https://cloud.langfuse.com (EU) or https://us.cloud.langfuse.com (US) or your self-hosted URL.
LANGFUSE_ENV_FILEnoOptional path to a .env file to load instead of ./.env.

Where do I get my keys? In the Langfuse UI: Settings → API Keys → Create new API keys. Keys are scoped to a single project and a single region (EU vs US are separate accounts — match your LANGFUSE_BASE_URL to the region you created the keys in).

If a .env file exists in the working directory it will be loaded automatically. See .env.example for a starter file.

Use with Claude Desktop

Edit claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
config.json
{
  "mcpServers": {
    "langfuse": {
      "command": "npx",
      "args": ["-y", "langfuse-mcp"],
      "env": {
        "LANGFUSE_PUBLIC_KEY": "pk-lf-…",
        "LANGFUSE_SECRET_KEY": "sk-lf-…",
        "LANGFUSE_BASE_URL": "https://cloud.langfuse.com"
      }
    }
  }
}

Restart Claude Desktop after editing. The MCP server icon should appear in the chat input.

Use with Claude Code

Project-level (./.mcp.json):

config.json
{
  "mcpServers": {
    "langfuse": {
      "command": "npx",
      "args": ["-y", "langfuse-mcp"],
      "env": {
        "LANGFUSE_PUBLIC_KEY": "pk-lf-…",
        "LANGFUSE_SECRET_KEY": "sk-lf-…",
        "LANGFUSE_BASE_URL": "https://cloud.langfuse.com"
      }
    }
  }
}

User-level config lives at ~/.claude.json and uses the same shape.

Use with Cursor

Project-level: .cursor/mcp.json. User-level: ~/.cursor/mcp.json.

config.json
{
  "mcpServers": {
    "langfuse": {
      "command": "npx",
      "args": ["-y", "langfuse-mcp"],
      "env": {
        "LANGFUSE_PUBLIC_KEY": "pk-lf-…",
        "LANGFUSE_SECRET_KEY": "sk-lf-…",
        "LANGFUSE_BASE_URL": "https://cloud.langfuse.com"
      }
    }
  }
}

Use with Cline (VS Code)

In VS Code settings (settings.json):

config.json
{
  "cline.mcpServers": {
    "langfuse": {
      "command": "npx",
      "args": ["-y", "langfuse-mcp"],
      "env": {
        "LANGFUSE_PUBLIC_KEY": "pk-lf-…",
        "LANGFUSE_SECRET_KEY": "sk-lf-…",
        "LANGFUSE_BASE_URL": "https://cloud.langfuse.com"
      }
    }
  }
}

Use with Continue

In ~/.continue/config.json:

config.json
{
  "mcpServers": [
    {
      "name": "langfuse",
      "command": "npx",
      "args": ["-y", "langfuse-mcp"],
      "env": {
        "LANGFUSE_PUBLIC_KEY": "pk-lf-…",
        "LANGFUSE_SECRET_KEY": "sk-lf-…",
        "LANGFUSE_BASE_URL": "https://cloud.langfuse.com"
      }
    }
  ]
}

Use with Windsurf

In Windsurf's MCP settings, add:

config.json
{
  "mcpServers": {
    "langfuse": {
      "command": "npx",
      "args": ["-y", "langfuse-mcp"],
      "env": {
        "LANGFUSE_PUBLIC_KEY": "pk-lf-…",
        "LANGFUSE_SECRET_KEY": "sk-lf-…",
        "LANGFUSE_BASE_URL": "https://cloud.langfuse.com"
      }
    }
  }
}

Use with any other MCP client

The server speaks MCP over stdio. Any MCP client can launch it as a subprocess:

bash
LANGFUSE_PUBLIC_KEY=pk-lf-… \
LANGFUSE_SECRET_KEY=sk-lf-… \
LANGFUSE_BASE_URL=https://cloud.langfuse.com \
npx -y langfuse-mcp

Try it

Once wired up, ask your assistant things like:

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Langfuse MCP

It requires a Langfuse project API key used as Basic Auth for the Langfuse Public API.

No, all exposed tools are read-only and only fetch data from Langfuse.

LANGFUSE_PUBLIC_KEY is required to authenticate requests to Langfuse.

Node.js version 20 or newer is required.

You can run it directly with 'npx -y langfuse-mcp' or install globally via npm.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewLangfuse MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/hugoles-langfuse-mcp?style=directory)](https://allmcps.com/mcp/hugoles-langfuse-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/hugoles-langfuse-mcp"><img src="https://allmcps.com/api/badge/hugoles-langfuse-mcp?style=directory" alt="Langfuse MCP on AllMCPs" /></a>