Skip to content

[BUG]: Remote MCP servers crash in Docker — Node 18 + undici 7.x incompatible #5619

@miraculix95

Description

@miraculix95

How are you running AnythingLLM?

Docker (mintplexlabs/anythingllm:1.12.1, also reproduces on 1.11.1)

What happened?

Configuring any remote MCP via the mcp-remote bridge (the documented pattern, e.g. for Linear) results in immediate child-process crash on AnythingLLM trying to spawn the MCP server:

/app/.npm/_npx/.../node_modules/undici/lib/web/webidl/index.js:537
webidl.is.File = webidl.util.MakeTypeAssertion(File)
                                                ^
ReferenceError: File is not defined
    at Object.<anonymous> (/app/.npm/_npx/.../node_modules/undici/lib/web/webidl/index.js:537:48)
    ...
Node.js v18.20.8

In the MCPHypervisor logs this surfaces as Transport closed / MCP error -32000: Connection closed for every mcp-remote-based server entry.

Root cause

  • AnythingLLM Docker pins node_18.x in docker/Dockerfile (both v1.11.1 and v1.12.1, NodeSource repository).
  • mcp-remote@0.1.38 (the bridge package recommended in the docs for remote MCP servers) depends on undici@^7.12.0.
  • undici 7.x npm-manifest declares "engines": { "node": ">=20.18.1" }.
  • undici 7.x references the File global at module-load time; that global only exists in Node 20+. In Node 18 it is undefined, so the module import itself crashes — before any AnythingLLM code can recover.

The crash is not endpoint-specific: it reproduces identically against Linear's hosted MCP, a self-hosted FastMCP endpoint, and any other URL passed to mcp-remote.

Affected MCPs

Any remote MCP server reached via the mcp-remote bridge:

  • Linear (https://mcp.linear.app/mcp)
  • Anthropic / cloud-hosted MCPs
  • Custom self-hosted remote MCPs (Streamable HTTP / SSE)

Local stdio MCPs (npx @modelcontextprotocol/server-X, uvx ...) that do not transitively depend on undici 7.x still work — that's why the breakage is invisible until users try a remote MCP.

Reproduction (60 seconds)

docker exec <your-anythingllm-container> sh -c \
  'npx -y mcp-remote https://mcp.linear.app/mcp'
# → crashes with the stacktrace above

Suggested fix

Update the NodeSource repository in docker/Dockerfile from node_18.x to node_20.x (or node_22.x LTS).

  • Node 20.x is in LTS since Oct 2023.
  • Node 18 reached End-of-Life on 2025-04-30.
  • Node 22.x is LTS since Oct 2024.

This unblocks the entire remote-MCP feature surface in Docker with a one-line change.

Related

  • [FEAT]: remote mcp server support for docker AnythingLLM #5051 (open) — "remote mcp server support for docker AnythingLLM". That request is actually a symptom of this root cause, not a separate feature: remote MCP via mcp-remote is already supposed to work, it just crashes immediately due to the Node version pin.

Environment

  • Image: mintplexlabs/anythingllm:1.11.1 (also tested with v1.12.1)
  • Host: Ubuntu / Docker, x86_64
  • Node inside container: v18.20.8

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