Langfuse Prompt Management MCP server

Integrates with Langfuse to enable dynamic prompt management, version control, and retrieval for AI applications
Back to servers
Setup instructions
Provider
Langfuse
Release date
Feb 16, 2025
Language
TypeScript
Stats
112 stars

The Langfuse Prompt Management MCP Server enables access to and management of your Langfuse prompts through the Model Context Protocol. It acts as a bridge between your Langfuse prompt library and MCP-compatible tools like Claude Desktop and Cursor.

Features

Prompt Management

This server implements the MCP Prompts specification with key capabilities:

  • List all available prompts with pagination
  • Retrieve specific prompts with variable substitution
  • Transform Langfuse prompts (text and chat) into MCP prompt objects
  • Access prompts through compatible tools interface

Installation

Prerequisites

  • Node.js
  • A Langfuse account with API keys

Setup Process

  1. Install dependencies and build the server:
npm install
npm run build
  1. Configure with your Langfuse credentials:

You'll need your Langfuse API keys for the server to function properly. The server requires these environment variables:

  • LANGFUSE_PUBLIC_KEY
  • LANGFUSE_SECRET_KEY
  • LANGFUSE_BASEURL (typically "https://cloud.langfuse.com")

Configuration

Claude Desktop

To add the server to Claude Desktop, edit your claude_desktop_config.json:

{
  "mcpServers": {
    "langfuse": {
      "command": "node",
      "args": ["<absolute-path>/build/index.js"],
      "env": {
        "LANGFUSE_PUBLIC_KEY": "your-public-key",
        "LANGFUSE_SECRET_KEY": "your-secret-key",
        "LANGFUSE_BASEURL": "https://cloud.langfuse.com"
      }
    }
  }
}

Be sure to replace <absolute-path> with the actual path to your built server and add your actual Langfuse credentials.

Cursor

To add the server to Cursor:

  1. Add a new server with these settings:

    • Name: Langfuse Prompts
    • Type: command
    • Command:
    LANGFUSE_PUBLIC_KEY="your-public-key" LANGFUSE_SECRET_KEY="your-secret-key" LANGFUSE_BASEURL="https://cloud.langfuse.com" node absolute-path/build/index.js
    
  2. Replace absolute-path with your actual server path and insert your Langfuse credentials.

Using the Server

Once configured, the MCP server provides these main capabilities:

Accessing Prompts

The server makes available two primary MCP methods:

  • prompts/list: View all available prompts in your Langfuse account

    • Supports pagination with an optional cursor parameter
    • Shows prompt names and their required arguments
  • prompts/get: Retrieve and use a specific prompt

    • Allows variable substitution by providing arguments
    • Returns the fully compiled prompt ready for use

Using the Tools Interface

For MCP clients that don't support the prompt capability directly, these tools are available:

  • get-prompts: Lists all available prompts (with pagination support)
  • get-prompt: Retrieves and compiles a specific prompt

Limitations

Currently, the server:

  • Only returns prompts with a production label in Langfuse
  • Treats all arguments as optional without descriptions
  • Uses an inefficient method of fetching prompts individually to extract arguments

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "langfuse" '{"command":"node","args":["<absolute-path>/build/index.js"],"env":{"LANGFUSE_PUBLIC_KEY":"your-public-key","LANGFUSE_SECRET_KEY":"your-secret-key","LANGFUSE_BASEURL":"https://cloud.langfuse.com"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "langfuse": {
            "command": "node",
            "args": [
                "<absolute-path>/build/index.js"
            ],
            "env": {
                "LANGFUSE_PUBLIC_KEY": "your-public-key",
                "LANGFUSE_SECRET_KEY": "your-secret-key",
                "LANGFUSE_BASEURL": "https://cloud.langfuse.com"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "langfuse": {
            "command": "node",
            "args": [
                "<absolute-path>/build/index.js"
            ],
            "env": {
                "LANGFUSE_PUBLIC_KEY": "your-public-key",
                "LANGFUSE_SECRET_KEY": "your-secret-key",
                "LANGFUSE_BASEURL": "https://cloud.langfuse.com"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later