import json
import subprocess
import sys
def simple_test():
print("🧪 Simple JSON MCP Server Test")
print("=" * 40)
init_request = {
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {},
"clientInfo": {"name": "simple-test", "version": "1.0.0"}
}
}
print("\n1️⃣ Test: Initialize request")
print(f"Request: {json.dumps(init_request)}")
print("✅ Request formatted correctly")
tools_request = {
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list",
"params": None
}
print("\n2️⃣ Test: Tools list request")
print(f"Request: {json.dumps(tools_request)}")
print("✅ Request formatted correctly")
help_request = {
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "json-help",
"arguments": {"topic": "overview"}
}
}
print("\n3️⃣ Test: json-help tool call")
print(f"Request: {json.dumps(help_request)}")
print("✅ Request formatted correctly")
read_request = {
"jsonrpc": "2.0",
"id": 4,
"method": "tools/call",
"params": {
"name": "json-read",
"arguments": {"file_path": "./examples/sample-data.json"}
}
}
print("\n4️⃣ Test: json-read tool call")
print(f"Request: {json.dumps(read_request)}")
print("✅ Request formatted correctly")
print("\n🎉 All test requests are properly formatted!")
print("\n💡 The server is running and ready to receive these requests.")
print(" You can manually send them via stdin to test functionality.")
if __name__ == "__main__":
simple_test()