# design-check - MCP currency gate (Phase 0 step 0)

An MCP stdio server publishes its tool list once at `initialize` and never re-reads the code, so a session bound to a process that started before the last update keeps serving the OLD tool list while still reporting "connected". Finding that out after a Debug build and a device drive wastes the run and yields a report missing the checks design-check depends on. Run this gate first, before anything expensive.

Assert both halves before continuing.

## a. Session

`mcp__multi-agent-toolkit__design_scenario_inventory` must be present in the tools available to you, and `mcp__multi-agent-toolkit__design_visual_compare` must accept `live_region`. Absent → the session is bound to a stale process.

## b. Disk

Probe what a fresh connection WOULD serve. Launch the server exactly as it is registered; under npx `args[0]` is `-y`, not a path.

Claude Code reads the registration from `~/.claude.json`:

```bash
MA_MCP_CMD=$(python3 -c "import json,os,shlex;e=json.load(open(os.path.expanduser('~/.claude.json')))['mcpServers']['multi-agent-toolkit'];print(shlex.join([e['command']]+e.get('args',[])))")
printf '%s\n%s\n' \
  '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"probe","version":"1"}}}' \
  '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' \
| eval "$MA_MCP_CMD" 2>/dev/null | python3 -c "
import sys,json
for l in sys.stdin:
    try: m=json.loads(l)
    except: continue
    if m.get('id')==1: print('version',m['result']['serverInfo']['version'])
    if m.get('id')==2:
        n=[t['name'] for t in m['result']['tools']]
        print('tools',len(n),'inventory','design_scenario_inventory' in n)"
```

On a host without `~/.claude.json` (Copilot CLI, plain shell), pipe the same two lines into the configured server command instead, for example `node "<multi-agent-toolkit path>/index.js"`.

## Branch on the two results

- **disk OK, session missing the tool** → **HALT** and tell the user to reconnect the MCP server (Claude Code: `/mcp` → `multi-agent-toolkit` → Reconnect). The quickest tell is the tool count: a stale build advertises one fewer `design_*` tool. If a reconnect does not take, stale server processes may be lingering - `pgrep -f multi-agent-toolkit-mcp/index.js` with `ps -o lstart=` shows their start times, and any that predate the code's mtime cannot serve the current tools.
- **disk itself stale** (older version, or `inventory False`) → **HALT**: the checkout needs updating before a reconnect can help.
- **both current** → continue.

Never work around a stale server by substituting a local `node` call for the missing tool: the run would silently lose the coverage gate and region alignment, which is exactly the failure this gate exists to prevent.
