MCPAgent can attach LangChain callbacks to each run. Use observability to inspect prompts, model calls, tool calls, errors, latency, metadata, and tags.
Observability is enabled by default. If no supported callback integration is configured, the agent runs normally without traces.
Enable Langfuse
Set Langfuse credentials before the agent initializes. mcp-use auto-detects them and installs the Langfuse callback handler.flush() before a serverless function exits so buffered traces have time to send.
Add metadata and tags
Use metadata for trace attributes and tags for filtering. Metadata keys are sanitized, object values must be serializable, and large serialized values are truncated.Use custom callbacks
Pass custom LangChain callbacks when you want to use your own Langfuse handler or another tracing platform. Custom callbacks replace auto-detected callbacks for the agent.Disable observability
Setobserve: false when you do not want the agent to look for observability integrations.
MCP_USE_LANGFUSE=false.