skip to content
A logo Linell asked a nice AI to create. Linell Bonnette

MCP Remote Error Fix

A quick fix for `ReferenceError: TransformStream is not defined` in mcp-remote

I’m using the fast-mcp gem to create a MCP server for a Ruby on Rails project. Using npx @modelcontextprotocol/inspector to inspect the server, everything worked just fine. When I tried to connect via Claude Desktop, I got the following error in the logs:

2025-05-31T00:19:07.265Z [MCPExampleTest] [info] Initializing server...
2025-05-31T00:19:07.318Z [MCPExampleTest] [info] Server started and connected successfully
2025-05-31T00:19:07.319Z [MCPExampleTest] [info] Message from client: {"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"claude-ai","version":"0.1.0"}},"jsonrpc":"2.0","id":0}
v24.1.0
npm warn cli npm v11.3.0 does not support Node.js v16.20.1. This version of npm supports the following node versions: `^20.17.0 || >=22.9.0`. You can find the latest version at https://nodejs.org/.
11.3.0
npm warn cli npm v11.3.0 does not support Node.js v16.20.1. This version of npm supports the following node versions: `^20.17.0 || >=22.9.0`. You can find the latest version at https://nodejs.org/.
file:///Users/linell/.npm/_npx/705d23756ff7dacc/node_modules/mcp-remote/dist/chunk-ZLWDMQIP.js:6311
var EventSourceParserStream = class extends TransformStream {
^
ReferenceError: TransformStream is not defined
at file:///Users/linell/.npm/_npx/705d23756ff7dacc/node_modules/mcp-remote/dist/chunk-ZLWDMQIP.js:6311:31
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
at async loadESM (node:internal/process/esm_loader:91:5)
at async handleMainPromise (node:internal/modules/run_main:65:12)
2025-05-31T00:19:09.174Z [MCPExampleTest] [info] Server transport closed
2025-05-31T00:19:09.175Z [MCPExampleTest] [info] Client transport closed
2025-05-31T00:19:09.175Z [MCPExampleTest] [info] Server transport closed unexpectedly, this is likely due to the process exiting early. If you are developing this MCP server you can add output to stderr (i.e. `console.error('...')` in JavaScript, `print('...', file=sys.stderr)` in python) and it will appear in this log.
2025-05-31T00:19:09.175Z [MCPExampleTest] [error] Server disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging) {"context":"connection"}
2025-05-31T00:19:09.175Z [MCPExampleTest] [info] Client transport closed

This issue is caused by there being an old version of node sitting around on my machine, which is pretty normal I’m guessing. I’ve got node installed via Homebrew, but I use nvm to manage my node version, so I normally just nvm use X and then forget about it, but that doesn’t work for me here because it’s actually being started by Claude Desktop.

After a bit of digging, I came to an easy enough fix. Instead of directly invoking npx mcp-remote in the Claude config file, I added a script to my home directory and invoked that instead.

#!/bin/bash
set -e
export PATH="/opt/homebrew/bin:$PATH"
node --version >&2
npx --version >&2
exec npx mcp-remote http://localhost:3000/mcp/sse%

Then the claude_desktop_config.json is just:

{
"mcpServers": {
"MCP_Example_Test": {
"command": "/Users/linell/run-mcp-remote.sh",
"args": []
}
}
}