Skip to content

Can't Run Multiple mcp-remote Servers at the Same Time #25

Open
@CahidArda

Description

@CahidArda

Hi there,

Thanks for the library, it's been great to use!

I have encountered a problem however. It doesn't work when I start mcp-remote in two terminals at the same time. This also causes issues when I try using copilot/claude/cursor while developing my server. I have to close the mcp-remote in my terminal each time.

Steps to Reproduce:

Run npx mcp-remote in two terminals at the same time. Second one doesn't work.

Details

I am connecting to an SSE server at port 8080 with:

npx mcp-remote http://localhost:8080/sse --header "Authorization: Bearer authToken"

First time I run it, it works fine. I get these logs (I changed the port numbers a little bit):

[43434] Using automatically selected callback port: 12121
[43434] Using custom headers: {"Authorization":" Bearer authToken"}
[43434] Creating lockfile for server 4f9e15cb6 with process 43434 on port 12121
[43434] OAuth callback server running at http://127.0.0.1:12121
[43434] [43434] Connecting to remote server: http://localhost:8080/sse
[43434] Connected to remote server
[43434] Local STDIO server running
[43434] Proxy established successfully between local STDIO and remote SSE
[43434] Press Ctrl+C to exit

While the server is still open in the terminal, I run the same command in another terminal and get:

[78787] Using automatically selected callback port: 90909
[78787] Using custom headers: {"Authorization":" Bearer authToken"}
[78787] Another instance is handling authentication on port 12121
[78787] Waiting for authentication from the server on port 12121...
[78787] Querying: http://127.0.0.1:12121/wait-for-auth
[78787] Authentication still in progress
[78787] Querying: http://127.0.0.1:12121/wait-for-auth
[78787] Authentication still in progress
[78787] Querying: http://127.0.0.1:12121/wait-for-auth

Note that 12121 ports are the same in both terminals.

While the second terminal sends the queries, the first terminal starts printing these logs:

[43434] Client requested no long poll, responding with 202
[43434] Long poll timeout reached, responding with 202
[43434] Long poll timeout reached, responding with 202
[43434] Long poll timeout reached, responding with 202

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions