Skip to content

feat(mcp): optional per-session working dir for host tools#47

Merged
mudler merged 3 commits into
masterfrom
feat/tool-working-dir
Jul 4, 2026
Merged

feat(mcp): optional per-session working dir for host tools#47
mudler merged 3 commits into
masterfrom
feat/tool-working-dir

Conversation

@localai-bot

Copy link
Copy Markdown
Collaborator

Adds an optional, runtime-only working directory to the host tools so a caller can run bash + filesystem operations rooted at a chosen folder instead of the process cwd. Prerequisite for per-workspace working directories in dante-desktop.

What

  • types.Config.WorkingDir string (yaml:"-", runtime-only) — empty means the process cwd (today's behavior).
  • bash: bgJobManager carries a dir; launch sets cmd.Dir only when non-empty. New NewShellJobsInDir(dir).
  • filesystem: newFileSystem(root) + a resolve helper; every input.Path access is rooted at root when the path is relative. StartFileSystemMCPServer(ctx, transport, root).
  • StartTransports threads cfg.WorkingDir into both tools.

Guarantees

  • Backward compatible: empty WorkingDir / empty root preserves the exact current process-cwd behavior. No existing caller changes.
  • Not a sandbox: only relative paths are rooted; absolute paths and .. still traverse — unchanged from today.

Tests

  • bash runs in a configured dir; empty dir uses process cwd.
  • filesystem resolves relative→root, leaves absolute unchanged, empty-root verbatim.
  • go test ./mcp/... green (73 pass); go build ./... clean.

🤖 Generated with Claude Code

@mudler mudler force-pushed the feat/tool-working-dir branch from c43dfbf to aa2189b Compare July 4, 2026 17:27
@mudler mudler merged commit eec60a2 into master Jul 4, 2026
2 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