#!/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