Langfuse Trace Fetcher
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Langfuse Trace Fetcher Show me the last 5 production traces"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Langfuse Trace Fetcher — MCP Server for VS Code
Version 0.1.0 · Fetch Langfuse observability traces directly into your coding agent's context.
What It Does
This is a Model Context Protocol (MCP) server that connects your VS Code coding agent (Gemini Code Assist) to a Langfuse instance. It exposes three tools:
Tool | Description |
| Fetch a filtered, paginated list of traces |
| Fetch full detail for a single trace (including observations, scores) |
| Show available filter fields and usage examples |
Related MCP server: Langfuse MCP Server
Installation
From PyPI (Recommended)
pip install langfuse-traces-mcpFrom Source
# Clone the repository
git clone https://github.com/yourusername/langfuse-traces-mcp.git
cd langfuse-traces-mcp
# Install in development mode (includes test dependencies)
pip install -e ".[dev]"Prerequisites
Python 3.10+
VS Code with Gemini Code Assist extension (Agent Mode enabled)
Langfuse instance — cloud (cloud.langfuse.com) or self-hosted
VS Code Setup
Install the package:
pip install langfuse-traces-mcpAdd the MCP server configuration to your VS Code settings. Open VS Code settings (Ctrl/Cmd + ,) and search for "Gemini Code Assist". In the settings JSON, add:
{
"mcpServers": {
"langfuse-traces": {
"command": "langfuse-traces-mcp"
}
}
}Reload VS Code after configuration.
Open Gemini Code Assist chat and toggle Agent Mode ON.
The
langfuse-tracestools should now be available.
Usage
Once configured, you can ask your coding agent questions like:
"Show me traces from production in the last hour"
"Get details for trace ID abc-123-xyz"
"List traces with errors tagged as 'critical'"
"Show me traces from user 'john.doe' in the staging environment"
The agent will fetch and display formatted trace data directly in the conversation.
Available Filters
Parameter | Type | Default | Description |
| string | — | Filter by trace name |
| string | — | Filter by user ID |
| string | — | Filter by session ID |
| list | — | Filter by tags |
| string | — | Filter by app version |
| string | — | Filter by release |
| string | — | Filter by environment |
| string | — | ISO 8601 start time |
| string | — | ISO 8601 end time |
| int | 20 | Max traces (1–100) |
| int | 1 | Page number |
Example Chat Usage
In VS Code Gemini Code Assist chat (with Agent Mode on):
Fetch the last 5 production traces from my Langfuse instance:
- Public key: pk-lf-abc123
- Secret key: sk-lf-xyz789
- Host: https://cloud.langfuse.com
- Environment: production
- Limit: 5The agent will call fetch_langfuse_traces with those parameters and return formatted trace data.
Running Tests
# Install dev dependencies (if not already)
pip install -e ".[dev]"
# Run all tests
pytest tests/ -v
# Run a specific test file
pytest tests/test_models.py -v
pytest tests/test_client.py -v
pytest tests/test_server.py -vProject Structure
├── pyproject.toml # Project metadata & dependencies (v0.1.0)
├── README.md # This file
├── .gemini/
│ └── settings.json # MCP server registration for VS Code
├── src/
│ └── langfuse_traces_mcp/
│ ├── __init__.py # Version export
│ ├── server.py # FastMCP server + 3 tool definitions
│ ├── client.py # Async HTTP client for Langfuse API
│ └── models.py # Pydantic models (filters, credentials)
└── tests/
├── conftest.py # Shared test fixtures & mock data
├── test_models.py # Filter & credential validation tests
├── test_client.py # REST client tests (mocked HTTP)
└── test_server.py # MCP tool integration testsVersioning
This project follows Semantic Versioning 2.0:
PATCH (0.1.x) — Bug fixes
MINOR (0.x.0) — New filters, tools, or features
MAJOR (x.0.0) — Breaking changes
License
MIT
Available Tools
3 toolsfetch_langfuse_tracesB
Fetch a filtered list of traces from a Langfuse instance.
Connects to the specified Langfuse host using the provided credentials and returns matching traces formatted as readable context.
Inputs: host_url (required), public_key (required), secret_key (required), name, +10 more. Returns: result
get_langfuse_trace_detailA
Fetch full detail for a single Langfuse trace by its ID.
Returns the complete trace including input/output data, observations (spans, generations), scores, and metadata.
Inputs: host_url (required), trace_id (required), public_key (required), secret_key (required). Returns: result
list_langfuse_trace_filtersA
List all available filter fields for fetching Langfuse traces.
This is a help/reference tool — it does not make any API calls. Use these filter names as parameters when calling fetch_langfuse_traces.
Returns: A formatted reference table of available filters.
Inputs: no named parameters. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool serves a distinct purpose: fetching a filtered list of traces, retrieving full detail for a specific trace, and listing available filter fields. There is no functional overlap.
All tools follow a consistent verb_noun pattern (fetch_langfuse_traces, get_langfuse_trace_detail, list_langfuse_trace_filters) with snake_case, making the naming predictable and clear.
With 3 tools, the set is well-scoped for a trace fetching server: listing with filters, getting detail, and a reference tool for filters. No extraneous or missing tools.
For a 'Trace Fetcher', the tools cover the core workflow: querying traces with filters, retrieving individual details, and discovering available filters. No essential operations are missing.
Maintenance
Related MCP Connectors
Traceo bug recordings (console, network, user actions, environment) as context for coding agents.
Query your app's logs, metrics and incidents from your AI assistant.
AI agent observability for production traces, natural-language insights, and improvement loops.
Query application logs, traces, and metrics from your AI coding assistant via Foam's MCP server.
Related MCP Servers
- FlicenseNot gradedqualityAmaintenanceEnables AI agents and MCP clients to query Langfuse trace data for debugging and observability, with tools for traces, sessions, exceptions, routing decisions, prompts, datasets, scores, and metrics.-
- FlicenseNot gradedqualityAmaintenanceEnables AI agents to query and debug Langfuse trace data, including traces, sessions, exceptions, route decisions, prompts, datasets, and metrics, for enhanced debugging and observability.-
- FlicenseNot gradedqualityAmaintenanceEnables AI agents and developers to query Langfuse trace data for debugging and observability, including traces, sessions, exceptions, route decisions, prompts, datasets, and metrics. Supports local stdio/HTTP access through MCP clients with selective tool loading and read-only mode.-
- FlicenseNot gradedqualityAmaintenanceEnables AI agents to query and debug trace data from Langfuse, including sessions, exceptions, prompts, datasets, metrics, and annotation queues, through the Model Context Protocol.-