mcpserver-demo / fastmcp_client.py
alexcpn's picture
MCP Server Demo
ada812e
raw
history blame
483 Bytes
"""
Author: Alex Punnen
Status: Demo
"""
import asyncio
from fastmcp import Client
async def example():
async with Client("http://127.0.0.1:7860/mcp") as client:
await client.ping()
# List available tools
tools = await client.list_tools()
print("Available tools:", tools)
tool_result = await client.call_tool("add", {"a": "1", "b": "2"})
print("Tool result:", tool_result)
if __name__ == "__main__":
asyncio.run(example())