mcp-bridge / test_client.py
patdev's picture
Sync MCP Bridge
0629dc1 verified
Raw
History Blame Contribute Delete
666 Bytes
import argparse
import asyncio
from typing import Dict
from fastmcp import Client
async def main() -> None:
parser = argparse.ArgumentParser(description="Test MCP Bridge")
parser.add_argument("--url", default="http://localhost:7860/sse")
parser.add_argument("--api-key", required=True)
args = parser.parse_args()
headers: Dict[str, str] = {"Authorization": f"Bearer {args.api_key}"}
async with Client(args.url, headers=headers) as client:
tools = await client.list_tools()
print("Tools:")
for tool in tools:
print("-", getattr(tool, "name", tool))
if __name__ == "__main__":
asyncio.run(main())