Closed
Description
Initial Checks
- I confirm that I'm using the latest version of MCP Python SDK
- I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue
Description
I wanted to test my MCP server the same way in the examples/servers/simple-tool
however running the MCP client script I run into:
ImportError: cannot import name 'ClientSession' from partially initialized module 'mcp.client.session' (mos│
t likely due to a circular import)
Any help appreciated
Example Code
import asyncio
from mcp.client.session import ClientSession
from mcp.client.stdio import StdioServerParameters, stdio_client
async def main():
async with stdio_client(
StdioServerParameters(command="uv", args=["run", "mcp-simple-tool"])
) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
# List available tools
tools = await session.list_tools()
print(tools)
# Call the fetch tool
result = await session.call_tool("fetch", {"url": "https://example.com"})
print(result)
asyncio.run(main())
Python & MCP Python SDK
Python Version: 3.13.5
Python SDK: 1.10.1
uv: 0.7.19
Metadata
Metadata
Assignees
Labels
No labels