Skip to content

Conversation

tmokmss
Copy link

@tmokmss tmokmss commented Mar 26, 2025

Motivation and Context

We must await mcp.connect function to wait for conection to complete.

https://github.com/modelcontextprotocol/typescript-sdk/blob/784012946dbc28f69708061863da6733f91c6696/src/client/index.ts#L127

How Has This Been Tested?

I got errors without await in some mcp servers (e.g. fetch).

  | Traceback (most recent call last):
  |   File "/Users/m/.cache/uv/archive-v0/_oiyv-egAw4swx8quh7R3/lib/python3.12/site-packages/mcp/shared/session.py", line 338, in _receive_loop
  |     await self._received_request(responder)
  |   File "/Users/m/.cache/uv/archive-v0/_oiyv-egAw4swx8quh7R3/lib/python3.12/site-packages/mcp/server/session.py", line 148, in _received_request
  |     raise RuntimeError(
  | RuntimeError: Received request before initialization was complete
  +------------------------------------

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant