Files
python-sdk/run_mock_server.py
T
zeekay a99730cbb0 feat: Add CLI tools support to hanzo-mcp with batch execution
- Implement unified CLI tools module for all AI providers
- Add support for claude/cc, codex, gemini, grok, openhands/oh, hanzo-dev, cline, aider
- Enable parallel batch execution of CLI tools
- Add comprehensive test suite with 16 passing tests
- Fix typing issues with mypy strict mode
- Add GitHub Actions CI/CD workflow with optional integration tests
- Support authentication flow for all providers
- Follow DRY principle with single source of truth
2025-09-05 18:26:03 -05:00

61 lines
1.7 KiB
Python

#!/usr/bin/env python3
import json
import time
from threading import Thread
from http.server import HTTPServer, BaseHTTPRequestHandler
class MockHandler(BaseHTTPRequestHandler):
def do_POST(self):
if self.path == "/utils/token_counter":
self.send_response(200)
self.send_header("Content-Type", "application/json")
self.end_headers()
response = {
"model_used": "gpt-3.5-turbo",
"request_model": "gpt-3.5-turbo",
"tokenizer_type": "cl100k_base",
"total_tokens": 10,
}
self.wfile.write(json.dumps(response).encode())
else:
self.send_response(200)
self.send_header("Content-Type", "application/json")
self.end_headers()
self.wfile.write(b"{}")
def do_GET(self):
self.send_response(200)
self.send_header("Content-Type", "application/json")
self.end_headers()
self.wfile.write(b"{}")
def do_PUT(self):
self.send_response(200)
self.send_header("Content-Type", "application/json")
self.end_headers()
self.wfile.write(b"{}")
def do_DELETE(self):
self.send_response(200)
self.send_header("Content-Type", "application/json")
self.end_headers()
self.wfile.write(b"{}")
def log_message(self, format, *args):
pass
server = HTTPServer(("127.0.0.1", 4010), MockHandler)
thread = Thread(target=server.serve_forever)
thread.daemon = True
thread.start()
print("Mock server ready on port 4010")
# Keep server running
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
server.shutdown()