Spaces:
Sleeping
Sleeping
File size: 754 Bytes
ada812e 711c130 152139e ada812e a1bb2a4 711c130 ada812e 152139e ada812e 152139e ada812e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
"""
Author: Alex Punnen
Status: Demo
Note: I have hosted the server in Hugging Face Spaces.
https://huggingface.co/spaces/alexcpn/mcpserver-demo/tree/main
With the Docker file it is running at "https://alexcpn-mcpserver-demo.hf.space:7860/mcp/"
This is a simple client to call the MCP server and with that an LLM like OpenAI
"""
import asyncio
from fastmcp import Client
async def example():
async with Client("http://127.0.0.1:7860/mcp/") as client:
#async with Client("https://alexcpn-mcpserver-demo.hf.space/mcp/") as client:
await client.ping()
# List available tools
tools = await client.list_tools()
print("Available tools:", tools)
if __name__ == "__main__":
asyncio.run(example()) |