From 32affb8201b25167975f5e4b5bb0caf6c1c21191 Mon Sep 17 00:00:00 2001 From: Dmytro Koba Date: Fri, 10 Jul 2026 23:20:48 +0300 Subject: [PATCH 1/2] fix(kiro): self-healing MCP path resolution in dev checkouts, bump to 2.4.1 .mcp.kiro.json's ${KIRO_PLUGIN_ROOT:-$PWD/.kiro/..} fallback resolved to the repo root instead of plugins/simulator/ when a developer opened the repo directly in Kiro without running install-kiro.sh, so the server tried to run a nonexistent /mcp-server/run.sh. It now probes for mcp-server/run.sh at that path and falls back to plugins/simulator/ when missing. install-kiro.sh now sed-resolves the same fallback to the absolute plugin path when generating a workspace's mcp.json, instead of a plain copy, so an installed workspace no longer depends on KIRO_PLUGIN_ROOT at runtime either. Updates README's Kiro install instructions to match and adds .env/.kiro to .gitignore. Co-Authored-By: Claude Sonnet 5 --- .agents/plugins/marketplace.json | 2 +- .claude-plugin/marketplace.json | 2 +- .gitignore | 4 ++++ CHANGELOG.md | 5 +++++ README.md | 4 ++-- plugins/simulator/.claude-plugin/plugin.json | 2 +- plugins/simulator/.codex-plugin/plugin.json | 2 +- plugins/simulator/.kiro-plugin/plugin.json | 2 +- plugins/simulator/.mcp.kiro.json | 2 +- plugins/simulator/scripts/install-kiro.sh | 6 ++++-- 10 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.agents/plugins/marketplace.json b/.agents/plugins/marketplace.json index d7bff5f..8c88745 100644 --- a/.agents/plugins/marketplace.json +++ b/.agents/plugins/marketplace.json @@ -6,7 +6,7 @@ "plugins": [ { "name": "simulator", - "version": "2.4.0", + "version": "2.4.1", "source": { "source": "local", "path": "./plugins/simulator" diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 4179577..16ef33a 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -9,7 +9,7 @@ "name": "simulator", "source": "./plugins/simulator", "description": "Simulator.Company platform assistant. Exposes the Simulator REST API as an MCP server and provides skills for managing actors, forms, graph structures, and financial accounts.", - "version": "2.4.0", + "version": "2.4.1", "author": { "name": "Simulator.Company", "url": "https://simulator.company" diff --git a/.gitignore b/.gitignore index 00e45be..d49606c 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,7 @@ dump.rdb # Runtime overlays under .kiro/ are generated from the canonical skills tree — # committing them would only invite drift. /dist/ + +# Kiro +.env +.kiro diff --git a/CHANGELOG.md b/CHANGELOG.md index e1ef795..2b446fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [2.4.1] + +### Fixed +- **Kiro MCP server path resolution in a dev checkout.** `.mcp.kiro.json`'s `${KIRO_PLUGIN_ROOT:-$PWD/.kiro/..}` fallback resolved to the repo root (not `plugins/simulator/`) when a developer opened the repo directly in Kiro without running `install-kiro.sh`, so the server tried (and failed) to run `/mcp-server/run.sh`. It now probes for `mcp-server/run.sh` at that path and falls back to `plugins/simulator/` when missing. `install-kiro.sh` also now `sed`-resolves the same fallback to the absolute plugin path when generating a workspace's `mcp.json`, instead of a plain copy, so an external workspace's config no longer depends on `KIRO_PLUGIN_ROOT` at all. README's Kiro install instructions updated to match. + ## [2.4.0] ### Added diff --git a/README.md b/README.md index 529c0c1..2b266d9 100644 --- a/README.md +++ b/README.md @@ -90,10 +90,10 @@ Kiro has no marketplace command and does not resolve the `$CLAUDE_PLUGIN_ROOT` t ```bash git clone https://github.com/corezoid/simulator-ai-plugin cd simulator-ai-plugin -plugins/simulator/scripts/install-kiro.sh [workspace-dir] # defaults to $KIRO_WORKSPACE_DIR or the current dir +sh plugins/simulator/scripts/install-kiro.sh . # installs into the current dir; pass another workspace-dir instead of `.` to target elsewhere ``` -This writes the MCP entry to `/.kiro/settings/mcp.json`, symlinks the steering file into `.kiro/steering/`, and hard-copies each skill into `.kiro/skills//` with `$CLAUDE_PLUGIN_ROOT` replaced by the absolute plugin path. Open the workspace in Kiro and the MCP server, skills, and steering are picked up automatically. The plugin is also published to [kiro.dev/powers](https://kiro.dev/powers) — see [`POWER.md`](POWER.md). +This writes the MCP entry to `/.kiro/settings/mcp.json` with the plugin path resolved to an absolute path (no reliance on `KIRO_PLUGIN_ROOT` or workspace layout), symlinks the steering file into `.kiro/steering/`, and hard-copies each skill into `.kiro/skills//` with `$CLAUDE_PLUGIN_ROOT` replaced the same way. Open the workspace in Kiro and the MCP server, skills, and steering are picked up automatically. `.mcp.kiro.json` also self-heals if Kiro loads it directly without the script ever having run — it probes for `mcp-server/run.sh` next to its workspace-root guess and falls back to `plugins/simulator/` when that guess misses. The plugin is also published to [kiro.dev/powers](https://kiro.dev/powers) — see [`POWER.md`](POWER.md). ### Updating diff --git a/plugins/simulator/.claude-plugin/plugin.json b/plugins/simulator/.claude-plugin/plugin.json index fc8c0bb..84a14ab 100644 --- a/plugins/simulator/.claude-plugin/plugin.json +++ b/plugins/simulator/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "simulator", - "version": "2.4.0", + "version": "2.4.1", "description": "Simulator.Company platform assistant. Exposes the Simulator REST API as an MCP server and provides skills for managing actors, forms, graph structures, and financial accounts.", "author": { "name": "Simulator.Company", diff --git a/plugins/simulator/.codex-plugin/plugin.json b/plugins/simulator/.codex-plugin/plugin.json index fc8c0bb..84a14ab 100644 --- a/plugins/simulator/.codex-plugin/plugin.json +++ b/plugins/simulator/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "simulator", - "version": "2.4.0", + "version": "2.4.1", "description": "Simulator.Company platform assistant. Exposes the Simulator REST API as an MCP server and provides skills for managing actors, forms, graph structures, and financial accounts.", "author": { "name": "Simulator.Company", diff --git a/plugins/simulator/.kiro-plugin/plugin.json b/plugins/simulator/.kiro-plugin/plugin.json index 246e9ac..4d8b26a 100644 --- a/plugins/simulator/.kiro-plugin/plugin.json +++ b/plugins/simulator/.kiro-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "simulator", - "version": "2.4.0", + "version": "2.4.1", "description": "Simulator.Company platform assistant. Exposes the Simulator REST API as an MCP server and provides skills for managing actors, forms, graph structures, and financial accounts.", "author": { "name": "Simulator.Company", diff --git a/plugins/simulator/.mcp.kiro.json b/plugins/simulator/.mcp.kiro.json index 28b18a8..1a1e6d5 100644 --- a/plugins/simulator/.mcp.kiro.json +++ b/plugins/simulator/.mcp.kiro.json @@ -2,7 +2,7 @@ "mcpServers": { "simulator": { "command": "sh", - "args": ["-c", "export PLUGIN_ROOT=\"${KIRO_PLUGIN_ROOT:-$PWD/.kiro/..}\"; export SIMULATOR_WORK_DIR=\"$PWD\"; exec sh \"$PLUGIN_ROOT/mcp-server/run.sh\""] + "args": ["-c", "PLUGIN_ROOT=\"${KIRO_PLUGIN_ROOT:-$PWD/.kiro/..}\"; [ -f \"$PLUGIN_ROOT/mcp-server/run.sh\" ] || PLUGIN_ROOT=\"$PLUGIN_ROOT/plugins/simulator\"; export PLUGIN_ROOT SIMULATOR_WORK_DIR=\"$PWD\"; exec sh \"$PLUGIN_ROOT/mcp-server/run.sh\""] } } } diff --git a/plugins/simulator/scripts/install-kiro.sh b/plugins/simulator/scripts/install-kiro.sh index 5bc845a..56543dd 100755 --- a/plugins/simulator/scripts/install-kiro.sh +++ b/plugins/simulator/scripts/install-kiro.sh @@ -37,8 +37,10 @@ fi mkdir -p "$KIRO_DIR/settings" "$KIRO_DIR/steering" "$KIRO_DIR/skills" -# 1) MCP entry — always plain copy (workspace-local edits must not leak back). -cp "$PLUGIN_ROOT/.mcp.kiro.json" "$KIRO_DIR/settings/mcp.json" +# 1) MCP entry — resolve the KIRO_PLUGIN_ROOT fallback to the known absolute +# plugin path so the generated mcp.json works without the env var being set. +sed 's#\${KIRO_PLUGIN_ROOT:-\$PWD/.kiro/..}#'"$PLUGIN_ROOT"'#g' \ + "$PLUGIN_ROOT/.mcp.kiro.json" > "$KIRO_DIR/settings/mcp.json" # 2) Steering — small, stable, no token substitution needed. Symlink on POSIX, # hard-copy on Windows shells. From d40e4ace6f45ab32c1c06755760544a34d658129 Mon Sep 17 00:00:00 2001 From: Dmytro Koba Date: Fri, 10 Jul 2026 23:34:29 +0300 Subject: [PATCH 2/2] fix(kiro): harden sed escaping, add run.sh guard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - install-kiro.sh: escape \, & and the # delimiter in PLUGIN_ROOT before splicing it into the sed replacement, so a stray one of those characters in the clone path (unusual but possible) can't corrupt the substitution. - .mcp.kiro.json: add a final guard after the probe/fallback — if mcp-server/run.sh still isn't found under either candidate PLUGIN_ROOT, print a clear error and exit 1 instead of failing with a confusing exec error. Co-Authored-By: Claude Sonnet 5 --- plugins/simulator/.mcp.kiro.json | 2 +- plugins/simulator/scripts/install-kiro.sh | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/simulator/.mcp.kiro.json b/plugins/simulator/.mcp.kiro.json index 1a1e6d5..9e42a69 100644 --- a/plugins/simulator/.mcp.kiro.json +++ b/plugins/simulator/.mcp.kiro.json @@ -2,7 +2,7 @@ "mcpServers": { "simulator": { "command": "sh", - "args": ["-c", "PLUGIN_ROOT=\"${KIRO_PLUGIN_ROOT:-$PWD/.kiro/..}\"; [ -f \"$PLUGIN_ROOT/mcp-server/run.sh\" ] || PLUGIN_ROOT=\"$PLUGIN_ROOT/plugins/simulator\"; export PLUGIN_ROOT SIMULATOR_WORK_DIR=\"$PWD\"; exec sh \"$PLUGIN_ROOT/mcp-server/run.sh\""] + "args": ["-c", "PLUGIN_ROOT=\"${KIRO_PLUGIN_ROOT:-$PWD/.kiro/..}\"; [ -f \"$PLUGIN_ROOT/mcp-server/run.sh\" ] || PLUGIN_ROOT=\"$PLUGIN_ROOT/plugins/simulator\"; [ -f \"$PLUGIN_ROOT/mcp-server/run.sh\" ] || { echo \"ERROR: cannot locate mcp-server/run.sh (checked KIRO_PLUGIN_ROOT and the plugins/simulator fallback under $PLUGIN_ROOT)\" >&2; exit 1; }; export PLUGIN_ROOT SIMULATOR_WORK_DIR=\"$PWD\"; exec sh \"$PLUGIN_ROOT/mcp-server/run.sh\""] } } } diff --git a/plugins/simulator/scripts/install-kiro.sh b/plugins/simulator/scripts/install-kiro.sh index 56543dd..725ae3f 100755 --- a/plugins/simulator/scripts/install-kiro.sh +++ b/plugins/simulator/scripts/install-kiro.sh @@ -39,7 +39,10 @@ mkdir -p "$KIRO_DIR/settings" "$KIRO_DIR/steering" "$KIRO_DIR/skills" # 1) MCP entry — resolve the KIRO_PLUGIN_ROOT fallback to the known absolute # plugin path so the generated mcp.json works without the env var being set. -sed 's#\${KIRO_PLUGIN_ROOT:-\$PWD/.kiro/..}#'"$PLUGIN_ROOT"'#g' \ +# Escape \, & and our # delimiter so a stray one of those in PLUGIN_ROOT +# (e.g. a `#` in the clone path) can't corrupt the sed replacement. +PLUGIN_ROOT_ESCAPED="$(printf '%s\n' "$PLUGIN_ROOT" | sed 's/[\&#]/\\&/g')" +sed 's#\${KIRO_PLUGIN_ROOT:-\$PWD/.kiro/..}#'"$PLUGIN_ROOT_ESCAPED"'#g' \ "$PLUGIN_ROOT/.mcp.kiro.json" > "$KIRO_DIR/settings/mcp.json" # 2) Steering — small, stable, no token substitution needed. Symlink on POSIX,