|
|
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) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run() -> None: |
|
|
asyncio.run(main()) |
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
run() |
|
|
|