#!/usr/bin/env python3 # The login shell's bundle as the seat node-login-shell has it: MCP over stdio, no SDK, one seat verb, execute, which says # the command it was given and the caller the call's `_meta` named. import json, sys def say(m): m["jsonrpc"] = "2.0"; sys.stdout.write(json.dumps(m) + "\n"); sys.stdout.flush() TOOLS = [ {"name": "node-login-shell.execute", "description": "run a command", "inputSchema": {"type": "object", "properties": {"command": {"type": "string"}}}}, ] for line in sys.stdin: req = json.loads(line); rid = req.get("id"); m = req.get("method"); p = req.get("params") or {} if m == "initialize": say({"id": rid, "result": {"protocolVersion": "2025-03-26", "capabilities": {"tools": {}}, "serverInfo": {"name": "zsh", "version": "1"}}}) elif m == "tools/list": say({"id": rid, "result": {"tools": TOOLS}}) elif m == "tools/call": meta = p.get("_meta") or {} said = {"ran": (p.get("arguments") or {}).get("command", ""), "caller": meta.get("mesh/caller", "")} say({"id": rid, "result": {"content": [{"type": "text", "text": json.dumps(said)}]}}) elif rid is not None: say({"id": rid, "result": {}})