Skip to main content
Glama
z9905080

MCP Server for langfuse

by z9905080

langfuse 的 MCP 服务器

npm 版本

用于将 AI 助手与 Langfuse 工作区集成的模型上下文协议 (MCP) 服务器实现。

概述

此软件包提供了一个 MCP 服务器,使 AI 助手能够与 Langfuse 工作区交互。它允许 AI 模型执行以下操作:

  • 按时间范围查询 LLM 指标

Related MCP server: langfuse-mcp-extended

安装

# Install from npm
npm install shouting-mcp-langfuse

# Or install globally
npm install -g shouting-mcp-langfuse

您可以在 npm 上找到该软件包: shouting-mcp-langfuse

先决条件

在使用服务器之前,您需要创建一个 Langfuse 项目并获取项目的公钥和私钥。您可以在 Langfuse 仪表板中找到这些密钥。

  1. 建立一个 Langfuse 项目

  2. 获取公钥和私钥

  3. 设置环境变量

配置

服务器需要以下环境变量:

  • LANGFUSE_DOMAIN :Langfuse 域名(默认值: https://api.langfuse.com )

  • LANGFUSE_PUBLIC_KEY :你的 Langfuse 项目公钥

  • LANGFUSE_PRIVATE_KEY :您的 Langfuse 项目私钥

用法

作为 CLI 工具运行

# Set environment variables
export LANGFUSE_DOMAIN="https://api.langfuse.com"
export LANGFUSE_PUBLIC_KEY="your-public-key"
export LANGFUSE_PRIVATE_KEY="your-private

# Run the server
mcp-server-langfuse

在代码中使用

import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { langfuseClient } from "shouting-mcp-langfuse";

// Initialize the server and client
const server = new Server({...});
const langfuseClient = new LangfuseClient(process.env.LANGFUSE_DOMAIN, process.env.LANGFUSE_PUBLIC_KEY, process.env.LANGFUSE_PRIVATE_KEY);

// Register your custom handlers
// ...

可用工具

服务器提供以下 langfuse 集成工具:

  • getLLMMetricsByTimeRange :按时间范围获取 LLM 指标

执照

国际学习中心

作者

shouting.hsiao@gmail.com

存储库

https://github.com/z9905080/mcp-langfuse

Available Tools

1 tool
query_llm_metricsC

Query LLM metrics

ParametersJSON Schema
NameRequiredDescriptionDefault
fromTimestampNoStart timestamp in ISO 8601 format
toTimestampNoEnd timestamp in ISO 8601 format
pageNoPage number (default 1)
limitNolimit (default 100)
traceNameNoTrace name
userIdNoUser ID, it's can filter by user
tagsNoTags
environmentNoEnvironment

TDQS

C2.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, and the description does not disclose any behavioral traits such as side effects, permissions, rate limits, or data scope. It merely describes a query, which implies a read-only operation but does not explicitly confirm safety or other constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely short (3 words) but underspecified for a tool with 8 parameters. It lacks necessary detail and is not front-loaded with critical information. Conciseness should not sacrifice completeness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of 8 parameters, no annotations, and no output schema, the description is insufficient. It does not explain what the metrics represent, how results are returned, or any context for interpreting the data. The agent is left without enough information to effectively use the tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds no meaning beyond the schema's parameter descriptions. It does not explain how to use parameters together or provide context that helps the agent understand parameter relationships.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description states 'Query LLM metrics' which clearly identifies the verb and resource. It is a simple, direct statement of the tool's purpose, though it lacks specificity about which metrics. It is not a tautology and distinguishes the tool as a query operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance provided on when to use this tool, what scenarios it is suited for, or any alternatives. The description gives no context for appropriate usage, leaving the agent without decision-making information.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool update
    • First observedquery_llm_metrics

TDQS

C2.8/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of confusion or overlap with other tools. The tool's purpose is clear and unambiguous.

Naming Consistency5/5

The single tool uses a clear snake_case naming convention. Although there are no other tools to compare, the naming is consistent within itself.

Tool Count1/5

A server named 'MCP Server for langfuse' with only one tool is severely undersized. Langfuse is a comprehensive LLM observability platform expecting tools for traces, scores, sessions, etc., not just metrics queries.

Completeness1/5

The server lacks any tools for creating, updating, or deleting resources, and does not cover common operations like managing traces or observations. It is severely incomplete for its stated domain.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    An MCP server that enables AI assistants to interact with Signoz observability platform, providing tools to query dashboards, metrics, traces, logs, and APM data with time range support.
    14
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Comprehensive MCP server for Langfuse, enabling AI assistants to access and manage traces, observations, scores, datasets, and sessions for observability.
    24
    20 npm
    1
    MIT