| # client_with_stdio.py | |
| import asyncio | |
| from fastmcp import Client | |
| from fastmcp.client.transports import PythonStdioTransport | |
| async def main(): | |
| transport = PythonStdioTransport( | |
| python_cmd="python", | |
| script_path="mcp_github_main.py", | |
| args=["--api-key", "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"] | |
| ) | |
| async with Client(transport) as client: | |
| tools = await client.list_tools() | |
| print("Available tools:", tools) | |
| result = await client.call_tool( | |
| "get_issues", | |
| {"owner": "jlowin", "repo": "fastmcp"} | |
| ) | |
| print("Result:", result) | |
| if __name__ == "__main__": | |
| asyncio.run(main()) | |