Skip to main content
Glama
test_simple_http_mcp.pyโ€ข4.53 kB
#!/usr/bin/env python3 """ Simple test script for HTTP MCP Notion server using requests library """ import requests import json def test_http_mcp_server(): """Test the deployed HTTP MCP server""" server_url = "https://notion-mcp-server-5s5v.onrender.com/" print("๐Ÿงช Testing HTTP MCP Server (Simple Version)") print("=" * 50) print(f"๐ŸŒ Server URL: {server_url}") try: # Test 1: Health Check print("\n๐Ÿ“‹ Test 1: Health Check") response = requests.get(server_url, timeout=10) if response.status_code == 200: data = response.json() print("โœ… Server is running") print(f"๐Ÿ“ Status: {data.get('status')}") print(f"๐Ÿ”ง Transport: {data.get('transport')}") print(f"๐Ÿ› ๏ธ Available tools: {', '.join(data.get('available_tools', []))}") else: print(f"โŒ Health check failed: {response.status_code}") return False # Test 2: List Tools print("\n๐Ÿ“‹ Test 2: List Tools") tools_request = { "jsonrpc": "2.0", "method": "tools/list", "id": 1 } response = requests.post( server_url, json=tools_request, headers={"Content-Type": "application/json"}, timeout=10 ) if response.status_code == 200: data = response.json() print("โœ… Tools list retrieved successfully") tools = data.get("result", {}).get("tools", []) print(f"๐Ÿ“Š Found {len(tools)} tools:") for tool in tools: print(f" โ€ข {tool.get('name')}: {tool.get('description')}") else: print(f"โŒ Tools list failed: {response.status_code}") print(f"Error: {response.text}") return False # Test 3: Search Notion Pages print("\n๐Ÿ“‹ Test 3: Search Notion Pages") search_request = { "jsonrpc": "2.0", "method": "tools/call", "params": { "name": "search_notion_pages", "arguments": { "query": "test", "page_size": 3 } }, "id": 2 } response = requests.post( server_url, json=search_request, headers={"Content-Type": "application/json"}, timeout=15 ) if response.status_code == 200: data = response.json() print("โœ… Search tool called successfully") result = data.get("result", {}) content = result.get("content", []) if content: search_result = content[0].get("text", "No text content") print(f"๐Ÿ” Search result preview:") print(f" {search_result[:200]}..." if len(search_result) > 200 else f" {search_result}") else: print("๐Ÿ“ No content in result") print(f"Raw result: {json.dumps(result, indent=2)}") else: print(f"โŒ Search failed: {response.status_code}") print(f"Error: {response.text}") print("\n๐ŸŽ‰ All HTTP MCP tests completed!") return True except requests.exceptions.RequestException as e: print(f"โŒ Request failed: {e}") return False except Exception as e: print(f"โŒ Test failed with error: {e}") import traceback traceback.print_exc() return False def main(): """Main test function""" print("๐Ÿงช HTTP MCP Server Test Suite (Simple)") print("=" * 60) try: # Test the deployed server result = test_http_mcp_server() print("\n" + "=" * 60) if result: print("๐ŸŽ‰ HTTP MCP server is working perfectly!") print("๐Ÿš€ Your deployed server is ready!") print("\n๐Ÿ“ Next steps:") print(" 1. Install aiohttp: pip install aiohttp") print(" 2. Run the full integration test: python test_notion_mcp.py") print(" 3. Try your chatbot with Notion integration!") else: print("โŒ HTTP MCP server has issues") return 0 if result else 1 except Exception as e: print(f"โŒ Test suite failed: {e}") return 1 if __name__ == "__main__": exit(main())

Latest Blog Posts

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/ankitmalik84/Agentic_Longterm_Memory'

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