File size: 827 Bytes
d8229c6 | 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 27 28 29 | import asyncio
import os
from typing import Any
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
MCP_BASE = os.getenv("TOPCODER_MCP_BASE", "https://api.topcoder-dev.com/v6/mcp/mcp")
async def main() -> None:
async with streamablehttp_client(MCP_BASE) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
tools = await session.list_tools()
names = [t.name for t in tools.tools]
print("Tools:", names)
# If a challenges tool exists, try a harmless list/describe call signature
# We just print availability here; you can extend to actual tool calls once schema is known
def run() -> None:
asyncio.run(main())
if __name__ == "__main__":
run()
|