Skip to main content
Glama

Government of Canada Open Data MCP Servers

by krunal16-c
test_server.pyโ€ข1.8 kB
#!/usr/bin/env python3 """ Quick test to verify the Government MCP Server is working correctly. """ import sys import asyncio from gov_mcp.server import GovernmentMCPServer from gov_mcp.api_client import OpenGovCanadaClient async def test_server(): """Test server initialization and tools.""" print("=" * 70) print("๐Ÿงช Government MCP Server - Quick Test") print("=" * 70) try: # Test 1: Server initialization print("\n1๏ธโƒฃ Testing server initialization...") server = GovernmentMCPServer() print(" โœ“ Server created successfully") # Test 2: API client print("\n2๏ธโƒฃ Testing API client...") client = OpenGovCanadaClient() print(" โœ“ API client initialized") # Test 3: Try a simple API call print("\n3๏ธโƒฃ Testing API connectivity...") try: # Try to list organizations (simple, lightweight call) orgs = client.list_organizations() print(f" โœ“ Connected to API successfully") print(f" โœ“ Found {len(orgs)} organizations") except Exception as e: print(f" โ„น API call failed (may need internet): {e}") print("\n" + "=" * 70) print("โœจ All tests passed! Server is ready.") print("=" * 70) print("\n๐Ÿš€ To start the server, run:") print(" python -m gov_mcp.server") print("\n๐Ÿ“š To see examples, run:") print(" python examples.py") return True except Exception as e: print(f"\nโŒ Test failed: {e}") import traceback traceback.print_exc() return False if __name__ == "__main__": success = asyncio.run(test_server()) sys.exit(0 if success else 1)

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/krunal16-c/gov-ca-mcp'

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