Use Langfuse in VS Code via MCP
This guide shows you how to connect the Langfuse MCP server to VS Code, so you can query and manage your Langfuse data directly from GitHub Copilot's agent mode.
What is VS Code? VS Code is a code editor from Microsoft with built-in AI assistance through GitHub Copilot. Its agent mode supports the Model Context Protocol (MCP), letting Copilot call external tools while it helps you write and debug code.
What is Langfuse? Langfuse is the open-source AI engineering platform. It helps teams collaboratively debug, analyze, and iterate on their LLM applications with features like tracing, prompt management, and evaluation.
What This Integration Does
Langfuse ships a native Model Context Protocol (MCP) server for the data platform. Once connected to VS Code, Copilot agent mode can use it to:
- Manage prompts: List, read, create, and update prompts in Langfuse Prompt Management without leaving your editor.
- Inspect traces: Pull traces and observations to debug your LLM application against real production data.
- Work with datasets: Browse datasets and items used for evaluation.
- Access the platform programmatically: Reach the same resources exposed by the Langfuse Public API.
This page covers the authenticated Langfuse MCP server for the data platform. There is also a public Docs MCP server that exposes the Langfuse documentation to AI agents โ useful in VS Code for automatically integrating Langfuse tracing into your codebase.
Prerequisites
- VS Code 1.99 or later with GitHub Copilot enabled
- A Langfuse account (cloud or self-hosted)
Quick Start
Get an Authentication Header
-
Navigate to your project settings in Langfuse and create or copy a project-scoped API key:
- Public Key:
pk-lf-... - Secret Key:
sk-lf-...
- Public Key:
-
Encode the credentials to base64 format:
echo -n "pk-lf-your-public-key:sk-lf-your-secret-key" | base64You'll use the resulting token as
{your-base64-token}below.
Add the MCP Server to VS Code
Create a .mcp.json file in your workspace's .vscode folder (or add the server via the command palette: MCP: Add Server... โ HTTP). Replace {your-base64-token} with your encoded credentials and pick the endpoint for your data region:
{
"servers": {
"langfuse": {
"type": "http",
"url": "https://cloud.langfuse.com/api/public/mcp",
"headers": {
"Authorization": "Basic {your-base64-token}"
}
}
}
}{
"servers": {
"langfuse": {
"type": "http",
"url": "https://us.cloud.langfuse.com/api/public/mcp",
"headers": {
"Authorization": "Basic {your-base64-token}"
}
}
}
}{
"servers": {
"langfuse": {
"type": "http",
"url": "https://jp.cloud.langfuse.com/api/public/mcp",
"headers": {
"Authorization": "Basic {your-base64-token}"
}
}
}
}{
"servers": {
"langfuse": {
"type": "http",
"url": "https://hipaa.cloud.langfuse.com/api/public/mcp",
"headers": {
"Authorization": "Basic {your-base64-token}"
}
}
}
}{
"servers": {
"langfuse": {
"type": "http",
"url": "https://your-domain.com/api/public/mcp",
"headers": {
"Authorization": "Basic {your-base64-token}"
}
}
}
}To make the server available across all your workspaces, add the same langfuse entry to your user-level MCP configuration instead via MCP: Open User Configuration from the command palette.
Start the Server
Open the .vscode/mcp.json file and click Start above the langfuse server entry, or run MCP: List Servers from the command palette and start it from there. VS Code will connect to the Langfuse MCP server.
Verify the Connection
- Open the Copilot Chat view and switch to Agent mode.
- Confirm the Langfuse tools are available via the Tools picker.
- Ask Copilot to
list all prompts in my Langfuse project. It should call thelistPromptstool and return your prompts.
Both read and write tools are available by default. If you only want to use read-only tools, restrict the available tools from VS Code's Tools picker in agent mode. For a full list of tools, see the MCP Reference.
Example Prompts
Once connected, try asking Copilot agent mode:
- "List all prompts in my Langfuse project and show me the latest version of the
chat-assistantprompt." - "Create a new text prompt called
summarizerwith theproductionlabel." - "Update the labels on the
chat-assistantprompt to promote version 3 to production."
Resources
- Langfuse MCP Server โ full configuration reference for the authenticated MCP server
- MCP Reference โ canonical source for MCP servers, setup snippets, tools, and schemas
- Prompt Management with MCP โ prompt-specific workflows and examples
- Docs MCP Server โ public MCP server for the Langfuse documentation
- VS Code MCP Servers Documentation โ Microsoft's guide to using MCP servers in VS Code
- Langfuse for Agents โ overview of the skill, CLI, and MCP server for coding agents
Last edited