Skip to main content
Glama

CloudNativePG MCP Server

by helxplatform
test_mcp_server.py•1.77 kB
#!/usr/bin/env python3 """ Simple test script to verify MCP server is working correctly. This tests the server by calling it directly without the inspector. """ import asyncio import json from mcp.client.stdio import stdio_client, StdioServerParameters from mcp.types import CallToolRequest async def test_server(): """Test the MCP server by connecting to it and listing tools.""" print("šŸ”§ Starting test of CloudNativePG MCP server...") # Start the server as a subprocess server_params = StdioServerParameters( command="python", args=["cnpg_mcp_server.py"], ) async with stdio_client(server_params) as (read, write): print("āœ… Connected to server") # Initialize the connection from mcp.client.session import ClientSession async with ClientSession(read, write) as session: print("āœ… Session initialized") # Initialize the protocol result = await session.initialize() print(f"āœ… Protocol initialized") print(f" Server name: {result.serverInfo.name}") print(f" Server version: {result.serverInfo.version}") print(f" Capabilities: {result.capabilities}") # List available tools tools_result = await session.list_tools() print(f"\nšŸ“‹ Found {len(tools_result.tools)} tools:") for tool in tools_result.tools: print(f"\n • {tool.name}") print(f" Description: {tool.description[:100]}...") print(f" Required params: {tool.inputSchema.get('required', [])}") print("\nāœ… All tests passed! Server is working correctly.") if __name__ == "__main__": asyncio.run(test_server())

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/helxplatform/cnpg-mcp'

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