Skip to main content

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_langfuse_traces Fetch a filtered, paginated list of traces
get_langfuse_trace_detail Fetch full detail for a single trace (including observations, scores)
list_langfuse_trace_filters Show available filter fields and usage examples

Installation

pip install langfuse-traces-mcp

From 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

  1. Install the package: pip install langfuse-traces-mcp

  2. Add 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"
    }
  }
}
  1. Reload VS Code after configuration.
  2. Open Gemini Code Assist chat and toggle Agent Mode ON.
  3. The langfuse-traces tools 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
name string — Filter by trace name
user_id string — Filter by user ID
session_id string — Filter by session ID
tags list — Filter by tags
version string — Filter by app version
release string — Filter by release
environment string — Filter by environment
from_timestamp string — ISO 8601 start time
to_timestamp string — ISO 8601 end time
limit int 20 Max traces (1–100)
page 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: 5

The 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 -v

Project 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 tests

Versioning

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

Metadata

Release files for langfuse-traces-mcp 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langfuse-traces-mcp 0.1.3
File Size Uploaded Provenance Actions
langfuse_traces_mcp-0.1.3.tar.gz 20.6 kB Without provenance Details for langfuse_traces_mcp-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langfuse-traces-mcp 0.1.3
File Interpreter ABI Platform Actions
langfuse_traces_mcp-0.1.3-py3-none-any.whl Python 3 none any Details for langfuse_traces_mcp-0.1.3-py3-none-any.whl

Total release size: 31.8 kB

Release files / langfuse_traces_mcp-0.1.3.tar.gz

Download URL langfuse_traces_mcp-0.1.3.tar.gz
Size 20.6 kB
Tags Source
SHA-256 checksum
How to use checksums
95a4dbf5fa1e9389f07b4b8dbd9c6679dfd059434a002b175554c7190f9078dc
BLAKE2b-256 checksum
How to use checksums
9a84394fb301dfdc2fdb6d1be3c6a3aa75cfbe8dfdfd0fea8f28138633b980b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / langfuse_traces_mcp-0.1.3-py3-none-any.whl

Download URL langfuse_traces_mcp-0.1.3-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
436b46c75e6b0dd4f9d4df695120623556e10dcf7ef57b7812bb96dfbfc8c744
BLAKE2b-256 checksum
How to use checksums
94c628e4567de8093851820d8d36784063846f9f1dabf6ded51dfe5d889a62af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Security for langfuse-traces-mcp 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page