用于langfuse的MCP服务器
](https://www.npmjs.com/package/shouting-mcp-langfuse)
用于将AI助手与Langfuse工作区集成的模型上下文协议(MCP)服务器实现。
概述
该软件包提供了一个MCP服务器,使AI助手能够与Langfuse工作区进行交互。它允许AI模型:
- 按时间范围查询LLM指标
安装
# Install from npm
npm install shouting-mcp-langfuse
# Or install globally
npm install -g shouting-mcp-langfuse你可以在npm上找到这个包: 大喊mcp langfuse
先决条件
在使用服务器之前,您需要创建一个Langfuse项目并获取项目的公钥和私钥。您可以在Langfuse仪表板中找到这些键。
- 建立Langfuse项目
- 获取公钥和私钥
- 设置环境变量
配置
服务器需要以下环境变量:
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
