Skip to content

Add the sandfs MCP server - #24

Merged
lydakis merged 10 commits into
mainfrom
claude/sandfs-mcp-server-orgcbe
Oct 18, 2026
Merged

lydakis merged 10 commits into
mainfrom
claude/sandfs-mcp-server-orgcbe

Conversation

@lydakis

@lydakis lydakis commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

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=./notes gives 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, delete and changes. Mounted folders are never modified, and a harness can embed sandfs_mcp::Server on 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.

  • read shows 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.
  • write takes encoding: text | base64, so an agent can write any file.
  • edit is built in this crate from a read plus a versioned write. It replaces one exact match, or every match with replace_all, takes an optional expected_version, and refuses files that are not text.
  • glob and grep skip non-text files, and their output is capped so a large tree can't flood the context.
  • changes lists 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/list and tools/call, with protocol version negotiation. Tool failures return isError results the agent can read.

Core API changes: none. The crate uses only the public Workspace API as of #23 (Workspace::changes, exact stat sizes). The only change outside crates/sandfs-mcp is 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-mcp runs 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

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
@lydakis lydakis self-assigned this Oct 18, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T21:42:50.867195Z 51b0402 New commits
🔒 Security Review ✅ Completed 2026-10-18T21:38:29.958149Z 51b0402 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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".

Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Comment thread crates/sandfs-mcp/src/lib.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
…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
@lydakis
lydakis marked this pull request as draft October 18, 2026 21:02

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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".

Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Comment thread crates/sandfs-mcp/src/lib.rs Resolved
Comment thread crates/sandfs-mcp/src/main.rs Resolved
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
@lydakis lydakis changed the title Add sandfs-mcp: MCP file tools over a workspace Add the sandfs MCP server Oct 18, 2026
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
@lydakis
lydakis marked this pull request as ready for review October 18, 2026 21:20

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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".

Comment thread crates/sandfs-mcp/src/lib.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Comment thread crates/sandfs-mcp/src/lib.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
- 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

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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".

Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
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

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 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".

Comment thread crates/sandfs-mcp/src/lib.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
Comment thread crates/sandfs-mcp/src/tools.rs Resolved
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