#!/usr/bin/env python3 """Minimal stdio MCP-ish echo server for LazyBoy Tool Manager fixtures. Speaks a tiny JSON-RPC subset: initialize, tools/list, tools/call. Not a substitute for a full MCP SDK; used to prove install → bind → call. """ import json import sys def reply(message_id, result): sys.stdout.write(json.dumps({"jsonrpc": "2.0", "id": message_id, "result": result}) + "\n") sys.stdout.flush() def main(): for line in sys.stdin: line = line.strip() if not line: continue request = json.loads(line) method = request.get("method") message_id = request.get("id") if method == "initialize": reply(message_id, {"protocolVersion": "2025-11-25", "serverInfo": {"name": "lazyboy-echo"}}) elif method == "tools/list": reply( message_id, { "tools": [ { "name": "echo", "description": "Echo text from the bound Computer", "inputSchema": { "type": "object", "properties": {"text": {"type": "string"}}, "required": ["text"], }, } ] }, ) elif method == "tools/call": args = (request.get("params") or {}).get("arguments") or {} text = args.get("text", "") reply(message_id, {"content": [{"type": "text", "text": text}]}) elif method == "notifications/initialized": continue else: reply(message_id, {"error": f"unknown method {method}"}) if __name__ == "__main__": main()