Search

0008: Notify the Real Extension Host After MCP Mutations

On this page

Status: Proposed Date: 2026-06-25 Supersedes: N/A Superseded by: N/A

Context

MCP file mutation handlers update the shared VFS and index directly through the domain mutation service. Extensions such as AST and LSP maintain their own derived state from file events. The filesystem watcher cannot always compensate for missing notifications because it may observe an idempotent event after the MCP mutation has already updated the shared VFS.

Project feedback identified a concrete failure: using NoOpPluginHost in MCP mutation handlers can leave deleted file symbols in the AST index forever.

Candidates

OptionProsCons
MCP mutation handlers use the real extension hostDerived extension indexes stay coherentMutations must be wired after extension host injection
Rely on filesystem watcher eventsKeeps mutation handlers simplerWatcher idempotency can suppress the needed extension notification
Force full extension reindex after every mutationSimple recovery modelExpensive and noisy for frequent edits

Decision

We will ensure MCP mutation handlers construct mutation services with the real extension host injected into engine state. Create, delete, edit-range, global-replace, and host-owned apply-edits paths must notify extensions through the same extension host contract used by watcher-driven changes.

NoOpExtensionHost is only valid before extension host injection or in tests that explicitly do not assert extension notifications.

Consequences

What becomes easier:

  • AST, LSP, lint, and formatter observers see mutations made through MCP tools.
  • Deleted files do not leave permanent derived-index state.
  • Watcher idempotency can remain focused on filesystem reconciliation.

What becomes harder:

  • Engine assembly must inject the real extension host before serving mutating MCP tools.
  • Tests need recording extension hosts to prove notifications are emitted.

Constitution Compliance

PrincipleStatusJustification
Index consistencyCompliantDerived extension indexes receive mutation notifications.
Extension host contractCompliantMCP mutations use the same event path as watcher updates.
CorrectnessCompliantThe decision prevents stale AST/LSP state after mutations.

View original on GitHub