Skip to main content
Glama

Dynamic Per-User Tool Generation MCP Server

test_mcp_client.py1.89 kB
#!/usr/bin/env python3 """ Simple MCP client to test the server """ import asyncio import json from mcp import ClientSession, StdioServerParameters from mcp.client.stdio import stdio_client async def test_with_stdio(): """Test using stdio transport (simpler than HTTP)""" # This won't work for HTTP server, but let's try HTTP client pass async def test_with_http(): """Test using HTTP transport""" from mcp.client.sse import sse_client url = "http://127.0.0.1:9092/mcp" headers = { "Authorization": "Bearer test-token" } print("🔍 Testing MCP Server via SSE client") print(f"URL: {url}") print() try: async with sse_client(url, headers=headers) as (read, write): async with ClientSession(read, write) as session: # Initialize print("📡 Initializing session...") await session.initialize() print("✅ Session initialized") print() # List tools print("📡 Listing tools...") tools = await session.list_tools() print(f"✅ Found {len(tools.tools)} tools:") print() for tool in tools.tools: print(f" 📦 {tool.name}") print(f" Description: {tool.description}") if hasattr(tool, 'inputSchema') and tool.inputSchema: props = tool.inputSchema.get('properties', {}) if props: print(f" Parameters: {list(props.keys())}") print() except Exception as e: print(f"❌ Error: {e}") import traceback traceback.print_exc() if __name__ == "__main__": asyncio.run(test_with_http())

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ShivamPansuriya/MCP-server-Python'

If you have feedback or need assistance with the MCP directory API, please join our Discord server