Langfuse MCP server

Langfuse MCP server

langfuse-mcp-hugoles•byhugoles

A read-only MCP server that exposes the Langfuse Public API as tools so MCP clients can query traces, observations, sessions, scores, prompts, datasets, and metrics in conversation.

License: MIT•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Lists and fetches traces and observations, including a trace's full observation tree.
  • •Retrieves sessions, scores, score configurations, and comments.
  • •Provides access to prompts, datasets, dataset items, and dataset runs.
  • •Runs metrics queries and daily aggregated metrics for usage, cost, and counts.

BEST FOR

  • •Investigating why a specific trace failed by walking through its observations.
  • •Filtering recent error traces for a specific user or reviewing scores received in a period.
  • •Summarizing generation cost by model or fetching a production prompt version.

ABOUT LANGFUSE-MCP-HUGOLES

Langfuse MCP server is cataloged as an MCP server attributed to hugoles. A read-only MCP server that exposes the Langfuse Public API as tools so MCP clients can query traces, observations, sessions, scores, prompts, datasets, and metrics in conversation. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Langfuse MCP server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

What tools does the server expose?

It exposes read-only tools grouped around traces and observations, sessions, scores, prompts, datasets, and metrics, models, projects, comments, media, and health.

How does the server connect to Langfuse?

It calls the Langfuse Public API over HTTPS using project keys for Basic Auth, with configuration via environment variables for public key, secret key, and base URL.

上游原版 README

在 GitHub 查看同一版本原文

README.md · bb91a02f6d00 · 采集于 2026-11-13 13:31:28 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

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:

npx -y langfuse-mcp

Or install globally:

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
{
  "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):

{
  "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.

{
  "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):

{
  "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:

{
  "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:

{
  "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:

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:

  • "Use the getHealth tool to confirm langfuse-mcp is connected."
  • "List the 5 most recent traces with level=ERROR."
  • "Show me trace abc123 with all its observations."
  • "What scores did user alice@example.com receive this week?"
  • "Get the production version of prompt customer-support."
  • "List dataset runs for eval-2026-q1 and tell me which one had the highest accuracy score."

Troubleshooting

401 Unauthorized on the first call

  • Wrong region: Langfuse Cloud EU and US are separate accounts. Make sure LANGFUSE_BASE_URL matches the region where you created the keys (https://cloud.langfuse.com for EU, https://us.cloud.langfuse.com for US).
  • Quoted keys in .env: this server strips surrounding quotes, but a stray space can still break Basic Auth. Re-paste the key.
  • Use getHealth first to confirm credentials before running other tools.

npx keeps using an old version

npx -y langfuse-mcp@latest

npx caches packages aggressively. The @latest suffix forces a refresh.

LANGFUSE_BASE_URL must be a full URL error

The most common cause is a missing scheme. Use https://cloud.langfuse.com, not cloud.langfuse.com.

Self-hosted Langfuse

Use the full base URL of your deployment without a trailing slash or path. Example: https://langfuse.mycompany.internal. The server normalizes a single trailing slash, but anything else (/api, /public) will break path joining.

MCP server icon doesn't appear in Claude Desktop

  • Check the Claude Desktop log: ~/Library/Logs/Claude/mcp*.log (macOS) or %APPDATA%\Claude\Logs\ (Windows). The server writes a langfuse-mcp v… connected line to stderr on success.
  • Make sure Node 20+ is on your PATH (Claude Desktop uses your login shell PATH).
  • Quit Claude Desktop fully (not just close the window) and relaunch.

Cryptic ERR_REQUIRE_ESM / Unexpected token on startup

Your Node version is too old. This package requires Node ≥ 20. Run node --version and upgrade if needed (e.g. via nvm).

Development

git clone https://github.com/hugoles/langfuse-mcp.git
cd langfuse-mcp
npm install
cp .env.example .env       # macOS/Linux
copy .env.example .env     # Windows cmd
npm run dev                # tsx src/index.ts (no build step)

Other scripts:

ScriptWhat it does
npm run buildCompile TypeScript to dist/.
npm startRun the built server.
npm run typechecktsc --noEmit.
npm run lintESLint.
npm run format / npm run format:checkPrettier write / check.
npm testVitest.

Contributing

See CONTRIBUTING.md. Bug reports and PRs are welcome — please run npm run typecheck && npm run lint && npm test locally before opening one.

Security

Found a vulnerability? Please report it privately as described in SECURITY.md. Do not open a public issue.

License

MIT © Hugoles.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Langfuse MCP server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/langfuse-mcp-hugoles)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools