Langfuse

Provides an MCP bridge to Langfuse workspaces enabling metric queries by time range.
  • javascript

3

GitHub Stars

javascript

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "z9905080-mcp-langfuse": {
      "command": "mcp-server-langfuse",
      "args": [],
      "env": {
        "LANGFUSE_DOMAIN": "https://api.langfuse.com",
        "LANGFUSE_PUBLIC_KEY": "YOUR_PUBLIC_KEY",
        "LANGFUSE_PRIVATE_KEY": "YOUR_PRIVATE_KEY"
      }
    }
  }
}

You can run a Langfuse MCP Server to enable AI assistants to interact with Langfuse workspaces and query LLM metrics by time range. This server runs locally or in your environment and bridges your MCP clients with Langfuse data. Set your Langfuse keys and domain, start the server, and then expose the MCP endpoint to your AI workflows.

How to use

You use this MCP server by starting it in your environment and then connecting an MCP client to the server through the standard MCP interface. The server reads your Langfuse domain and keys from environment variables and exposes a local or remote MCP endpoint. Once running, you can route your AI models’ metric queries to Langfuse, such as retrieving LLM metrics by a specified time range, through the MCP client.

Prepare your environment with the required keys, start the server, and then integrate your MCP client to call the available endpoints. The server handles the authorization with Langfuse and forwards requests to fetch metrics for your workspace.

Example usage flow you can follow after configuring environment variables: set your Langfuse domain and keys, then start the MCP server from your command line. Your MCP client can then request the available Langfuse metrics tool and receive results from Langfuse.

How to install

# Install from npm
npm install shouting-mcp-langfuse

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

Configuration and prerequisites

You need to create a Langfuse project and obtain its public and private keys. You will use these keys to authorize requests from the MCP server.

Set the following environment variables before starting the server:

LANGFUSE_DOMAIN: The Langfuse domain (default: https://api.langfuse.com) LANGFUSE_PUBLIC_KEY: Your Langfuse Project Public Key LANGFUSE_PRIVATE_KEY: Your Langfuse Project Private Key

Starting the server with the CLI

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

# Run the MCP server for Langfuse
mcp-server-langfuse

Registering and using the server in your code

You can initialize the MCP server in your code if you are composing an application that hosts MCP handlers. Start by creating the server instance and wiring it to handle the Langfuse-based endpoints. Then create or integrate an Langfuse client to communicate with Langfuse using the provided environment variables.

Example pattern (conceptual): import the MCP Server class, initialize with your configuration, and create a Langfuse client using the same domain and keys from the environment. Register your custom handlers for Langfuse metrics endpoints.

Notes on security and usage

Keep your Langfuse keys secure. Do not hard-code them in source files. Use your deployment platform’s secret management to supply LANGFUSE_DOMAIN, LANGFUSE_PUBLIC_KEY, and LANGFUSE_PRIVATE_KEY at runtime.

The server is designed to execute metric queries against Langfuse on behalf of your MCP clients. Validate all inputs on the client side and rely on the server to perform the authorized Langfuse requests.

Examples and troubleshooting

If you encounter connection issues, verify that the environment variables are correctly set and that the Langfuse project keys are valid for the domain you are using. Check that the mcp-server-langfuse process is running and reachable by your MCP client, and confirm that the Langfuse domain default aligns with your project configuration.

Available tools

getLLMMetricsByTimeRange

Retrieve LLM metrics from Langfuse for a specified time range. This tool enables the MCP client to query usage, performance, and other metrics across Langfuse workspaces.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational