Skip to content

ProxyUser Serialization Error When Invoking MCP Tools on LangGraph CloudΒ #416

@Insomniacboy

Description

@Insomniacboy

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions