App
Langfuse Integration
Follow a scenario from prompt to tool result in Langfuse, then use what you find to improve your agent or MCP server.
Find the Turn Where Things Went Wrong

Suppose your agent is asked for last month's revenue. It calls the right MCP tool, receives a valid response, and still fails the expected-answer check. Where do you start: the prompt, the date arguments, the tool response, or the final calculation?
Send the evaluation to Langfuse and follow that sequence. Open the generation that chose the tool, read the arguments on the tool observation, and check how the next generation used the returned data. You can see where the answer diverged from the task before deciding what to change.
MCPLab creates these traces through its OpenTelemetry-based Langfuse exporter. You enable it once in the environment; your scenario files and MCP servers need no tracing code.
Choose Where Your Evaluation Data Goes
Use the Langfuse project where you want to investigate evaluations. MCPLab can send to Langfuse Cloud or a self-hosted instance. The project's public and secret API keys select the destination project, and LANGFUSE_BASE_URL selects the instance.
The exported content includes full prompts, model messages, tool arguments, and MCP responses. Choose an instance appropriate for that data before enabling export. A self-hosted destination receives the same trace content as a cloud destination.
Local results.json and trace.jsonl remain your evaluation record. Langfuse gives you another way to explore the execution; export does not replace those files.
Connect Your Project
Add your project's API keys to the .env file in the directory where you start MCPLab, or set them in your shell environment. Keep the secret key out of version control. All three enablement values below are required: the tracing flag and both keys.
- For another cloud region or a self-hosted deployment, replace LANGFUSE_BASE_URL with that instance's base URL. The keys must belong to a project on the same instance.
- You do not need a project-name variable. MCPLab uses the project associated with the keys.
- To stop exporting, set LANGFUSE_TRACING=false or remove either key. Restart a running App after changing its environment.
LANGFUSE_TRACING=true
LANGFUSE_PUBLIC_KEY=pk-lf-...
LANGFUSE_SECRET_KEY=sk-lf-...
# Optional: defaults to https://cloud.langfuse.com
LANGFUSE_BASE_URL=https://cloud.langfuse.comStart with One Evaluation
Choose a small evaluation whose expected behavior you already understand. A scenario with a tool call is a useful first check: you can follow both the model's decision and the server's response. Replace the configuration path below with your own.
After the run, open your Langfuse project's Home view for an overview of recorded usage and latency. The dashboard below shows model generations and MCP tools from a weather evaluation. Select Tracing in the sidebar to explore individual executions.
- For the App, start it from the configured environment, open Run Evaluation, and launch your evaluation.
- Let the evaluation finish. MCPLab flushes the trace exporter and resolves the Langfuse project when collecting the results.
- Only new runs are traced. Enabling the integration does not upload earlier results.
npx @inspectr/mcplab run -c evals/eval.yamlnpx @inspectr/mcplab app --open
Go Straight to the Scenario You Are Debugging
In the App's Results page, use the run actions menu and select Langfuse trace. Inside Result Detail, use the scenario's Langfuse trace control. If that scenario ran more than once, select the run you want to investigate.
The screenshot below shows the Check Weather scenario expanded in MCPLab. Select Langfuse trace beside Edit test case in the Scenario details header to open that execution in Langfuse.
From the CLI, follow the printed Langfuse trace URL. You can also find the links in summary.md or in results.json under metadata.langfuse_trace_urls. Each link is keyed by the scenario request ID, so it points to a specific execution.

Browse Executions in Langfuse
If you are browsing directly in Langfuse, the Tracing overview below lists scenario chains alongside individual generations and tool observations. Use the Name and Type filters to narrow the list, then open the scenario chain for the complete execution. The table also exposes inputs, outputs, metadata, and latency for a quick first look.

Read the Trace in Three Layers

Look for a trace named MCPLab scenario: followed by your scenario ID. It carries the tags mcplab and evaluation. Inside it, LLM turns appear as generation observations and MCP calls appear as tool observations, all parented to the scenario chain.
In the screenshot, check-weather asks about a trip to Paris. The tree on the left shows the first model turn, two weather tool calls, and the final model turn. The preview on the right lets you follow the prompt, tool arguments, returned weather data, and packing advice in sequence. Click the screenshot to enlarge it.
- Scenario chain: start with the prompt and final answer. Its input includes the scenario, run, request, agent, provider, and model identifiers, plus configuration and version context. Its output includes the pass/fail result, messages, and metrics when available.
- Generation: inspect the conversation available at that turn and the model's response. Provider and model attributes identify what ran. Native input, output, and total token counts appear when the provider reports them.
- Tool: check the actual arguments and returned MCP content. The observation is named after the tool, with the server identity in metadata. Use its timing to investigate a slow call.
- An execution error sets an ERROR level and status message on the affected observation. A failed evaluation check can still have successful model and tool calls, so read the scenario result as well as the error markers.
MCPLab scenario: check-weather [chain]
LLM turn 0 [generation]
get_current_weather [tool]
get_forecast [tool]
LLM turn 1 [generation]If the Trace or Link Is Missing
Check the terminal where MCPLab is running for Langfuse tracing warning messages. SDK initialization, export flushing, and project lookup are handled on a best-effort basis, so these failures do not change the local evaluation result.
- No trace: confirm LANGFUSE_TRACING=true and both keys are present in the MCPLab process environment. Restart the App if you added them after startup.
- Authentication or connection warning: check that the keys and LANGFUSE_BASE_URL refer to the same instance and that MCPLab can reach it.
- No link in MCPLab: the exporter must resolve the project before it can construct trace URLs. If that lookup fails, check the destination project directly; a missing link alone does not prove that export failed.
- No token counts: usage is recorded on generation observations only when returned by the model provider. Missing usage does not by itself indicate a tracing failure.
Turn the Trace into a Focused Change
Return to the revenue example. Wrong dates in the tool arguments suggest reviewing the prompt or tool description. Correct arguments with unexpected data point toward the server response. Correct data followed by a wrong total gives you a specific model turn to investigate. Change the relevant piece, rerun the same scenario, and compare the executions.
If the question reaches below tool inputs and outputs, such as a malformed JSON-RPC response or an HTTP failure, use Inspectr request inspection in the App to examine the wire traffic. You can also keep LangSmith enabled alongside Langfuse; each integration has its own environment settings.