# Langfuse — how to use (mcp.ai)

Connect your Langfuse account and use 13 tools for developer tools straight from your AI agent. Connect with your own API key. Open source LLM engineering platform. Traces, evals, prompt management and metrics to debug and improve your LLM application.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_langfuse?ms=1787295840000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `langfuse_create_score`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/langfuse`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/langfuse/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/langfuse/create/score` — Attach an evaluation score to exactly one Langfuse trace, session, or dataset run, optionally narrowing a trace score to an observation.
  - body: { name: string, value: integer|number|string, source?: string, comment?: string, metadata?: object, queue_id?: string, score_id?: string, trace_id?: string, config_id?: string, data_type?: string, session_id?: string, environment?: string, dataset_run_id?: string, observation_id?: string }
- `POST https://api.mcp.ai/api/langfuse/get/annotation/queue` — Retrieve one Langfuse annotation queue by its ID.
  - body: { queue_id: string }
- `POST https://api.mcp.ai/api/langfuse/get/prompt` — Retrieve a Langfuse text or chat prompt by name, deployment label, or exact version, with optional dependency resolution.
  - body: { label?: string, resolve?: boolean, version?: integer, prompt_name: string }
- `POST https://api.mcp.ai/api/langfuse/list/annotation/queues` — List annotation queues configured for human evaluation in the connected Langfuse project.
  - body: { limit?: integer, next_cursor?: string }
- `POST https://api.mcp.ai/api/langfuse/list/dataset/items` — List dataset items, optionally scoped to a dataset, source trace or observation, or historical dataset version.
  - body: { limit?: integer, version?: string, next_cursor?: string, dataset_name?: string, source_trace_id?: string, source_observation_id?: string }
- `POST https://api.mcp.ai/api/langfuse/list/dataset/run/items` — List run items for a specific Langfuse dataset and run name.
  - body: { page?: integer, limit?: integer, runName: string, datasetId: string }
- `POST https://api.mcp.ai/api/langfuse/list/datasets` — List datasets available to the connected Langfuse project.
  - body: { limit?: integer, next_cursor?: string }
- `POST https://api.mcp.ai/api/langfuse/list/experiments` — List Langfuse experiments active in a required time range, optionally including metadata and directly attached scores.
  - body: { limit?: integer, names?: string, fields?: string, dataset_ids?: string, filter_json?: string, next_cursor?: string, score_limit?: integer, to_start_time?: string, experiment_ids?: string, from_start_time: string }
- `POST https://api.mcp.ai/api/langfuse/list/models` — List Langfuse-managed and project-custom model pricing definitions used for usage and cost calculation.
  - body: { limit?: integer, next_cursor?: string }
- `POST https://api.mcp.ai/api/langfuse/list/observations` — Search Langfuse observations such as generations, spans, events, agents, and tool calls, selecting only the field groups needed.
  - body: { name?: string, level?: string, limit?: integer, fields?: string, user_id?: string, version?: string, trace_id?: string, session_id?: string, filter_json?: string, next_cursor?: string, environments?: string[], to_start_time?: string, expand_metadata?: string, from_start_time?: string, observation_type?: string, is_root_observation?: boolean, parent_observation_id?: string }
- `POST https://api.mcp.ai/api/langfuse/list/scores` — Search numeric, boolean, categorical, text, and correction scores with subject and annotation context.
  - body: { limit?: integer, names?: string[], fields?: string[], values?: string[], sources?: string[], queue_ids?: string[], score_ids?: string[], trace_ids?: string[], value_max?: number, value_min?: number, config_ids?: string[], data_types?: string[], next_cursor?: string, session_ids?: string[], environments?: string[], to_timestamp?: string, experiment_ids?: string[], from_timestamp?: string, author_user_ids?: string[], observation_ids?: string[] }
- `POST https://api.mcp.ai/api/langfuse/query/metrics` — Run an aggregate Langfuse metrics query over observations or numeric, boolean, or categorical scores.
  - body: { view: string, filters?: object[], metrics: object[], order_by?: object[], row_limit?: integer, dimensions?: object[], to_timestamp: string, from_timestamp: string, histogram_bins?: integer, time_granularity?: string }
- `POST https://api.mcp.ai/api/langfuse/upsert/llm/connection` — Create or update a Langfuse LLM provider connection by provider name.
  - body: { config?: object, adapter: string, baseURL?: string, provider: string, secretKey: string, customModels?: string[], extraHeaders?: object, withDefaultModels?: boolean }

## Example prompts
- "What can I do in Langfuse?"
- "Show me a summary of my Langfuse account"

## More
- Page: https://mcp.ai/langfuse
- Agent spec (llms.txt): https://mcp.ai/langfuse/llms.txt
- Postman collection: https://mcp.ai/langfuse/postman.json
