Skip to content

Trying to connect to remote MCP server stuck at "Waiting for server to respond to initialize request..." #246753

Closed

Description

@SinOverCos

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version:
~> code-insiders --version
1.100.0-insider
7dbf25d8427b59f519d04587e71a9d3dfb77224c
x64
  • my VSCode is ssh'd to my AWS EC2 instance
  • OS Version:
ubuntu 20.04

Steps to Reproduce:

  1. add remote MCP server
{
  "servers": {
    "joke-staging": {
      "type": "sse",
      "url": "http://localhost:19193/sse",
      "headers": {
        "mcp-server": "joke-staging",
      }
    }
  }
}
  1. connect via the "start" button in mcp.json

VSCode debug console says:

2025-04-16 14:13:05.469 [info] 405 status sending message to http://localhost:19193/sse, will attempt to fall back to legacy SSE
2025-04-16 14:13:05.470 [warning] Failed to parse message: "/messages/?session_id=7f7ad4150c504c3bb9b9741f1930403f"
2025-04-16 14:13:10.437 [info] Waiting for server to respond to `initialize` request...
2025-04-16 14:13:15.436 [info] Waiting for server to respond to `initialize` request...
2025-04-16 14:13:20.437 [info] Waiting for server to respond to `initialize` request...

It seems that this only comes up when connecting to an MCP server that's behind an envoy proxy, but I'm looking for anything that can help me debug what's happening. On the remote MCP server side, it all looks normal

2025-04-16T18:06:55.369234266Z - stdout: INFO:     127.0.0.1:46178 - "GET /sse HTTP/1.1" 200 OK

I can connect to this server just fine via the langgraph MCP adapter and via curl:

~> curl localhost:19193/sse -H 'mcp-server: joke-staging'
event: endpoint
data: /messages/?session_id=650f5491d6914bd989d646b7fcd327b0

Activity

  1. SinOverCos commented on Apr 16, 2025

    @SinOverCos
    Author

    Update: v1.99 doesn't have support for headers but it at least can connect via SSE to an MCP server that doesn't need headers.

    v1.100 cannot connect to an MCP server via SSE at all

  2. connor4312 commented on Apr 16, 2025

    @connor4312
    Member

    The 405 is expected as the Python SDK uses the SSE transport (now removed from the spec) instead of streamable HTTP. We fall back gracefully when this is encountered.

  3. added
    bug
    on Apr 16, 2025
  4. added a commit that references this issue on Apr 16, 2025
    8aab75c
  5. added
    unreleased
    on Apr 16, 2025
  6. added a commit that references this issue on Apr 16, 2025
    dbbebf2
  7. added
    insiders-released
    and removed
    unreleased
    on Apr 17, 2025
  8. 2 remaining items

  9. added
    verified
    on May 1, 2025
  10. TylerLeonhardt commented on May 1, 2025

    @TylerLeonhardt
    Member

    Verification steps:

    Be on Windows and run this sample https://github.com/modelcontextprotocol/python-sdk/tree/main/examples/servers/simple-tool
    With uv run mcp-simple-tool --transport sse --port 8000, and make sure it successfully discovers tools

  11. chokevin commented on May 8, 2025

    @chokevin

    Curious to know if theres another issue here? I tried to run this sample https://devblogs.microsoft.com/dotnet/build-mcp-remote-servers-with-azure-functions/ and i'm getting the same "waiting for server to respond to initialize request...". The server connects fine through MCP Inspector and through the Open AI Agents SDK so not sure if this got fixed on the vscode end. I'm on commit dac0c97 if that helps

  12. DinoChiesa commented on May 9, 2025

    @DinoChiesa

    Likewise here. I know this is closed issue, but... Following this:
    https://devblogs.microsoft.com/dotnet/build-a-model-context-protocol-mcp-server-in-csharp/.

    ...I am seeing the same endless "waiting for server to respond to initialize request..." message, in the Output when I try to connect Copilot with the local server, via STDIO.

    The settings.json has:

    {
       ...
        "mcp": {
            "inputs": [],
            "servers": {
                "mcp-sample": {
                    "type": "stdio",
                    "command": "dotnet",
                    "args": [
                        "run",
                        "--project",
                        "/usr/local/home/me/dev/dotnet/mcp/mcp-sample/mcp-sample.csproj"
                    ]
                }
            }
        }
    }
    

    If I run dotnet run --project MYCSPROJ.csproj from the terminal, the program starts up and appears to wait for messages on STDIO.

    VS code:

    Version: 1.100.0
    Commit: 19e0f9e681ecb8e5c09d8784acaa601316ca4571
    Date: 2025-05-07T12:48:53.763Z
    Electron: 34.5.1
    ElectronBuildId: 11369351
    Chromium: 132.0.6834.210
    Node.js: 20.19.0
    V8: 13.2.152.41-electron.0
    OS: Linux x64 6.12.17
    
  13. blouflashdb commented on May 25, 2025

    @blouflashdb

    Still not fixed for me in latst insiders build...

  14. antoontuijl commented on May 26, 2025

    @antoontuijl

    I also get this error when I run the MCP server in VSCode:

    2025-05-26 16:15:43.628 [info] Waiting for server to respond to initialize request...

    dotnet run works fine, but the MCP server fails to start.

  15. connor4312 commented on May 26, 2025

    @connor4312
    Member

    This error is generally a result of incorrect config or an incorrect MCP server implementation.

  16. blouflashdb commented on May 26, 2025

    @blouflashdb

    This error is generally a result of incorrect config or an incorrect MCP server implementation.

    The config is correct and the server works. I checked it with the MCP Inspector.

  17. connor4312 commented on May 27, 2025

    @connor4312
    Member

    Can you share the MCP server you see this with?

  18. blouflashdb commented on May 27, 2025

    @blouflashdb

    Can you share the MCP server you see this with?

    I created this minimal reproduction repo: https://github.com/blouflashdb/nuxt-mcp-reproduction

    npm i
    npm run dev

    The mcp server is started together with the nuxt app with SSE: http://localhost:3000/__mcp/sse

    I also created this issue: antfu/nuxt-mcp-dev#21

  19. connor4312 commented on May 27, 2025

    @connor4312
    Member

    Your MCP server:

    1. Only supports the legacy SSE strategy for connection
    2. Responds to POST requests to the MCP endpoint with a legacy SSE stream. SSE should only be served as GET. Because POST works, we asssume the server supports Streamable HTTP.

    The fix for this is to have your server return an appropriate status code (405) when trying to post to your SSE endpoint. Or update to streamable HTTP.

  20. connor4312 commented on May 27, 2025

    @connor4312
    Member

    Added a last-resort fallback in this case to make it not just break #249914 but as I said this is a bug in your server implementation and should be fixed upstream.

  21. locked and limited conversation to collaborators on May 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugchat-mcpinsiders-releasedverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions