Skip to content
This repository was archived by the owner on Nov 9, 2026. It is now read-only.

fix(mcp-filesystem): allow recursive directory creation - #1981

Open
dvd233 wants to merge 1 commit into
bytedance:mainfrom
dvd233:codex/fix/mcp-filesystem-recursive-directory-1978
Open

dvd233 wants to merge 1 commit into
bytedance:mainfrom
dvd233:codex/fix/mcp-filesystem-recursive-directory-1978

Conversation

@dvd233

@dvd233 dvd233 commented Sep 20, 2026

Copy link
Copy Markdown

Summary

Fixes #1978

create_directory documents recursive creation, but it calls the shared path validator before fs.mkdir(..., { recursive: true }). When more than one path component is missing, validation rejects the immediate parent and the recursive mkdir is never reached.

This change adds an opt-in allowMissingParents path for create_directory only. It walks upward to the nearest existing ancestor only for ENOENT, verifies that ancestor's real path remains inside an allowed directory, and preserves the existing validation behavior for every other filesystem tool. Existing symlink targets outside the allowed root are still rejected.

Verification

  • Added MCP in-memory regression coverage for two missing directory levels.
  • Added a symlink-boundary regression proving creation does not escape the allowed root.
  • pnpm --filter @agent-infra/mcp-server-filesystem test — 5 passed.
  • pnpm exec prettier --check and pnpm exec eslint on changed files — passed.
  • pnpm exec tsc -p packages/agent-infra/mcp-servers/filesystem/tsconfig.json --noEmit — passed.
  • Built @agent-infra/logger, mcp-http-server, and @agent-infra/mcp-server-filesystem in dependency order; ESM, CJS, and declaration output succeeded.
  • git diff --check — passed.

The full workspace install also attempted an Electron postinstall download, which timed out externally; Electron is not used by this package and the focused dependency/build checks above completed successfully.

Checklist

  • Added or updated necessary tests.
  • Updated documentation to align with changes (not applicable; existing tool documentation already promises recursive creation).
  • Verified no breaking changes.
  • My change does not involve the above items.

AI assistance

Codex assisted with issue investigation and test design. The submitted implementation and every changed line were reviewed against the issue, repository conventions, and the validation results above.

@netlify

netlify Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for tarko canceled.

Name Link
🔨 Latest commit 0eab8db
🔍 Latest deploy log https://app.netlify.com/projects/tarko/deploys/6ab055efd999d6000930a2d7

@netlify

netlify Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for agent-tars-docs canceled.

Name Link
🔨 Latest commit 0eab8db
🔍 Latest deploy log https://app.netlify.com/projects/agent-tars-docs/deploys/6ab055ef8ffb9d0008c0f6c6

This branch has not been deployed

No deployments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report]: filesystem create_directory rejects nested paths when intermediate directories do not exist

1 participant