import asyncio
import json
from mcp.client.sse import sse_client
async def main():
"""Test MCP client connecting to the server."""
async with sse_client("http://localhost:8000/mcp") as (read_stream, write_stream):
# Initialize the client session
from mcp.client.session import ClientSession
async with ClientSession(read_stream, write_stream) as session:
# List available tools
tools = await session.list_tools()
if tools:
print(f"Found {len(tools)} tools:")
for tool in tools:
print(f"- {tool.get('name')}: {tool.get('description')}")
else:
print("No tools found.")
if __name__ == "__main__":
asyncio.run(main())