Spaces:
Running
Running
corrected client access
Browse files- fastmcp_client.py +7 -3
- fastmcp_server.py +3 -3
fastmcp_client.py
CHANGED
|
@@ -1,14 +1,18 @@
|
|
| 1 |
"""
|
| 2 |
Author: Alex Punnen
|
| 3 |
Status: Demo
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
"""
|
| 5 |
import asyncio
|
| 6 |
from fastmcp import Client
|
| 7 |
-
|
| 8 |
|
| 9 |
async def example():
|
| 10 |
-
#async with Client("http://127.0.0.1:7860/mcp") as client:
|
| 11 |
-
async with Client("https://alexcpn-
|
| 12 |
await client.ping()
|
| 13 |
# List available tools
|
| 14 |
tools = await client.list_tools()
|
|
|
|
| 1 |
"""
|
| 2 |
Author: Alex Punnen
|
| 3 |
Status: Demo
|
| 4 |
+
Note: I have hosted the server in Hugging Face Spaces.
|
| 5 |
+
https://huggingface.co/spaces/alexcpn/mcpserver-demo/tree/main
|
| 6 |
+
With the Docker file it is running at "https://alexcpn-mcpserver-demo.hf.space:7860/mcp/"
|
| 7 |
+
This is a simple client to call the MCP server.
|
| 8 |
"""
|
| 9 |
import asyncio
|
| 10 |
from fastmcp import Client
|
| 11 |
+
|
| 12 |
|
| 13 |
async def example():
|
| 14 |
+
#async with Client("http://127.0.0.1:7860/mcp/") as client:
|
| 15 |
+
async with Client("https://alexcpn-mcpserver-demo.hf.space/mcp/") as client:
|
| 16 |
await client.ping()
|
| 17 |
# List available tools
|
| 18 |
tools = await client.list_tools()
|
fastmcp_server.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
"""
|
| 2 |
-
This is much simple
|
| 3 |
|
| 4 |
-
|
| 5 |
-
and
|
| 6 |
|
| 7 |
Author: Alex Punnen
|
| 8 |
Status: Demo
|
|
|
|
| 1 |
"""
|
| 2 |
+
This is much simple MCP server based on FastMCP amd transport streamable-http.
|
| 3 |
|
| 4 |
+
Ref https://github.com/modelcontextprotocol/python-sdk/?tab=readme-ov-file#quickstart
|
| 5 |
+
and https://gofastmcp.com/deployment/running-server
|
| 6 |
|
| 7 |
Author: Alex Punnen
|
| 8 |
Status: Demo
|