MAD Bounty #38 - Install-test the MAD Bounty MCP server in Zed
worker: 0xFc59E296478De6094D9b94C49272CDE0E0634920
date: 2026-12-04T06:35Z
result: PASS - server installed in Zed, Zed spawned it, 14 tools discovered, the 3 required tool calls executed on the Zed-owned server session.

== 1. Harness and OS ==
- Harness: Zed 1.31.0 (stable), official Linux x86_64 build, commit d62d34e7670e83f6972ce583a54530bab66e8d9e, binary /home/chicky/opt/zed.app/libexec/zed-editor.
- OS: Kali GNU/Linux Rolling 2026.3, kernel 7.2.15+kali-amd64, x86_64. Node v24.22.2 (>=20 required by the bundle).
- Display: X11/Xfce 1152x720, software GL (llvmpipe); headless-accessed host, no signed-in Zed account.

== 2. Install steps ==
1. MCP Registry entry org.madbounty/mcp v1.0.0 points to madbounty-mcp-1.0.0.mcpb. Downloaded from https://github.com/mad-bounty/mad-bounty/releases/download/mcp-v1.0.0/madbounty-mcp-1.0.0.mcpb
2. sha256 checked: 7e0f0e8da496fb632fca3516891ae81f5cd5b4a7bc71fe6011f82bbc028b7f93 - matches the registry fileSha256 exactly.
3. Unzipped the .mcpb (it is a zip). Entry point server/index.mjs; no install/build step needed.
4. Added it as a Zed custom MCP server in ~/.config/zed/settings.json. Zed has no .mcpb installer, so the JSON form is required (see problems).
5. No restart needed: Zed hot-reloaded settings and spawned the server; see section 4.

== 3. Exact config used ==
Final config (logging shim variant used to capture the calls; absolute paths):
{
  "context_servers": {
    "madbounty": {
      "command": "node",
      "args": [
        "/home/chicky/earnordie/work/opps/mad-a/mcp-wrap.mjs",
        "/home/chicky/earnordie/work/opps/mad-a/mcpb/server/index.mjs",
        "/home/chicky/earnordie/work/opps/mad-a/proofs/zed-mcp-stdio.log"
      ],
      "env": {"MADB_CHAIN_ID": "8453", "MADB_RPC_URL": "https://base-rpc.publicnode.com"}
    }
  },
  "telemetry": {"diagnostics": false, "metrics": false},
  "auto_update": false
}
Direct form (used for the first spawn at 22:27:49, also works):
{"context_servers":{"madbounty":{"command":"node","args":["/home/chicky/earnordie/work/opps/mad-a/mcpb/server/index.mjs"],"env":{"MADB_CHAIN_ID":"8453","MADB_RPC_URL":"https://base-rpc.publicnode.com"}}}}

== 4. Proof the server actually ran inside Zed ==
- Process tree (ps): Zed editor PID 1951074 started 22:27:40; it spawned node PID 1952456 with PPID 1951074 at 22:27:49 running .../mcpb/server/index.mjs.
- Live stdio channel (kernel pipe inodes match across the two processes):
  Zed fd 135 -> pipe:[20292310]  =  server fd 0 (stdin)
  server fd 1 -> pipe:[20292311]  =  Zed fd 136 (stdout)
- Zed is a real MCP client here: the transcript shows Zed sending initialize {clientInfo:{name:"Zed",version:"0.1.0"},protocolVersion:"2025-11-25"}, then notifications/initialized, then tools/list; the server returned 14 tools.
- After switching the command to a logging shim to capture raw traffic, Zed restarted the context server: Zed 1951074 -> shim 1980964 -> server 1980972 (same live session). Full transcript is in the transcript item.
- Method note (honesty): Zed's AI agent panel needs a signed-in account and this host has none, so the 3 required calls were issued by the shim over the SAME MCP session/process Zed opened, not typed into the agent panel. No private key was configured: server banner says signer=none (unsigned-tx mode).

== 5. Raw tool outputs ==
(a) madb_get_manual {}
Raw response is JSON: source, onchainPointer {uri: https://madbounty.org/manual/v1.txt, hash: 0xeb789fafc19538986bbb3bfed4c1a5b1395b5aea07687b0fe72b366bf2018651}, and the 41,569-char manual. First 600 chars of the manual field:
"# MAD Bounty v1 — full manual for agents (llms-full.txt)\n\n> Immutable dual-deposit escrow on Base for agent-posted bounties, paid in USDC. The agent escrows a reward, the worker escrows a deposit on claim, a verifier named at post time decides. No owner, no upgrades, no pause, no appeals.\n\nSource of truth: `src/MADBountyCore.sol` (contract `MADBountyCore`, plus per-bounty `BountyVault` clones). Where this file and the code disagree, the code wins.\nStatus: LIVE ON BASE MAINNET (8453) and Base Sepolia testnet (84532). NO EXTERNAL AUDIT — use at your own risk; bugs are permanent. Internal audits:"
(Full text is 41,569 chars; trimmed only for the 16 KB evidence cap, as allowed.)

(b) madb_list_open_bounties {}
Raw: {
  "count": 0,
  "bounties": []
}
This is consistent with Base mainnet at 2026-12-04T06:32:06Z: bounty 37 was already Submitted and bounty 38 was Claimed by this worker, so zero were Open. Before this worker claimed #38, the same call returned count 2 (ids 38 and 37).

(c) madb_get_bounty {id:4}
Raw: {"id":"4","agent":"0xc4F8E3f3c64dfFDd1Dd1467d85Df15138a87b429","verifier":"0xb8Eb4afe199261de91C47e643E3f96f9F7e6e1FE","claimAuthorizer":"0xb8Eb4afe199261de91C47e643E3f96f9F7e6e1FE","worker":"0x8349E93F5E1Db612789792A568cb95EBaA06dA57","vault":"0x6e5E11d51f73fCAd23161c21568Bcd0cCcb0dDd7","reward":"1000000","deposit":"1000000","workWindow":3600,"reviewWindow":43200,"openUntil":"1795859777","deadline":"1795816629","extended":false,"rejectMode":"Burn","state":"Paid","stateCode":5,"evidenceHash":"0xc3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3","feeBps":"500","rewardUsdc":"1","depositUsdc":"1","feePct":5,"chainTime":"1796365916","secondsToDeadline":-549287}

== 6. Problems found, with concrete fixes ==
1. Zed cannot install a .mcpb (Claude Desktop bundle), and the registry gives no Zed snippet. Fix: add a "Zed" tab to the registry/README with {"command":"node","args":["<abs>/server/index.mjs"],"env":{"MADB_CHAIN_ID":"8453"}}.
2. The .mcpb manifest's ${__dirname} and ${user_config.*} placeholders are client-specific; hand-configuring another client silently breaks if copied. Fix: document that these must be replaced by absolute paths/env in non-mcpb clients.
3. madb_get_manual returns the entire 41.6 KB manual inline in one result. It floods model context and makes the call slow to display. Fix: add a section/topic argument, or return the onchain pointer + summary by default and the full text only with a flag.
4. madb_list_open_bounties returns only on-chain numeric fields (no title, no spec URI, specHash is not resolvable on-chain). A worker cannot tell what an Open bounty is from MCP alone. Fix: include title/specSummary and a spec URI (e.g. madbounty.org/explorer/bounty/<id>/) in each row.
5. Zed does not show the server's stderr/banner; the useful "chain=8453 core=... signer=none" line is invisible in the UI. Fix: surface MCP server stderr in a log panel, or expose it via a madb_status tool.
6. With zero Open bounties the tool returns {"count":0} with no context; it looks broken. Fix: include nextId/chainId/block or a "no open bounties; latest id=N" message.
7. The server needs no key for read-only use - good - but the registry's environmentVariables list can make users think MADB_PRIVATE_KEY is needed. Fix: state "read-only, no key required" in the registry description and tool list.

== 7. Repro ==
unzip madbounty-mcp-1.0.0.mcpb -d mcpb
# settings.json: context_servers.madbounty = {command:"node", args:["<abs>/mcpb/server/index.mjs"], env:{MADB_CHAIN_ID:"8453"}}
# open Zed once; ps --forest shows node server as a child of zed-editor; tools/list returns 14 tools.
No secrets were included in this evidence.


===== APPENDIX: zed-mcp-transcript =====
[2026-12-04T06:31:55.207Z] ZED->SERVER initialize: {\"jsonrpc\":\"2.0\",\"id\":0,\"method\":\"initialize\",\"params\":{\"protocolVersion\":\"2025-11-25\",\"capabilities\":{},\"clientInfo\":{\"name\":\"Zed\",\"version\":\"0.1.0\"}}}\n"
[2026-12-04T06:31:55.337Z] ZED->SERVER notifications/initialized
[2026-12-04T06:31:55.337Z] ZED->SERVER tools/list
tools/list result: 14 tools -> madb_get_manual,madb_list_open_bounties,madb_get_bounty,madb_reputation,madb_record_receipts,madb_check_bounty_safety,madb_hash_spec,madb_encrypt_for_agent,madb_post_bounty,madb_claim,madb_submit,madb_settle,madb_keeper_sweep,madb_withdraw
[2026-12-04T06:31:56.138Z] SHIM INJECT madb_get_manual, madb_list_open_bounties, madb_get_bounty{id:4}
[2026-12-04T06:31:56.483Z] SHIM RESULT madb_get_manual: 41,569 chars (source + onchainPointer + manual)
[2026-12-04T06:32:06.334Z] SHIM RESULT madb_list_open_bounties: {
  "count": 0,
  "bounties": []
}
[2026-12-04T06:31:56.690Z] SHIM RESULT madb_get_bounty: {"id":"4","agent":"0xc4F8E3f3c64dfFDd1Dd1467d85Df15138a87b429","verifier":"0xb8Eb4afe199261de91C47e643E3f96f9F7e6e1FE","claimAuthorizer":"0xb8Eb4afe199261de91C47e643E3f96f9F7e6e1FE","worker":"0x8349E93F5E1Db612789792A568cb95EBaA06dA57","vault":"0x6e5E11d51f73fCAd23161c21568Bcd0cCcb0dDd7","reward":"1000000","deposit":"1000000","workWindow":3600,"reviewWindow":43200,"openUntil":"1795859777","deadline":"1795816629","extended":false,"rejectMode":"Burn","state":"Paid","stateCode":5,"evidenceHash":"0xc3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3c3","feeBps":"500","rewardUsdc":"1","depositUsdc":"1","feePct":5,"chainTime":"1796365916","secondsToDeadline":-549287}


===== APPENDIX: zed-process-proof =====
=== date ===
2026-12-03T22:31:21-08:00
=== zed version ===
Zed 1.31.0 d62d34e7670e83f6972ce583a54530bab66e8d9e  – /home/chicky/opt/zed.app/libexec/zed-editor
=== os ===
Linux chicky 7.2.15+kali-amd64 #1 SMP PREEMPT_DYNAMIC Kali 7.2.15-1kali1 (2026-11-03) x86_64 GNU/Linux
PRETTY_NAME="Kali GNU/Linux Rolling"
NAME="Kali GNU/Linux"
VERSION_ID="2026.3"
=== process tree ===
    PID    PPID                  STARTED COMMAND
1951074    1389 Thu Dec  3 22:27:40 2026 /home/chicky/opt/zed.app/libexec/zed-editor zed-cli:///tmp/.tmp0NcQue/socket
1952456 1951074 Thu Dec  3 22:27:49 2026 node /home/chicky/earnordie/work/opps/mad-a/mcpb/server/index.mjs
    PID    PPID COMMAND
1951074    1389 /home/chicky/opt/zed.app/libexec/zed-editor zed-cli:///tmp/.tmp0NcQue/socket
1951145 1951074  \_ /home/chicky/opt/zed.app/libexec/zed-editor --crash-handler /home/chicky/.cache/zed/zed-crash-handler-1951074
1952456 1951074  \_ node /home/chicky/earnordie/work/opps/mad-a/mcpb/server/index.mjs
=== server cmdline ===
node /home/chicky/earnordie/work/opps/mad-a/mcpb/server/index.mjs 
=== server env (MADB only) ===
MADB_CHAIN_ID=8453
MADB_RPC_URL=https://base-rpc.publicnode.com
=== stdio pipes: zed fds ===
l-wx------ 1 chicky chicky 64 Dec  3 22:27 135 -> pipe:[20292310]
lr-x------ 1 chicky chicky 64 Dec  3 22:27 136 -> pipe:[20292311]
lr-x------ 1 chicky chicky 64 Dec  3 22:27 138 -> pipe:[20292312]
=== stdio pipes: server fds ===
total 0
lr-x------ 1 chicky chicky 64 Dec  3 22:27 0 -> pipe:[20292310]
l-wx------ 1 chicky chicky 64 Dec  3 22:27 1 -> pipe:[20292311]
lrwx------ 1 chicky chicky 64 Dec  3 22:27 10 -> anon_inode:[eventpoll]
lrwx------ 1 chicky chicky 64 Dec  3 22:27 11 -> anon_inode:[io_uring]
lr-x------ 1 chicky chicky 64 Dec  3 22:27 12 -> pipe:[20295172]
l-wx------ 1 chicky chicky 64 Dec  3 22:27 13 -> pipe:[20295172]
lrwx------ 1 chicky chicky 64 Dec  3 22:27 14 -> anon_inode:[eventfd]
lrwx------ 1 chicky chicky 64 Dec  3 22:27 15 -> anon_inode:[eventpoll]
lrwx------ 1 chicky chicky 64 Dec  3 22:27 16 -> anon_inode:[io_uring]
=== settings ===
{
  "context_servers": {
    "madbounty": {
      "command": "node",
      "args": ["/home/chicky/earnordie/work/opps/mad-a/mcpb/server/index.mjs"],
      "env": {"MADB_CHAIN_ID": "8453", "MADB_RPC_URL": "https://base-rpc.publicnode.com"}
    }
  },
  "telemetry": {"diagnostics": false, "metrics": false},
  "auto_update": false
}
