Skip to content

Conversation

@miguelg719
Copy link
Contributor

@miguelg719 miguelg719 commented Nov 30, 2024

Updated the examples in README.md for improved accessibility and further outreach.
Fixes #80

Motivation and Context

Took a while to get the first test server running while trying to build a new custom MCP server. Although I did not give up, I'm afraid other people might; especially during first contact. I'm just trying to make it more accessible.

How Has This Been Tested?

Simplified running of the two proposed snippets into two separate files. As long as python is executable from the terminal, it will work.

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

Thanks for your efforts

# Initialize the connection
await session.initialize()
async def run():
async with stdio_client(server_params) as (read, write):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meanwhile I'm just trying to figure out how to launch a client that doesn't require launching a server in the same script lol

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like anyio supports tcp (connect_tcp). One option is to follow that route, having the server listen in a port and the client connect to it. That's probably the idea moving forward when running client/servers from different hosts (better if upgraded to TLS).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@dsp-ant dsp-ant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. These improvements make a lot of sense and help quite a bit. Really appreciated.

# Initialize the connection
await session.initialize()
async def run():
async with stdio_client(server_params) as (read, write):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dsp-ant dsp-ant merged commit c400095 into modelcontextprotocol:main Dec 2, 2024
@miguelg719 miguelg719 deleted the 80 branch December 2, 2024 17:40
gspencergoog pushed a commit to gspencergoog/mcp-python-sdk that referenced this pull request Jul 29, 2025
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.

getting this error in the default example from readme page

3 participants