Skip to content

fix(mcp): scope Kiro MCP to project path and guard home-root indexing#74

Merged
sunerpy merged 1 commit into
mainfrom
fix/kiro-project-scoped-mcp
Jun 26, 2026
Merged

fix(mcp): scope Kiro MCP to project path and guard home-root indexing#74
sunerpy merged 1 commit into
mainfrom
fix/kiro-project-scoped-mcp

Conversation

@sunerpy

@sunerpy sunerpy commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Summary

Kiro launches the stdio MCP server from $HOME and its initialize handshake carries no rootUri/workspaceFolders and does not advertise capabilities.roots (confirmed by capturing Kiro's real handshake). A bare global serve --mcp therefore could not discover the project, degraded to home safe mode, and previously risked indexing the whole home tree.

This makes Kiro project-scoped and hardens indexing against too-broad roots:

  • installer(kiro): inject --path like Cursor — local install pins the concrete project root, global install pins ${workspaceFolder} for per-workspace expansion — so every Kiro window serves its own project.
  • cli(init/index): refuse a too-broad root ($HOME or filesystem root /) instead of building a home-wide index that would peg a CPU on a home-launched serve.
  • mcp(serve): on late client-root adoption, stop the home direct loop and proxy the current stdio session into the adopted project's shared daemon (run_until_adoption); effective for clients that advertise MCP roots.
  • docs: document Kiro project-level install and the init/index home-root guard.

Verification

  • make ci green locally (fmt + clippy -D warnings + full workspace test + guardrail); pre-push gate green.
  • New regression tests: Kiro local/global --path injection; guard_indexable_root rejects $HOME and /, allows nested project; run_until_adoption preserves the post-adoption stream for proxy handoff.
  • Real installer QA: install --target=kiro --local writes --path <project>; --global writes --path ${workspaceFolder}; init $HOME is refused with no .codegraph created; init in a real project still builds the db.
  • Cargo.lock diff is version-only churn (no new dependencies).

Kiro launches the stdio MCP server from $HOME and its initialize handshake
carries no rootUri/workspaceFolders and does not advertise capabilities.roots,
so a bare global `serve --mcp` could not discover the project and degraded to
home safe mode (and previously risked indexing the whole home tree).

- installer(kiro): inject --path like Cursor — local install pins the concrete
  project root, global install pins ${workspaceFolder} for per-workspace
  expansion — so every Kiro window serves its own project.
- cli(init/index): refuse a too-broad root ($HOME or filesystem root) instead
  of building a home-wide index that would peg a CPU on a home-launched serve.
- mcp(serve): on late client-root adoption, stop the home direct loop and proxy
  the current stdio session into the adopted project's shared daemon
  (run_until_adoption); effective for clients that advertise MCP roots.
- docs: document Kiro project-level install and the init/index home-root guard.
@sunerpy sunerpy merged commit fd0c049 into main Jun 26, 2026
4 checks passed
@sunerpy sunerpy deleted the fix/kiro-project-scoped-mcp branch June 26, 2026 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant