"""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)