41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test script to verify MCP protocol compatibility
|
|
"""
|
|
|
|
import sys
|
|
import json
|
|
import os
|
|
|
|
# Add current directory to path
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
def test_json_output():
|
|
"""Test that we can output valid JSON without interference"""
|
|
# This should work without any encoding issues
|
|
test_data = {
|
|
"jsonrpc": "2.0",
|
|
"method": "notifications/initialized",
|
|
"params": {}
|
|
}
|
|
|
|
# Output JSON to stdout (this is what MCP protocol expects)
|
|
print(json.dumps(test_data))
|
|
|
|
def test_unicode_handling():
|
|
"""Test Unicode handling in stderr only"""
|
|
# This should go to stderr only, not interfere with stdout JSON
|
|
test_unicode = "Test UTF-8: 한글 테스트 ✓"
|
|
print(f"[UTF8-TEST] {test_unicode}", file=sys.stderr)
|
|
|
|
if __name__ == "__main__":
|
|
print("[MCP-TEST] Testing JSON output compatibility...", file=sys.stderr)
|
|
test_json_output()
|
|
print("[MCP-TEST] JSON output test completed", file=sys.stderr)
|
|
|
|
print("[MCP-TEST] Testing Unicode handling...", file=sys.stderr)
|
|
test_unicode_handling()
|
|
print("[MCP-TEST] Unicode test completed", file=sys.stderr)
|
|
|
|
print("[MCP-TEST] All tests passed!", file=sys.stderr)
|