11#! /usr/bin/env bash
2- # install-mcp-servers.sh — Build and install all 5 agentic sister MCP servers
2+ # install-mcp-servers.sh — Build and install all agentic sister MCP servers
33# and configure ~/.claude/mcp.json to use the stable cargo-installed paths.
44#
55# Usage: bash scripts/install-mcp-servers.sh
66#
7+ # Sister definitions are read from docs/sisters-registry.json (single source
8+ # of truth). To add a new sister, edit the registry — not this file.
9+ #
710# This script is idempotent — safe to re-run after code changes.
811
912set -euo pipefail
1013
1114WORKSPACE_ROOT=" $( cd " $( dirname " $0 " ) /.." && pwd) "
1215CARGO_BIN=" ${CARGO_HOME:- $HOME / .cargo} /bin"
1316CLAUDE_MCP_CONFIG=" $HOME /.claude/mcp.json"
17+ REGISTRY=" ${WORKSPACE_ROOT} /docs/sisters-registry.json"
1418
1519# Colors
1620RED=' \033[0;31m'
@@ -24,46 +28,25 @@ ok() { echo -e "${GREEN}[ok]${NC} $*"; }
2428warn () { echo -e " ${YELLOW} [warn]${NC} $* " ; }
2529fail () { echo -e " ${RED} [fail]${NC} $* " ; exit 1; }
2630
27- # ── Sister definitions ─────────────────────────────────────────────
28- declare -a SISTERS=(
29- " agentic-memory"
30- " agentic-vision"
31- " agentic-codebase"
32- " agentic-identity"
33- " agentic-time"
34- )
35-
36- declare -A MCP_CRATE_PATH=(
37- [agentic-memory]=" agentic-memory/crates/agentic-memory-mcp"
38- [agentic-vision]=" agentic-vision/crates/agentic-vision-mcp"
39- [agentic-codebase]=" agentic-codebase/crates/agentic-codebase-mcp"
40- [agentic-identity]=" agentic-identity/crates/agentic-identity-mcp"
41- [agentic-time]=" agentic-time/crates/agentic-time-mcp"
42- )
43-
44- declare -A MCP_BIN_NAME=(
45- [agentic-memory]=" agentic-memory-mcp"
46- [agentic-vision]=" agentic-vision-mcp"
47- [agentic-codebase]=" agentic-codebase-mcp"
48- [agentic-identity]=" agentic-identity-mcp"
49- [agentic-time]=" agentic-time-mcp"
50- )
51-
52- declare -A MCP_ARGS=(
53- [agentic-memory]=' ["serve"]'
54- [agentic-vision]=' ["--log-level", "error", "serve"]'
55- [agentic-codebase]=' []'
56- [agentic-identity]=' []'
57- [agentic-time]=' []'
58- )
31+ if [ ! -f " $REGISTRY " ]; then
32+ fail " sisters-registry.json not found at $REGISTRY "
33+ fi
34+
35+ if ! command -v jq > /dev/null 2>&1 ; then
36+ fail " jq is required but not installed"
37+ fi
38+
39+ SISTER_COUNT=$( jq ' .sisters | length' " $REGISTRY " )
5940
6041# ── Step 1: Build and install all MCP binaries ─────────────────────
6142info " Building and installing MCP server binaries..."
6243FAILED=0
6344
64- for sister in " ${SISTERS[@]} " ; do
65- crate_path=" ${WORKSPACE_ROOT} /${MCP_CRATE_PATH[$sister]} "
66- bin_name=" ${MCP_BIN_NAME[$sister]} "
45+ for i in $( seq 0 $(( SISTER_COUNT - 1 )) ) ; do
46+ sister=$( jq -r " .sisters[$i ].repo" " $REGISTRY " )
47+ bin_name=$( jq -r " .sisters[$i ].mcp.binary" " $REGISTRY " )
48+ crate_rel=$( jq -r " .sisters[$i ].mcp.cratePath" " $REGISTRY " )
49+ crate_path=" ${WORKSPACE_ROOT} /${sister} /${crate_rel} "
6750
6851 if [ ! -d " $crate_path " ]; then
6952 warn " Skipping $sister — crate path not found: $crate_path "
@@ -96,43 +79,29 @@ info "Updating $CLAUDE_MCP_CONFIG ..."
9679
9780mkdir -p " $( dirname " $CLAUDE_MCP_CONFIG " ) "
9881
99- # Build JSON manually to avoid jq dependency
100- cat > " $CLAUDE_MCP_CONFIG " << MCPJSON
101- {
102- "mcpServers": {
103- "agentic-memory": {
104- "command": "$CARGO_BIN /agentic-memory-mcp",
105- "args": ["serve"]
106- },
107- "agentic-vision": {
108- "command": "$CARGO_BIN /agentic-vision-mcp",
109- "args": ["--log-level", "error", "serve"]
110- },
111- "agentic-codebase": {
112- "command": "$CARGO_BIN /agentic-codebase-mcp",
113- "args": []
114- },
115- "agentic-identity": {
116- "command": "$CARGO_BIN /agentic-identity-mcp",
117- "args": [],
118- "env": {}
119- },
120- "agentic-time": {
121- "command": "$CARGO_BIN /agentic-time-mcp",
122- "args": []
123- }
82+ # Build MCP config dynamically from registry
83+ jq -n --arg cargo_bin " $CARGO_BIN " --slurpfile reg " $REGISTRY " '
84+ {
85+ mcpServers: (
86+ $reg[0].sisters | map({
87+ key: .repo,
88+ value: {
89+ command: ($cargo_bin + "/" + .mcp.binary),
90+ args: .mcp.args
91+ }
92+ }) | from_entries
93+ )
12494 }
125- }
126- MCPJSON
95+ ' > " $CLAUDE_MCP_CONFIG "
12796
12897ok " MCP config written to $CLAUDE_MCP_CONFIG "
12998
13099# ── Step 3: Verify all binaries are reachable ──────────────────────
131100info " Verifying installed binaries..."
132101ALL_OK=true
133102
134- for sister in " ${SISTERS[@]} " ; do
135- bin_name=" ${MCP_BIN_NAME[$sister]} "
103+ for i in $( seq 0 $(( SISTER_COUNT - 1 )) ) ; do
104+ bin_name=$( jq -r " .sisters[ $i ].mcp.binary " " $REGISTRY " )
136105 bin_path=" $CARGO_BIN /$bin_name "
137106 if [ -x " $bin_path " ]; then
138107 ok " $bin_name ✓"
144113
145114if $ALL_OK ; then
146115 echo " "
147- ok " All 5 sister MCP servers installed and configured."
116+ ok " All $SISTER_COUNT sister MCP servers installed and configured."
148117 info " Restart Claude Code to pick up the new binaries."
149118else
150119 echo " "
0 commit comments