Skip to content

Client never connects #164

Done
Done

Description

@greglose

Just looking for some advice...

Ive followed the sample code and have both client and server. The server connects and seems fine. The client never connects and the line

let result = try await client.connect(transport: transport)

never moves past the await.

Is there something painfully obvious I'm missing?

TIA

Activity

  1. below commented on Nov 25, 2025

    @below

    I have a working server here. The trick seems to be that you have to keep the server running:

            // Keep running until external cancellation
            try await Task.sleep(for: .seconds(60 * 60 * 24 * 365 * 100))  // Effectively forever
  2. added
    bug
    on Jan 27, 2026
  3. jeanmatthieu commented on Dec 5, 2026

    @jeanmatthieu
    Contributor

    Two things on rel/1.0.0 (#372) address this:

    1. As noted in the thread, the server process must stay alive after start(transport:) by awaiting try await server.waitUntilFinished() (shown in docs/quick_start.md#a-stdio-server and Examples/hello-server, [P10] docs: go-sdk layout, feature guides, design notes and process docs #362).
    2. If the server does exit before initialize / server/discover completes, client.connect(transport:) now throws MCPError.connectionClosed instead of hanging forever ([P11] fix: request lifecycle, server replies, OAuth hardening #360).

    General client connect/request timeouts remain tracked in #93. Closing this issue as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions