"""Test client for GitHub MCP tools"""
import asyncio
import logging
from mcp.client.session import ClientSession
from mcp.client.streamable_http import streamablehttp_client
# Set up logging
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
logger = logging.getLogger(__name__)
async def test_github_tools():
"""Test all GitHub MCP tools comprehensively"""
# Connect to your MCP server
async with streamablehttp_client(url="http://localhost:3001/mcp/") as (
read_stream,
write_stream,
_,
):
# Create a session using the client streams
async with ClientSession(read_stream, write_stream) as session:
# Initialize the connection
await session.initialize()
# List all available tools
paginated_tools = await session.list_tools()
all_tools = [tool.name for tool in paginated_tools.tools]
print(all_tools)
result = await session.call_tool(
"get_cpu_usage", arguments={}
)
print(result)
if __name__ == "__main__":
asyncio.run(test_github_tools())