Files
Harbor/tests/fake_stdio_mcp.py
T
KeelrLeek 584fabeb74 Per-agent x64dbg session through debugger()/debugger_tools()
Harbor starts the x64dbg-automate MCP server (stdio) on first use and keeps
it for the life of the agent's Harbor process; the debuggee is terminated
when that process exits. Configured by debugger_command/_path/_temp in
[reverse].
2026-10-05 12:44:25 -05:00

19 lines
901 B
Python

"""A fake stdio MCP server for the debugger forwarder test: one tool that echoes, one that fails."""
import json
import sys
for line in sys.stdin:
msg = json.loads(line)
if "id" not in msg:
continue
if msg["method"] == "initialize":
result = {"protocolVersion": "2025-06-18"}
elif msg["method"] == "tools/list":
result = {"tools": [{"name": "echo", "description": "Echo", "inputSchema": {"properties": {"x": {}}}}]}
elif msg["params"]["name"] == "echo":
result = {"content": [{"type": "text", "text": "echo " + json.dumps(msg["params"]["arguments"])}]}
else:
result = {"isError": True, "content": [{"type": "text", "text": "no such session"}]}
print(json.dumps({"jsonrpc": "2.0", "method": "notifications/message", "params": {}}), flush=True)
print(json.dumps({"jsonrpc": "2.0", "id": msg["id"], "result": result}), flush=True)