Skip to content

Fix MCP servers in multi root wrokspaces - #52161

Closed
OmChillure wants to merge 4 commits into
zed-industries:mainfrom
OmChillure:fix-mcp-servers-in-multi-root-wrokspaces
Closed

Fix MCP servers in multi root wrokspaces#52161
OmChillure wants to merge 4 commits into
zed-industries:mainfrom
OmChillure:fix-mcp-servers-in-multi-root-wrokspaces

Conversation

@OmChillure

@OmChillure OmChillure commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Context

MCP servers defined in .zed/settings.json of a project folder were not discovered when that folder was added to a workspace that already contained another project.

ContextServerStore previously read context server settings only from the first visible worktree via resolve_project_settings(). This meant servers configured in any additional project folder were silently ignored.

Added resolve_all_context_server_settings() which iterates all visible worktrees and merges their context_servers maps (first-match-wins for duplicate IDs).

Closes #51951

How to Review

Single file change in context_server_store.rs:

  1. New function resolve_all_context_server_settings (lines 862–879)
  2. Two call sites updated to use it instead of resolve_project_settings().context_servers
  3. Two new integration tests verifying multi-worktree discovery and duplicate-ID handling

Self-Review Checklist

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Video

Screencast.from.2026-03-22.23-26-06.webm

Release Notes:

  • Fixed MCP servers from .zed/settings.json not being discovered when multiple project folders are open in a workspace.

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Mar 23, 2026
@zed-community-bot zed-community-bot Bot added the guild Pull requests by someone in Zed Guild. NOTE: the label application is automated via github actions label Mar 23, 2026
@zed-codeowner-coordinator
zed-codeowner-coordinator Bot requested review from a team, cameron1024 and reflectronic and removed request for a team March 23, 2026 05:40
@SomeoneToIgnore SomeoneToIgnore added the area:ai Related to Agent Panel, Edit Prediction, Copilot, or other AI features label Mar 23, 2026
@MrSubidubi MrSubidubi changed the title Fix mcp servers in multi root wrokspaces Fix MCP servers in multi root wrokspaces Mar 23, 2026
@OmChillure OmChillure closed this by deleting the head repository Mar 29, 2026
chirivelli pushed a commit to chirivelli/zed that referenced this pull request Jul 10, 2026
### Closes zed-industries#51951

## Self-Review Checklist

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the UI/UX checklist
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

#### Note : Reopens previous work from closed PR
zed-industries#52161 (fork was deleted)

## Video 

[Screencast from 2026-03-22
23-26-06.webm](https://github.com/user-attachments/assets/ab68e47a-7e74-4f1e-991d-8ca4fed7952c)


## Release Notes:

- Fixed MCP servers from `.zed/settings.json` not being discovered when
multiple project folders are open in a workspace.

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
### Closes zed-industries#51951

## Self-Review Checklist

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the UI/UX checklist
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

#### Note : Reopens previous work from closed PR
zed-industries#52161 (fork was deleted)

## Video 

[Screencast from 2026-03-22
23-26-06.webm](https://github.com/user-attachments/assets/ab68e47a-7e74-4f1e-991d-8ca4fed7952c)


## Release Notes:

- Fixed MCP servers from `.zed/settings.json` not being discovered when
multiple project folders are open in a workspace.

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
playdohface pushed a commit to playdohface/zed that referenced this pull request Aug 29, 2026
### Closes zed-industries#51951

## Self-Review Checklist

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the UI/UX checklist
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

#### Note : Reopens previous work from closed PR
zed-industries#52161 (fork was deleted)

## Video 

[Screencast from 2026-03-22
23-26-06.webm](https://github.com/user-attachments/assets/ab68e47a-7e74-4f1e-991d-8ca4fed7952c)


## Release Notes:

- Fixed MCP servers from `.zed/settings.json` not being discovered when
multiple project folders are open in a workspace.

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ai Related to Agent Panel, Edit Prediction, Copilot, or other AI features cla-signed The user has signed the Contributor License Agreement guild Pull requests by someone in Zed Guild. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP Servers from .zed/settings.json not picked up when more than one project in workspace

4 participants