main
py 32 lines 900 Bytes
Raw
1 """List first-party Yahoo MCP tools through the official SDK for local acceptance."""
2 from __future__ import annotations
3
4 import argparse
5 import asyncio
6 import json
7
8 import httpx2
9 from mcp import Client
10 from mcp.client.streamable_http import streamable_http_client
11
12
13 async def list_tools(url: str) -> None:
14 async with httpx2.AsyncClient(timeout=httpx2.Timeout(5)) as http_client:
15 async with Client(
16 streamable_http_client(url, http_client=http_client),
17 read_timeout_seconds=5,
18 cache=None,
19 ) as client:
20 result = await client.list_tools()
21 print(json.dumps({"tools": sorted(item.name for item in result.tools)}))
22
23
24 def main() -> None:
25 parser = argparse.ArgumentParser()
26 parser.add_argument("--url", required=True)
27 args = parser.parse_args()
28 asyncio.run(list_tools(args.url))
29
30
31 if __name__ == "__main__":
32 main()