Problem
AI agents (Copilot, Claude, Cursor, etc.) increasingly write and modify code in repositories, and they are well positioned to explain that code too. CodeTour tours are the natural artifact for that: a checked-in, human-readable walkthrough of a codebase or a change. Today, however, tours can only be recorded manually by a human clicking through files — so the one artifact an agent could use to leave durable, reviewable explanations behind is the one it cannot produce.
Proposal
Add a local MCP server, bundled with the desktop extension, that exposes two tools so any MCP-capable agent can generate CodeTour content:
create_project_tour — a tour explaining a codebase, with steps anchored to files, directories, lines, unique patterns, or selections.
create_changes_tour — a tour explaining committed changes from the merge-base of a baseRef to the current HEAD (verified against the live HEAD to avoid stale explanations), optionally including uncommitted work.
The agent provides fully written content; the server only validates and persists it. This keeps the human in charge of the narrative while making the mechanical part (anchoring steps to the right lines, writing valid .tour files) deterministic.
Design
- Two tools, one responsibility. The server never generates content itself; it validates proposals (strict input schema, anchor existence and bounds checked against actual file content) and writes deterministic
.tour files under .tours/.
- Stdio confinement. One server instance per workspace folder, spawned over stdio, confined to the
--workspace-root argument, no network access.
- Strict validation. Unknown fields rejected, active URI schemes (
command:, file:, vscode:, javascript:) rejected in Markdown descriptions, anchor patterns capped in length and checked against catastrophic backtracking before being run against file contents, Git refs resolved to full SHAs via git rev-parse --verify before any Git invocation.
- Atomic, deterministic writes. Temp file in the resolved real directory, then rename; an empty generation never replaces a useful existing tour.
- Compatibility preserved. The
vscode.lm MCP provider API is stable only since VS Code 1.101, but the extension's engine floor would stay at ^1.60.0: the API is declared locally and feature-detected at runtime. On hosts older than 1.101 the feature is simply inactive; no user is excluded by upgrading. The web extension is unaffected (all Node.js-only integrations are desktop-only).
Delivery plan
To keep review tractable, the work would come as independent PRs:
- A small, unrelated crash fix I found along the way (comment threads without a source range crash step recording).
- The self-contained
packages/mcp-server with its own test suite (73 tests: unit validation, stdio integration, security, packaged-binary).
- The extension integration: runtime-conditional provider registration, VSIX bundling, README section.
I have the implementation working and tested on a fork and would love feedback on the design — in particular the runtime-conditional vscode.lm registration approach and the PR split — before opening the PRs.
Problem
AI agents (Copilot, Claude, Cursor, etc.) increasingly write and modify code in repositories, and they are well positioned to explain that code too. CodeTour tours are the natural artifact for that: a checked-in, human-readable walkthrough of a codebase or a change. Today, however, tours can only be recorded manually by a human clicking through files — so the one artifact an agent could use to leave durable, reviewable explanations behind is the one it cannot produce.
Proposal
Add a local MCP server, bundled with the desktop extension, that exposes two tools so any MCP-capable agent can generate CodeTour content:
create_project_tour— a tour explaining a codebase, with steps anchored to files, directories, lines, unique patterns, or selections.create_changes_tour— a tour explaining committed changes from the merge-base of abaseRefto the currentHEAD(verified against the live HEAD to avoid stale explanations), optionally including uncommitted work.The agent provides fully written content; the server only validates and persists it. This keeps the human in charge of the narrative while making the mechanical part (anchoring steps to the right lines, writing valid
.tourfiles) deterministic.Design
.tourfiles under.tours/.--workspace-rootargument, no network access.command:,file:,vscode:,javascript:) rejected in Markdown descriptions, anchor patterns capped in length and checked against catastrophic backtracking before being run against file contents, Git refs resolved to full SHAs viagit rev-parse --verifybefore any Git invocation.vscode.lmMCP provider API is stable only since VS Code 1.101, but the extension's engine floor would stay at^1.60.0: the API is declared locally and feature-detected at runtime. On hosts older than 1.101 the feature is simply inactive; no user is excluded by upgrading. The web extension is unaffected (all Node.js-only integrations are desktop-only).Delivery plan
To keep review tractable, the work would come as independent PRs:
packages/mcp-serverwith its own test suite (73 tests: unit validation, stdio integration, security, packaged-binary).I have the implementation working and tested on a fork and would love feedback on the design — in particular the runtime-conditional
vscode.lmregistration approach and the PR split — before opening the PRs.