-
Notifications
You must be signed in to change notification settings - Fork 384
Open
Description
When invoking MCP tools in a LangGraph deployed to LangGraph Cloud, tool executions fail with a serialization error:
{"error": "Unable to serialize unknown type: <class 'langgraph_api.auth.custom.ProxyUser'>"}
Environment
- Platform: LangGraph Cloud
- Tools: MCP tools (via
langchain-mcp-adapters.MultiServerMCPClient) - Transport: SSE (Server-Sent Events)
- Python Version: 3.1.12
Root Cause
LangGraph Cloud injects authentication context (a ProxyUser object) into the RunnableConfig under config['configurable'] with private keys (e.g., __auth). When tools are invoked via tool.ainvoke(args, config=config), the full config object (including the non-serializable ProxyUser) is passed through to the tool execution layer. During tool execution, LangChain or the MCP adapter attempts to serialize the config for logging/tracing/checkpointing, which fails because ProxyUser is not JSON-serializable.
- The error only occurs on LangGraph Cloud; local/self-hosted LangGraph runs work fine (no ProxyUser injection)
- The error occurs regardless of tool transport type (SSE, stdio, streamable_http)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels