Skip to content

fix(mcp): pass workspace roots to servers#1625

Merged
esengine merged 1 commit into
esengine:mainfrom
GTC2080:GTC/fix-1397-mcp-root-uri
May 23, 2026
Merged

fix(mcp): pass workspace roots to servers#1625
esengine merged 1 commit into
esengine:mainfrom
GTC2080:GTC/fix-1397-mcp-root-uri

Conversation

@GTC2080

@GTC2080 GTC2080 commented May 23, 2026

Copy link
Copy Markdown
Contributor

What

Send workspace root context to MCP servers during initialization and answer roots/list requests, while launching stdio MCP servers from the same workspace directory.

Why

Fixes #1397. Servers that infer project state from rootUri, workspaceFolders, roots/list, or process cwd could not auto-detect the active project and required hardcoded path arguments.

How to verify

  • npm test -- tests/mcp.test.ts
  • npm test -- tests/mcp.test.ts tests/mcp-env-config.test.ts tests/acp-mcp.test.ts tests/chat-mcp-startup-summary.test.ts tests/mcp-reconnect.test.ts tests/mcp-runtime-failures.test.ts
  • npm run typecheck
  • npm run verify

Checklist

  • npm run verify passes locally (lint + typecheck + tests + comment-policy gate)
  • No Co-Authored-By: Claude trailer in commits
  • Comments follow CONTRIBUTING.md (no module-essay headers, no incident history)
  • No edits to CHANGELOG.md — release notes are maintainer-written at release time

@esengine

Copy link
Copy Markdown
Owner

Substantial MCP roots work, matches the spec, and the test in tests/mcp.test.ts covers both directions (client advertises rootUri / workspaceFolders on initialize, server-side roots/list answered correctly). One blocker before merge: the branch silently reverts #1623.

Drift

git diff origin/main..HEAD shows two extra files in the diff that aren't part of your fix:

src/cli/ui/PromptInput.tsx     |  6 +++---
src/cli/ui/cards/UserCard.tsx  |  2 +-

The change flips TONE.brand / SURFACE.bgInput back to hardcoded #0153e5 / #1e1e1e — that's #1623 (light-theme composer bg) which merged earlier today. GH says mergeStateStatus: CLEAN because git's 3-way merge sees absence-of-lines as deletion against main's additions; there are no textual conflicts to flag. Semantically merging this would undo the light-theme fix.

What to do

git fetch origin main && git rebase origin/main — your diff should narrow back to the 11 MCP-related files. The PromptInput.tsx and UserCard.tsx changes should disappear from the diff entirely after rebase.

Main's moving fast this week (a couple of other contributors hit the same drift today on PRs that opened earlier). If the rebase takes more than a few hours you may need a second one. Push when ready and I'll merge — the fix itself is in great shape.

@esengine esengine mentioned this pull request May 23, 2026
4 tasks
@GTC2080 GTC2080 force-pushed the GTC/fix-1397-mcp-root-uri branch from 6361b11 to 9565fbd Compare May 23, 2026 14:53
@esengine esengine merged commit 8495274 into esengine:main May 23, 2026
4 checks passed
esengine pushed a commit that referenced this pull request May 24, 2026
…moved, persisted usage stats, plan dispatch gate

Headline themes:
- Desktop: bundle the CLI-hosted React dashboard, retire Tauri+Preact duplicate (#1418)
- Config: drop preset abstraction; flash/pro are direct model selections (#1657, #1630)
- Stats: persist cumulative usage to session meta + auto-restore on startup (#1667, #1680, #1643, #1628)
- Plans: editMode="plan" enforced at the ToolRegistry dispatch gate (#1681); step advance fix (#1629)
- Context: fold once at turn start, drop pre-flight + byte-ceiling (#1642, #1646); collapsible compacted card (#1649)
- Subagents: per-skill flash/pro override + Settings UI (#1632)
- Desktop polish: sidebar drag-resize (#1688), responsive collapse (#1585), copy/edit overlay + msg-history nav (#1645), Esc closes modal not turn (#1685), QQ tab isolation (#1672), DiffCard for edits (#1662), theme-aware highlighting (#1655), system events toggle (#1654/#1650), macOS TCC inheritance (#1614), dashboard.enabled (#1612)
- Dashboard polish: persistent session URL (#1586, #1589, #1599), theme-aware highlighting (#1664), IME confirm-enter guard (#1689), code-fence lang fix (#1677), vendor chunk split (#1587), markdown table h-scroll (#1562)
- TUI: Alt+S input stash/recall; static history isolated from input rerenders (#1635); legacy mouse drop (#1637, #1648); multi-edit gated in review (#1647)
- Diff: SplitDiff column border holds under CJK (#1686)
- MCP: workspace roots passed to servers (#1625); codeCommand honors mcpServers (#1603)
- Config plumbing: (baseUrl, apiKey) resolved as a tuple (#1658); stale model id self-heal (#1663)

See CHANGELOG for the full list.
@GTC2080 GTC2080 deleted the GTC/fix-1397-mcp-root-uri branch May 31, 2026 10:43
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.

MCP initialize should pass workspaceDir as rootUri to MCP servers

2 participants