29 lines
644 B
Python
29 lines
644 B
Python
# client.py
|
|
import asyncio
|
|
from src.Llms.MCPs.Mcp_client import MCPClient
|
|
from src.Llms.MCPs.Http_mcp_server import HttpMCPServer
|
|
|
|
async def main():
|
|
client = MCPClient()
|
|
|
|
client.register_server(HttpMCPServer(
|
|
name="tools",
|
|
path="IGNORED_IN_CLIENT", # no importa aquí
|
|
host="127.0.0.1",
|
|
port=4300,
|
|
path_http="/tools"
|
|
))
|
|
|
|
await client.connect_all()
|
|
|
|
result = await client.call_tool({
|
|
"server": "tools",
|
|
"tool": "get_hostname",
|
|
"input": {}
|
|
})
|
|
print("RESULT:", result)
|
|
|
|
await client.disconnect_all()
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main()) |