modelcontextprotocol / modelcontextprotocol/servers
Make filesystem directory-tree output ordering deterministic
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 90.5k
- Forks
- 11.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 5
Description
Problem
Directory tree responses can vary by host filesystem enumeration order, causing unstable output for the same directory across runs.
Why now
The filesystem server is a reference implementation; deterministic output is required for reproducible comparisons and contract tests.
Expected behavior
For the same directory contents and exclude patterns, directory_tree should return a stable ordering across repeated runs and platforms.
Claim-to-codepath map
src/filesystem/index.tssrc/filesystem/lib.tssrc/filesystem/__tests__/directory-tree.test.tssrc/filesystem/__tests__/structured-content.test.ts
Validation requirements
- Enforce deterministic sorting in recursive tree traversal.
- Add test assertions for stable sibling ordering and nested ordering.
- Run filesystem package tests.
Evidence packet
- Commit under test:
$(git -C /Users/davidahmann/Projects/agent-ecosystem/mcp-servers rev-parse HEAD) - Runtime: Node.js + vitest on macOS
- Minimal repro: call
directory_treemultiple times over same fixture and compare ordering of siblings.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/filesystem/index.ts and src/filesystem/lib.ts to trace directory_tree's recursive traversal and current filesystem enumeration. Review directory-tree.test.ts and structured-content.test.ts, then run the filesystem package tests. Done means repeated calls over the same fixture produce stable sibling and nested ordering across the stated cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- backend, testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100