Skip to content

Fatal crash on Windows: "Circular reference detected" when Claude Code calls ListToolsRequest #336

@jabschmidt

Description

@jabschmidt

Description

The MCP server crashes with a fatal ValueError: Circular reference detected (id repeated) when Claude Code sends a ListToolsRequest. The server starts, connects, and processes the initialize handshake successfully, but crashes during tool list serialization. This prevents any MCP tools from being used — Claude Code falls back to direct SSH.

Environment

  • OS: Windows 11 Enterprise (Build 22631)
  • Hardware: Dell Pro Max 16 MC16250 (Intel Core Ultra 7 265H, 16 cores, 32GB RAM)
  • Python: 3.12.10
  • linux-mcp-server: 1.3.2
  • fastmcp: 2.14.6
  • pydantic: 2.12.5
  • pydantic-core: 2.41.5
  • mcp: 1.27.0
  • MCP Client: Claude Code 2.1.92

Steps to Reproduce

  1. Install on Windows: pip install --user linux-mcp-server
  2. Register with Claude Code:

claude mcp add-json "Linux-RHEL" '{"command":"C:\Users\username\AppData\Roaming\Python\Python312\Scripts\linux-mcp-server.exe","env":{"LINUX_MCP_VERIFY_HOST_KEYS":"false"}}'

  1. claude mcp list shows ✓ Connected
  2. Launch Claude Code and request any tool (e.g., "Use get_system_information to check host myserver")
  3. Server crashes — tools never register

Expected Behavior

ListToolsRequest should return the tool schemas and tools should be available in Claude Code.

Actual Behavior

Server processes ListToolsRequest, then crashes with:

CRITICAL | Fatal error in Linux MCP Server: unhandled errors in a TaskGroup (2 sub-exceptions)
...
ValueError: Circular reference detected (id repeated)

The error originates in pydantic's model_dump() during response serialization:

Workaround

Claude Code falls back to direct SSH (bash tool), which works. The MCP tools are the only thing broken.

Notes

  • Attempted downgrading pydantic to 2.11.5 — did not fix the issue
  • Attempted downgrading fastmcp to 2.3.4 — incompatible with linux-mcp-server 1.3.2
  • The server initializes correctly and the docket.worker starts — the crash is specifically in the ListToolsRequest response serialization
  • Also noting related issue linux-mcp-server is vunerable when attacking using Man in The Middle approach #304 (MITM vulnerability with default verify_host_keys=False)

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