Repository navigation
Add the sandfs MCP server - #24
Conversation
A new crate serves one copy-on-write workspace to an agent over MCP's stdio transport with nine tools: read, list, glob, grep, write, edit, move, delete and diff. Results are plain text capped at 64 KiB with a note on how to page. The sandfs-mcp binary mounts --dir and --git sources; harnesses can embed Server directly. The core gains Workspace::base(), an O(1) view of the mounts with an empty overlay, so diff can show base contents next to the changes. Tests cover every tool (tests/tools.rs) and a full stdio session against the binary (tests/stdio.rs). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0132DX55KFJ5CgkWG7fqu7ek
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8d89c560ec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ings - Validate a message's method before treating a missing id as a notification, so invalid requests get -32600. - grep's "No matches" now says how many files could not be read. - diff reports a kind change alongside the text patch, stops building patches once past the output cap, and lists files over 1 MiB without diffing them. - read notes CRLF line endings and a missing final newline, which exact-text edits must match. - write's description now says what version 0 means: a new file or an unchanged mounted one. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0132DX55KFJ5CgkWG7fqu7ek
sandfs is a general-purpose sandbox filesystem, so the tools no longer assume a code repository: - read returns PNG, JPEG, GIF and WebP files (up to 5 MiB) as MCP image content with a caption; other binary files still report their size. - glob and grep no longer skip .git directories; the walk treats every directory the same. - Tool descriptions and docs use data and document examples instead of source files. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0132DX55KFJ5CgkWG7fqu7ek
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f45dee686e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The revised spec treats files as bytes and keeps the core to sources, workspaces and changes, so the server now builds on just that: - read shows text files with line numbers and describes other files by detected type, size and version, never their bytes. Image content output is gone. - write takes encoding text or base64, so agents can write any file. - edit is implemented here from read and a versioned write, and refuses files that are not text. - diff lists changed files with their size instead of unified patches, which drops the similar dependency and the core Workspace::base() addition. - Symlink handling and the --git mount are removed; the binary mounts host folders with --dir, and harnesses embed the library for other sources. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0132DX55KFJ5CgkWG7fqu7ek
The spec now calls the set of changed files changes rather than a diff, which is code vocabulary; the tool follows. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0132DX55KFJ5CgkWG7fqu7ek
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0132DX55KFJ5CgkWG7fqu7ek
Codex review: a paged read of a large text file collected every line first, and list silently clamped deeper requests to 20 levels. Reads now render only the requested page in one pass, and the depth limit is in the schema and enforced with an error. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0132DX55KFJ5CgkWG7fqu7ek
Picks up the Python bindings and the core renames: Workspace::diff is now Workspace::changes, and stat sizes are always exact. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0132DX55KFJ5CgkWG7fqu7ek
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d2d7a51039
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Requests must carry "jsonrpc": "2.0". - grep context over 20 is rejected, and the schema says so. - A read page end saturates instead of overflowing on a huge limit. - A grep hit past the 500-character cut shows a window around the match. - The crate docs point embedders at Workspace::changes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0132DX55KFJ5CgkWG7fqu7ek
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 88e6448982
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex review: when context lines filled the output before the first hit was printed, grep said there were no matches. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_0132DX55KFJ5CgkWG7fqu7ek
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 51b0402b28
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Requested by George · project thread
Before: an agent could only reach a sandfs workspace by embedding the Rust crate.
After:
sandfs-mcp --dir /data=./datasets --dir /notes=./notesgives any MCP client (Claude Code, Codex, the Agent SDK) a private copy-on-write workspace as nine file tools:read,list,glob,grep,write,edit,move,deleteandchanges. Mounted folders are never modified, and a harness can embedsandfs_mcp::Serveron its own workspace and take it back afterwards to collect the changes.The tools follow the general-purpose spec: files are bytes, and nothing assumes code.
readshows text files with line numbers and a version. Any other file is described by its detected type (PNG, PDF, ZIP/Office, Parquet, SQLite and others), size and version, never its bytes.writetakesencoding: text | base64, so an agent can write any file.editis built in this crate from a read plus a versioned write. It replaces one exact match, or every match withreplace_all, takes an optionalexpected_version, and refuses files that are not text.globandgrepskip non-text files, and their output is capped so a large tree can't flood the context.changeslists added, modified and deleted files with their sizes, not text patches.How: a hand-written stdio JSON-RPC loop (no async runtime) handling
initialize,ping,tools/listandtools/call, with protocol version negotiation. Tool failures returnisErrorresults the agent can read.Core API changes: none. The crate uses only the public
WorkspaceAPI as of #23 (Workspace::changes, exactstatsizes). The only change outsidecrates/sandfs-mcpis adding it to the workspace members.Not included, by design: unified diffs, image content blocks, symlinks, and a git mount on the binary. A harness that wants other sources builds the workspace itself and embeds the server.
Tests:
cargo test -p sandfs-mcpruns 14 tool tests over an in-memory source and 3 stdio tests that spawn the binary.🤖 Generated with Claude Code
https://claude.ai/code/session_0132DX55KFJ5CgkWG7fqu7ek