Feature Request: Add configurable working directory for local Context Servers #35355
ikkurthis1998
started this conversation in
Config, Settings and Keymaps
Replies: 1 comment
-
Example Usage ![]() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem Statement
Currently, when Zed launches a custom context server (MCP) configured via
settings.json
, it always uses the project's root directory as the working directory for the server process. This limitation becomes apparent and problematic when developing or running multiple local MCP servers that reside in different subdirectories within a single project.For example, in a monorepo setup, you might have:
my-project/mcp-server-one/
my-project/mcp-server-two/
my-project/backend-service/
(which might also contain an MCP)If
mcp-server-one
ormcp-server-two
have their own internal dependencies, configuration files, or relative paths they expect to resolve from their own subdirectory, they will fail to function correctly when launched from the project root. This forces developers to:cd mcp-server-one && ./server
).This significantly hinders the ability to efficiently develop and test multiple, isolated MCPs locally within a unified Zed project, making the local development and iteration cycle more cumbersome than necessary.
Solution Proposal
I propose adding an optional
working_directory
field to theContextServerCommand
configuration withinsettings.json
. This new field would allow users to explicitly define the working directory from which a context server command is executed.Here's how it would function:
working_directory
(e.g.,"working_directory": "mcp-server-one"
or"working_directory": "/absolute/path/to/server"
) directly within theircontext_servers
entry insettings.json
."mcp-server-one"
), it would be resolved relative to the project's root directory. This is crucial for seamless monorepo integration.working_directory
field is omitted, the context server would continue to launch from the project's root directory, ensuring backward compatibility and no change for existing setups.I've already implemented a proof-of-concept for this functionality, which involves changes in the following files:
/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs
/crates/context_server/src/context_server.rs
/crates/project/src/context_server_store.rs
/crates/project/src/context_server_store/extension.rs
/crates/project/src/project_settings.rs
This change is designed to be additive and non-breaking, providing a crucial configuration option for developers working with distributed or modular context server architectures.
Beta Was this translation helpful? Give feedback.
All reactions