Skip to content

feat: add cwd (working directory) support for stdio MCP servers - #1

Open
michaeljabbour wants to merge 1 commit into
robotdad:mainfrom
michaeljabbour:feature/cwd-support
Open

feat: add cwd (working directory) support for stdio MCP servers#1
michaeljabbour wants to merge 1 commit into
robotdad:mainfrom
michaeljabbour:feature/cwd-support

Conversation

@michaeljabbour

Copy link
Copy Markdown

Summary

Adds the ability to specify a working directory for stdio-based MCP server processes.

Changes

  • Add cwd parameter to MCPClient constructor
  • Pass cwd to StdioServerParameters when starting servers
  • Support cwd in per-server config (e.g., in mcp.json or inline bundle config)
  • Fall back to AMPLIFIER_WORK_DIRECTORY environment variable if not specified in config
  • Update README with per-server configuration documentation

Use 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_DIRECTORY based 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/project

Testing

  • All 50 existing tests pass
  • New feature is backward compatible (cwd defaults to None, preserving existing behavior)

🤖 Generated with Claude Code

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]>
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.

1 participant