Add working directory support for stdio MCP servers#57
Merged
Conversation
- Introduced `working_dir` field in ServerConfig to specify the working directory for stdio servers. - Enhanced documentation in CLAUDE.md and README.md to explain working directory configuration and its benefits. - Implemented validation for working directories to ensure they exist and are accessible. - Updated connection handling to support working directory context for stdio transports. - Added comprehensive unit tests for working directory validation and integration with Docker isolation. This feature improves project context management and allows for better separation of work and personal projects.
rannow
pushed a commit
to rannow/mcpproxy-go
that referenced
this pull request
Sep 23, 2025
…io-working-dir Add working directory support for stdio MCP servers
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
working_dirfield to ServerConfig for stdio serversBackground
Resolves the issue where file-based MCP servers (like ast-grep-mcp, filesystem-mcp, git-mcp) operate from mcpproxy's directory instead of project directories when mcpproxy runs as a global daemon.
Changes Made
WorkingDirfield toServerConfigstructvalidateWorkingDir()function with directory existence checkingCommandFuncusing mcp-go'sWithCommandFuncoptionupstream_serverstool operations (add/update/patch)workingdir_test.goExample Usage
{ "mcpServers": [ { "name": "ast-grep-project-a", "command": "npx", "args": ["ast-grep-mcp"], "working_dir": "/home/user/projects/project-a", "enabled": true } ] }Test Plan
Backwards Compatibility
✅ Fully backwards compatible - empty/unspecified
working_diruses current directory (existing behavior)