This repository contains a minimal client-server setup to demonstrate what seems like a bug in mcp-remote where ping responses are not getting back to the end-client in version 0.1.22 onwards.
Starting from mcp-remote version 0.1.22, ping messages initiated by server are not being properly forwarded back to the end-client by mcp-remote, causing connection issues. Version 0.1.21 and earlier work correctly. In this test setup, the server sends a ping message every 5 seconds, and will disconnect client after 3 failed pings, an approach commonly used to detect dead connections.
-
Install dependencies:
npm install
-
Start the server (Terminal 1):
npm run server
-
Run the client (Terminal 2):
npm run client <version>
Example versions to test:
npm run client 0.1.21- Working versionnpm run client 0.1.22- Affected version
- Version <= 0.1.21: Ping messages should successfully round-trip between client and server. We can see ping requests and responses in the logs, continuing indefinitely, on all three participants (server,
mcp-remote-fallback-test, client). - Version >= 0.1.22: Ping messages fail to reach end-client after an initial, single ping.
mcp-remote-fallback-testsdoes keep responding continuously. The server logs show ping requests being sent, but no corresponding responses are logged on the end-client side. After 3 failed pings, the server disconnects the client. We can see that there is an error from mcp-remote logs (Error from remote server: TypeError: Cannot read properties of undefined (reading 'method')) that did not occur in earlier versions.
src/server.ts- MCP server implementationsrc/client.ts- MCP client that connects via mcp-remote (version supplied as argument)src/logger.ts- Shared logging configuration