Skip to content

Commit 895b5b7

Browse files
committed
feat: migrate install-mcp-servers.sh to read from sister registry
Replace all hardcoded sister arrays and the manual JSON block with jq-driven reads from docs/sisters-registry.json. The MCP config (~/.claude/mcp.json) is now generated dynamically from the registry.
1 parent e105280 commit 895b5b7

2 files changed

Lines changed: 40 additions & 70 deletions

File tree

scripts/check-canonical-consistency.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,17 +1268,18 @@ else
12681268
done
12691269
pass "All registry sisters have required fields"
12701270

1271-
# Verify key scripts source from registry (not hardcoded)
1271+
# Verify key scripts reference the registry (not hardcoded)
12721272
REGISTRY_CONSUMERS=(
12731273
"scripts/check-canonical-consistency.sh"
12741274
"scripts/check-command-surface.sh"
1275+
"scripts/install-mcp-servers.sh"
12751276
)
12761277
for script in "${REGISTRY_CONSUMERS[@]}"; do
12771278
if [ -f "${WORKSPACE}/${script}" ]; then
1278-
if grep -qF "load-sisters.sh" "${WORKSPACE}/${script}"; then
1279-
pass "${script} sources from registry via load-sisters.sh"
1279+
if grep -qF "load-sisters.sh" "${WORKSPACE}/${script}" || grep -qF "sisters-registry.json" "${WORKSPACE}/${script}"; then
1280+
pass "${script} reads from registry"
12801281
else
1281-
fail "${script} does not source load-sisters.sh (may have hardcoded sister list)"
1282+
fail "${script} does not reference registry (may have hardcoded sister list)"
12821283
fi
12831284
fi
12841285
done

scripts/install-mcp-servers.sh

Lines changed: 35 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
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

912
set -euo pipefail
1013

1114
WORKSPACE_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
1215
CARGO_BIN="${CARGO_HOME:-$HOME/.cargo}/bin"
1316
CLAUDE_MCP_CONFIG="$HOME/.claude/mcp.json"
17+
REGISTRY="${WORKSPACE_ROOT}/docs/sisters-registry.json"
1418

1519
# Colors
1620
RED='\033[0;31m'
@@ -24,46 +28,25 @@ ok() { echo -e "${GREEN}[ok]${NC} $*"; }
2428
warn() { echo -e "${YELLOW}[warn]${NC} $*"; }
2529
fail() { 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 ─────────────────────
6142
info "Building and installing MCP server binaries..."
6243
FAILED=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

9780
mkdir -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

12897
ok "MCP config written to $CLAUDE_MCP_CONFIG"
12998

13099
# ── Step 3: Verify all binaries are reachable ──────────────────────
131100
info "Verifying installed binaries..."
132101
ALL_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"
@@ -144,7 +113,7 @@ done
144113

145114
if $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."
149118
else
150119
echo ""

0 commit comments

Comments
 (0)