Skip to main content
Glama

Petstore MCP Server

test_server.py1.53 kB
#!/usr/bin/env python3 """ Test script for the Petstore MCP Server """ import asyncio import json from petstore_mcp_server import make_api_request async def test_api_endpoints(): """Test various API endpoints""" print("Testing Petstore API endpoints...") # Test getting inventory try: print("\n1. Testing get inventory...") inventory = await make_api_request("GET", "/store/inventory") print(f"Inventory: {json.dumps(inventory, indent=2)}") except Exception as e: print(f"Error getting inventory: {e}") # Test finding pets by status try: print("\n2. Testing find pets by status...") pets = await make_api_request("GET", "/pet/findByStatus", params={"status": "available"}) print(f"Found {len(pets) if isinstance(pets, list) else 'unknown'} available pets") if isinstance(pets, list) and pets: print(f"First pet: {json.dumps(pets[0], indent=2)}") except Exception as e: print(f"Error finding pets: {e}") # Test user login (this might fail without valid credentials) try: print("\n3. Testing user login...") login_result = await make_api_request("GET", "/user/login", params={"username": "test", "password": "test"}) print(f"Login result: {json.dumps(login_result, indent=2)}") except Exception as e: print(f"Error logging in (expected): {e}") print("\nAPI tests completed!") if __name__ == "__main__": asyncio.run(test_api_endpoints())

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/raghavendraprakash/mcpforrestapis'

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