Langfuse API

v0.2.0
io.github.rodrigorjsf/langfuse-api-mcp Checked 22 hours ago Published 1 month ago

Langfuse public API (Cloud and self-hosted): traces, prompts, datasets and gated writes.

Values you need

VariableWhat it is
LANGFUSE_PUBLIC_KEYrequired secret The project's public key (pk-lf-...).
LANGFUSE_SECRET_KEYrequired secret The project's secret key (sk-lf-...).
LANGFUSE_BASE_URLrequired Your Langfuse host, e.g. https://cloud.langfuse.com; https only, http only for localhost.
LANGFUSE_CA_CERToptional Optional PEM file with your corporate or private CA, added to the system trust store.

npm (npx)

Requires Node.js 18+

Run in a terminal
claude mcp add langfuse-api-mcp -e 'LANGFUSE_BASE_URL=<LANGFUSE_BASE_URL>' -e 'LANGFUSE_PUBLIC_KEY=<LANGFUSE_PUBLIC_KEY>' -e 'LANGFUSE_SECRET_KEY=<LANGFUSE_SECRET_KEY>' -- npx -y --package=langfuse-api-mcp@0.2.0 langfuse-mcp
Add to claude_desktop_config.json
{
  "mcpServers": {
    "langfuse-api-mcp": {
      "args": [
        "-y",
        "--package=langfuse-api-mcp@0.2.0",
        "langfuse-mcp"
      ],
      "command": "npx",
      "env": {
        "LANGFUSE_BASE_URL": "<LANGFUSE_BASE_URL>",
        "LANGFUSE_PUBLIC_KEY": "<LANGFUSE_PUBLIC_KEY>",
        "LANGFUSE_SECRET_KEY": "<LANGFUSE_SECRET_KEY>"
      }
    }
  }
}
Add to ~/.cursor/mcp.json
{
  "mcpServers": {
    "langfuse-api-mcp": {
      "args": [
        "-y",
        "--package=langfuse-api-mcp@0.2.0",
        "langfuse-mcp"
      ],
      "command": "npx",
      "env": {
        "LANGFUSE_BASE_URL": "<LANGFUSE_BASE_URL>",
        "LANGFUSE_PUBLIC_KEY": "<LANGFUSE_PUBLIC_KEY>",
        "LANGFUSE_SECRET_KEY": "<LANGFUSE_SECRET_KEY>"
      }
    }
  }
}
Add to .vscode/mcp.json
{
  "inputs": [
    {
      "description": "LANGFUSE_BASE_URL",
      "id": "langfuse-base-url",
      "password": true,
      "type": "promptString"
    },
    {
      "description": "LANGFUSE_PUBLIC_KEY",
      "id": "langfuse-public-key",
      "password": true,
      "type": "promptString"
    },
    {
      "description": "LANGFUSE_SECRET_KEY",
      "id": "langfuse-secret-key",
      "password": true,
      "type": "promptString"
    }
  ],
  "servers": {
    "langfuse-api-mcp": {
      "args": [
        "-y",
        "--package=langfuse-api-mcp@0.2.0",
        "langfuse-mcp"
      ],
      "command": "npx",
      "env": {
        "LANGFUSE_BASE_URL": "${input:langfuse-base-url}",
        "LANGFUSE_PUBLIC_KEY": "${input:langfuse-public-key}",
        "LANGFUSE_SECRET_KEY": "${input:langfuse-secret-key}"
      },
      "type": "stdio"
    }
  }
}
Add to ~/.codex/config.toml
[mcp_servers.langfuse-api-mcp]
command = "npx"
args = ["-y", "--package=langfuse-api-mcp@0.2.0", "langfuse-mcp"]
env = { "LANGFUSE_BASE_URL" = "<LANGFUSE_BASE_URL>", "LANGFUSE_PUBLIC_KEY" = "<LANGFUSE_PUBLIC_KEY>", "LANGFUSE_SECRET_KEY" = "<LANGFUSE_SECRET_KEY>" }

Docker

Requires Docker

Run in a terminal
claude mcp add langfuse-api-mcp -e 'LANGFUSE_BASE_URL=<LANGFUSE_BASE_URL>' -e 'LANGFUSE_PUBLIC_KEY=<LANGFUSE_PUBLIC_KEY>' -e 'LANGFUSE_SECRET_KEY=<LANGFUSE_SECRET_KEY>' -- docker run -i --rm -e LANGFUSE_BASE_URL -e LANGFUSE_PUBLIC_KEY -e LANGFUSE_SECRET_KEY ghcr.io/rodrigorjsf/langfuse-api-mcp:0.2.0
Add to claude_desktop_config.json
{
  "mcpServers": {
    "langfuse-api-mcp": {
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "LANGFUSE_BASE_URL",
        "-e",
        "LANGFUSE_PUBLIC_KEY",
        "-e",
        "LANGFUSE_SECRET_KEY",
        "ghcr.io/rodrigorjsf/langfuse-api-mcp:0.2.0"
      ],
      "command": "docker",
      "env": {
        "LANGFUSE_BASE_URL": "<LANGFUSE_BASE_URL>",
        "LANGFUSE_PUBLIC_KEY": "<LANGFUSE_PUBLIC_KEY>",
        "LANGFUSE_SECRET_KEY": "<LANGFUSE_SECRET_KEY>"
      }
    }
  }
}
Add to ~/.cursor/mcp.json
{
  "mcpServers": {
    "langfuse-api-mcp": {
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "LANGFUSE_BASE_URL",
        "-e",
        "LANGFUSE_PUBLIC_KEY",
        "-e",
        "LANGFUSE_SECRET_KEY",
        "ghcr.io/rodrigorjsf/langfuse-api-mcp:0.2.0"
      ],
      "command": "docker",
      "env": {
        "LANGFUSE_BASE_URL": "<LANGFUSE_BASE_URL>",
        "LANGFUSE_PUBLIC_KEY": "<LANGFUSE_PUBLIC_KEY>",
        "LANGFUSE_SECRET_KEY": "<LANGFUSE_SECRET_KEY>"
      }
    }
  }
}
Add to .vscode/mcp.json
{
  "inputs": [
    {
      "description": "LANGFUSE_BASE_URL",
      "id": "langfuse-base-url",
      "password": true,
      "type": "promptString"
    },
    {
      "description": "LANGFUSE_PUBLIC_KEY",
      "id": "langfuse-public-key",
      "password": true,
      "type": "promptString"
    },
    {
      "description": "LANGFUSE_SECRET_KEY",
      "id": "langfuse-secret-key",
      "password": true,
      "type": "promptString"
    }
  ],
  "servers": {
    "langfuse-api-mcp": {
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "LANGFUSE_BASE_URL",
        "-e",
        "LANGFUSE_PUBLIC_KEY",
        "-e",
        "LANGFUSE_SECRET_KEY",
        "ghcr.io/rodrigorjsf/langfuse-api-mcp:0.2.0"
      ],
      "command": "docker",
      "env": {
        "LANGFUSE_BASE_URL": "${input:langfuse-base-url}",
        "LANGFUSE_PUBLIC_KEY": "${input:langfuse-public-key}",
        "LANGFUSE_SECRET_KEY": "${input:langfuse-secret-key}"
      },
      "type": "stdio"
    }
  }
}
Add to ~/.codex/config.toml
[mcp_servers.langfuse-api-mcp]
command = "docker"
args = ["run", "-i", "--rm", "-e", "LANGFUSE_BASE_URL", "-e", "LANGFUSE_PUBLIC_KEY", "-e", "LANGFUSE_SECRET_KEY", "ghcr.io/rodrigorjsf/langfuse-api-mcp:0.2.0"]
env = { "LANGFUSE_BASE_URL" = "<LANGFUSE_BASE_URL>", "LANGFUSE_PUBLIC_KEY" = "<LANGFUSE_PUBLIC_KEY>", "LANGFUSE_SECRET_KEY" = "<LANGFUSE_SECRET_KEY>" }

For AI agents

  1. Ask the user for: LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, LANGFUSE_BASE_URL. Never invent or guess these values; secrets go into the client config, not into chat logs.
  2. Pick the user's MCP client and apply the matching config from the first install method (it is the one verified by the smoke test when available).
  3. Restart or reload the client so it starts the server.
  4. If it fails, check that the required runtime is installed (Node.js 18+) and that the values above are set.

Machine-readable: install.md · manifest.json