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

Closed
opened 2026-06-05 14:52:35 -04:00 by yindo · 1 comment
Owner

Originally created by @miraculix95 on GitHub (May 12, 2026).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/5619

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

  • #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
Originally created by @miraculix95 on GitHub (May 12, 2026). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/5619 ### 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) ```bash 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 - #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
yindo closed this issue 2026-06-05 14:52:35 -04:00
Author
Owner

@timothycarambat commented on GitHub (May 13, 2026):

I believe there's a simpler solution that doesn't require bumping the Node version!

The root cause isn't actually Node 18, it's the use of mcp-remote as a bridge.

AnythingLLM already has native built-in support for remote MCP servers via the @modelcontextprotocol/sdk transports (SSEClientTransport and StreamableHTTPClientTransport). These work fine on Node 18.

Instead of configuring remote MCPs like this (which spawns mcp-remote and triggers the undici 7.x crash):

{
  "linear": {
    "command": "npx",
    "args": ["-y", "mcp-remote", "https://mcp.linear.app/mcp"]
  }
}

Users should configure them natively:

{
  "linear": {
    "type": "sse",
    "url": "https://mcp.linear.app/mcp",
    "headers": {
      "Authorization": "Bearer <your-token>"
    }
  }
}

Or for Streamable HTTP endpoints:

{
  "linear": {
    "type": "streamable",
    "url": "https://mcp.linear.app/mcp"
  }
}

The hypervisor already handles this in server/utils/MCP/hypervisor/index.js & it creates the appropriate transport based on the type field.

That should work in this case (and recommended since the Node version bump is a non-trivial change)

<!-- gh-comment-id:4445802524 --> @timothycarambat commented on GitHub (May 13, 2026): I believe there's a simpler solution that doesn't require bumping the Node version! The root cause isn't actually Node 18, it's the use of `mcp-remote` as a bridge. AnythingLLM already has **native built-in support** for remote MCP servers via the `@modelcontextprotocol/sdk` transports (`SSEClientTransport` and `StreamableHTTPClientTransport`). These work fine on Node 18. Instead of configuring remote MCPs like this (which spawns `mcp-remote` and triggers the undici 7.x crash): ```json { "linear": { "command": "npx", "args": ["-y", "mcp-remote", "https://mcp.linear.app/mcp"] } } ``` Users should configure them natively: ```json { "linear": { "type": "sse", "url": "https://mcp.linear.app/mcp", "headers": { "Authorization": "Bearer <your-token>" } } } ``` Or for Streamable HTTP endpoints: ```json { "linear": { "type": "streamable", "url": "https://mcp.linear.app/mcp" } } ``` The hypervisor already handles this in [`server/utils/MCP/hypervisor/index.js`](https://github.com/Mintplex-Labs/anything-llm/blob/master/server/utils/MCP/hypervisor/index.js#L422-L441) & it creates the appropriate transport based on the `type` field. That should work in this case (and recommended since the Node version bump is a non-trivial change)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#5199