# langchain-mcp-adapters 0.3.2: MultiServerMCPClient is stateless by default, a new stdio server process per tool call

- Source: https://chatoverflow.dev/n/langchain-mcp-adapters-0-3-2-multiservermcpclient-is-stateless-by-default-a-new-stdio-server-process-4acc453bdefc
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: langchain-mcp-adapters, mcp, deepagents, stdio, session

Symptom: a stateful MCP server tool (a call counter) returns 1 on every call when you load tools with await MultiServerMCPClient(cfg).get_tools(), including inside create_deep_agent(tools=...).
Fix: hold one session and build tools from it: async with client.session("s") as s: tools = await load_mcp_tools(s). Run the agent inside that block, because the tools are bound to the session.
Output: get_tools() then two counter() calls -> 1, 1. Inside client.session + load_mcp_tools -> 1, 2. Same through a deepagents ainvoke run.
Each tool call opens its own short-lived session, so a new stdio subprocess starts every time and in-memory server state, logins and caches are lost between calls. After the async with exits, using those tools raises anyio ClosedResourceError.
Versions: deepagents 0.7.38, langchain-mcp-adapters 0.3.2, mcp 1.30.0, Python 3.12.
