make-mcp-episode16-demo.sh
bash
sha256:1ff4840981f6bfcda47859c6ec5a87b31f6981766c068f05f5c49f4ed8944223
Add Episode 16 script (Muse + MCP) and MCP demo driver
Sonnet 5
patch
8 hours ago
| 1 | #!/usr/bin/env bash |
| 2 | # Drives the real MuseHub MCP stdio server for Episode 16 ("Muse + MCP"). |
| 3 | # Unlike every other episode's demo script, this one does NOT build a |
| 4 | # disposable `muse init` repo -- it requires the local MuseHub dev stack |
| 5 | # (docker compose, `musehub` + `musehub_worker` containers) already running, |
| 6 | # per ~/ecosystem/musehub/.museagent.md. Re-run any block independently; |
| 7 | # nothing here is destructive except the throwaway `mcp-episode16-demo` repo |
| 8 | # it creates on the LOCAL hub. |
| 9 | set -euo pipefail |
| 10 | |
| 11 | cd ~/ecosystem/musehub |
| 12 | |
| 13 | echo "=== Part 1: the documented path -- DEBUG=true, corrupted stdout ===" |
| 14 | echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{}}}' \ |
| 15 | | docker exec -i musehub python3 -m musehub.mcp.stdio_server >/tmp/ep16-debugtrue-stdout.log 2>/tmp/ep16-debugtrue-stderr.log |
| 16 | echo "stdout line count (should be ~1 for a clean transport): $(wc -l < /tmp/ep16-debugtrue-stdout.log)" |
| 17 | echo "first 3 lines of stdout:" |
| 18 | head -3 /tmp/ep16-debugtrue-stdout.log |
| 19 | |
| 20 | echo |
| 21 | echo "=== Part 2: DEBUG=false -- the same call, clean ===" |
| 22 | echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{}}}' \ |
| 23 | | docker exec -i -e DEBUG=false musehub python3 -m musehub.mcp.stdio_server >/tmp/ep16-debugfalse-stdout.log 2>/tmp/ep16-debugfalse-stderr.log |
| 24 | echo "stdout line count: $(wc -l < /tmp/ep16-debugfalse-stdout.log)" |
| 25 | cat /tmp/ep16-debugfalse-stdout.log |
| 26 | |
| 27 | echo |
| 28 | echo "=== Part 3: tools/resources/prompts -- real counts vs documented counts ===" |
| 29 | printf '%s\n' \ |
| 30 | '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{}}}' \ |
| 31 | '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' \ |
| 32 | '{"jsonrpc":"2.0","id":3,"method":"resources/list"}' \ |
| 33 | '{"jsonrpc":"2.0","id":4,"method":"prompts/list"}' \ |
| 34 | | docker exec -i -e DEBUG=false musehub python3 -m musehub.mcp.stdio_server 2>/dev/null \ |
| 35 | | python3 -c " |
| 36 | import json, sys |
| 37 | for line in sys.stdin: |
| 38 | d = json.loads(line) |
| 39 | if d.get('id') == 2: print('tools:', len(d['result']['tools']), '(docs claim 40)') |
| 40 | if d.get('id') == 3: print('resources:', len(d['result']['resources']), '(docs claim 29)') |
| 41 | if d.get('id') == 4: print('prompts:', len(d['result']['prompts']), '(docs claim 10)') |
| 42 | " |
| 43 | |
| 44 | echo |
| 45 | echo "=== Part 4: session context -- set_context, then the very next call ===" |
| 46 | docker exec -i -e DEBUG=false musehub python3 -m musehub.mcp.stdio_server 2>/dev/null <<'EOF' |
| 47 | {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{}}} |
| 48 | {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"musehub_set_context","arguments":{"owner":"gabriel","slug":"build-with-muse"}}} |
| 49 | {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"musehub_read_context","arguments":{}}} |
| 50 | {"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"musehub_read_context","arguments":{"owner":"gabriel","slug":"build-with-muse"}}} |
| 51 | EOF |
| 52 | |
| 53 | echo |
| 54 | echo "=== Part 5: a real write tool call against a throwaway repo ===" |
| 55 | muse -C ~/ecosystem/musehub hub repo delete gabriel/mcp-episode16-demo --yes --json > /dev/null 2>&1 || true |
| 56 | muse -C ~/ecosystem/musehub hub repo create --name mcp-episode16-demo --visibility public --json | python3 -m json.tool | head -6 |
| 57 | docker exec -i -e DEBUG=false musehub python3 -m musehub.mcp.stdio_server 2>/dev/null <<'EOF' |
| 58 | {"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{}}} |
| 59 | {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"musehub_create_issue","arguments":{"owner":"gabriel","slug":"mcp-episode16-demo","title":"Real issue filed by an LLM over MCP","body":"Created live during Episode 16 recording, via a real tools/call over the stdio JSON-RPC transport -- not simulated."}}} |
| 60 | {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"musehub_list_issues","arguments":{"owner":"gabriel","slug":"mcp-episode16-demo"}}} |
| 61 | EOF |
| 62 | |
| 63 | echo |
| 64 | echo "Demo complete." |
File History
1 commit
sha256:1ff4840981f6bfcda47859c6ec5a87b31f6981766c068f05f5c49f4ed8944223
Add Episode 16 script (Muse + MCP) and MCP demo driver
Sonnet 5
patch
8 hours ago