Skip to content

fix(skill-mcp): pass workspace directory as cwd to stdio MCP processes#3415

Merged
code-yeongyu merged 1 commit into
code-yeongyu:devfrom
lightrabbit:fix/skill-mcp-stdio-cwd
May 4, 2026
Merged

fix(skill-mcp): pass workspace directory as cwd to stdio MCP processes#3415
code-yeongyu merged 1 commit into
code-yeongyu:devfrom
lightrabbit:fix/skill-mcp-stdio-cwd

Conversation

@lightrabbit

@lightrabbit lightrabbit commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Pass toolContext.directory through SkillMcpClientInfo to StdioClientTransport's cwd parameter so that stdio MCP child processes inherit the correct workspace directory instead of process.cwd()

Problem

In OpenCode web multi-workspace mode, skill_mcp spawned stdio child processes used process.cwd() (the directory where opencode web was started) rather than the session's workspace directory. This meant MCP servers that rely on the working directory (e.g., file-based databases, linters) would operate on the wrong project.

OpenCode's built-in MCP correctly passes Instance.directory as cwd to its StdioClientTransport. This PR brings skill-embedded MCPs to parity.

Changes

  • SkillMcpClientInfo type: added optional directory field
  • tools.ts: populate directory from toolContext.directory
  • stdio-client.ts: conditionally pass cwd to StdioClientTransport when directory is present

Test plan

  • Existing 110 tests pass (0 regressions)
  • New test: verifies toolContext.directory is forwarded to manager via SkillMcpClientInfo

Summary by cubic

Pass the session’s workspace directory to stdio MCP child processes as cwd so servers run against the correct project. Fixes multi-workspace mode where processes inherited process.cwd().

  • Bug Fixes
    • Add optional directory to SkillMcpClientInfo.
    • Set it from toolContext.directory and pass as cwd to StdioClientTransport when present.
    • Add test confirming the directory is forwarded to the manager.

Written for commit df172ac. Summary will update on new commits.

In OpenCode web multi-workspace mode, skill_mcp spawned stdio child
processes inherited process.cwd() instead of the session's workspace
directory. Pass toolContext.directory through SkillMcpClientInfo to
StdioClientTransport's cwd parameter.
@github-actions

github-actions Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Low-risk fix for workspace directory inheritance in MCP servers; includes test coverage and follows existing patterns for built-in MCPs.

@lightrabbit

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Apr 14, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 19, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 19, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 19, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 19, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 19, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 20, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 20, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 20, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 20, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 20, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 20, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 22, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 22, 2026
@code-yeongyu code-yeongyu merged commit 8c8522e into code-yeongyu:dev May 4, 2026
3 of 4 checks passed
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.

2 participants