feat: add cwd (working directory) support for stdio MCP servers - #1
Open
michaeljabbour wants to merge 1 commit into
Open
feat: add cwd (working directory) support for stdio MCP servers#1michaeljabbour wants to merge 1 commit into
michaeljabbour wants to merge 1 commit into
Conversation
Adds the ability to specify a working directory for MCP server processes: - Add `cwd` parameter to MCPClient constructor - Pass cwd to StdioServerParameters when starting servers - Support `cwd` in server config (e.g., mcp.json) - Fall back to AMPLIFIER_WORK_DIRECTORY env var if not specified - Update README with per-server configuration documentation This enables MCP servers like image generators to save files to the user's project directory rather than the sidecar's cwd. Co-Authored-By: microsoft-amplifier <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the ability to specify a working directory for stdio-based MCP server processes.
Changes
cwdparameter toMCPClientconstructorcwdtoStdioServerParameterswhen starting serverscwdin per-server config (e.g., inmcp.jsonor inline bundle config)AMPLIFIER_WORK_DIRECTORYenvironment variable if not specified in configUse Case
This enables MCP servers like image generators (e.g., ImageGen) to save files to the user's project directory rather than the sidecar's working directory. Desktop applications can set
AMPLIFIER_WORK_DIRECTORYbased on the active conversation/project, and MCP servers will automatically use it.Example Config
{ "imagen": { "command": "npx", "args": ["-y", "@anthropics/imagen-mcp"], "cwd": "/path/to/project" } }Or use the environment variable fallback:
export AMPLIFIER_WORK_DIRECTORY=/path/to/projectTesting
🤖 Generated with Claude Code