fix(mcp): scope Kiro MCP to project path and guard home-root indexing#74
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Kiro launches the stdio MCP server from
$HOMEand itsinitializehandshake carries norootUri/workspaceFoldersand does not advertisecapabilities.roots(confirmed by capturing Kiro's real handshake). A bare globalserve --mcptherefore 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:
--pathlike Cursor — local install pins the concrete project root, global install pins${workspaceFolder}for per-workspace expansion — so every Kiro window serves its own project.$HOMEor filesystem root/) instead of building a home-wide index that would peg a CPU on a home-launched serve.run_until_adoption); effective for clients that advertise MCP roots.Verification
make cigreen locally (fmt + clippy-D warnings+ full workspace test + guardrail); pre-push gate green.--pathinjection;guard_indexable_rootrejects$HOMEand/, allows nested project;run_until_adoptionpreserves the post-adoption stream for proxy handoff.install --target=kiro --localwrites--path <project>;--globalwrites--path ${workspaceFolder};init $HOMEis refused with no.codegraphcreated;initin a real project still builds the db.Cargo.lockdiff is version-only churn (no new dependencies).