Listed from the MCP registry; nobody on Odel publishes it.
Standalone MCP filesystem tools server — view, edit, shell, workdir.
Runs on your machine from its package; the steps are below.
At most: moves money, runs code or commands, deletes data, or sends messages for you.
Odel charges nothing per call. The publisher may charge for its own service.
Runs locally over stdio
This server isn't hosted — your MCP client launches it from a package registry. Use one of the commands below, or drop the config into your client (e.g. Claude Desktop).
Run
npx -y @muvon/octofs
MCP client config
{
"mcpServers": {
"octofs": {
"command": "npx",
"args": [
"-y",
"@muvon/octofs"
]
}
}
}Distributed as an MCP bundle (`https://github.com/Muvon/octofs/releases/download/0.27.1/octofs-0.27.1-aarch64-apple-darwin.mcpb`) — download it and import the bundle in your MCP client.
Distributed as an MCP bundle (`https://github.com/Muvon/octofs/releases/download/0.27.1/octofs-0.27.1-aarch64-pc-windows-msvc.mcpb`) — download it and import the bundle in your MCP client.
Distributed as an MCP bundle (`https://github.com/Muvon/octofs/releases/download/0.27.1/octofs-0.27.1-aarch64-unknown-linux-musl.mcpb`) — download it and import the bundle in your MCP client.
Distributed as an MCP bundle (`https://github.com/Muvon/octofs/releases/download/0.27.1/octofs-0.27.1-x86_64-pc-windows-msvc.mcpb`) — download it and import the bundle in your MCP client.
Distributed as an MCP bundle (`https://github.com/Muvon/octofs/releases/download/0.27.1/octofs-0.27.1-x86_64-unknown-linux-musl.mcpb`) — download it and import the bundle in your MCP client.
Filesystem MCP server and code navigation for AI assistants: file outlines, ast-grep style search, find references and call graphs, over the Model Context Protocol
Standalone Rust binary that serves filesystem and code-exploration tools over the Model Context Protocol (MCP). Built on rmcp 3.x, tokio, and axum.
Overview · Installation · Quick Start · Filesystem tools · Code exploration · Tools Reference · Docs · Architecture · Changelog · Contributing · Good first issues
MCP Registry: io.github.Muvon/octofs
Octofs is a single binary that gives an AI assistant two things over MCP: tools to read, search, edit and copy files, run shell commands and reach remote hosts over SSH, and tools to explore code — file outlines, syntax-tree search and a symbol tool that finds definitions, references, callers, callees, imports and type hierarchies. Code-navigation tools often need a separate indexing step, and an index can fall behind files edited by another program. Octofs computes the answers from the files on disk, using an in-memory table that is built on the first query and refreshed from file metadata on every call, so there is no indexing command and no database. Measured on a 12-core Linux box with a release build: a path query repeated in the same process took 3 ms (median) on tokio and 224 ms on the Linux kernel tree; a query stops after 800 ms or 600 parsed files, and a name too common to finish in that time gets a partial answer that a repeated query extends.
With these tools an assistant can work in a project without the user pasting files: it reads and searches the tree, edits files in ways that fail loudly instead of landing on the wrong line, and runs commands. The same file tools work on a remote host when a path is an ssh:// URL.
view reads a file (whole, a line range, or several ranges) or several files in one call, lists a directory (gitignore-aware, with glob patterns), searches content (literal or regex, with context lines) and returns images up to 5 MB. For clients that report a context epoch, re-viewing a whole file returns only the hunks changed since.text_edit creates files, replaces exact text, deletes a file and undoes the last edits (up to 10 levels per file, kept in memory).batch_edit applies up to 50 insert and replace operations to one file atomically. Targets are line ids of the form N:hh (position plus a two-character content hash); a stale id fails with the current content and where it moved. An operation can copy lines from another file, or from the same file, instead of taking new text.shell runs a command on the local machine. A command still running after about 10 seconds continues in the background and a completion notification arrives when it exits. Reading, searching and listing with cat, grep, find, ls and similar programs run normally, and a numbered file line in the output (grep -n, rg -n, nl -ba, cat -n) comes back as N:hh content, the line id view gives.shell always runs locally. RSA keys are not supported (see Remote Filesystem).With these tools an assistant can ask what a file declares, where a symbol is defined and used, who calls a function, what implements a type and which files import a file, and get line ids it can pass straight to batch_edit.
view with flags: "s" lists the declarations of a file or a directory, bodies elided.view with ast: true matches an ast-grep pattern such as $OBJ.unwrap() against the syntax tree instead of the text.symbol tool takes a relation: definition (default), references, callers, callees, supertypes, subtypes, imports, imported_by, or path (how one symbol reaches another).view content search labels each match with its enclosing symbol, for example [impl Store › fn flush].The outline, syntax-tree search, definition and references also work over ssh://. One worked example per relation, how the in-memory table behaves and the full limits are in doc/code-exploration.md.
Rust, Python, JavaScript, TypeScript, Go, Java, C/C++, PHP, Bash, Ruby, Lua, JSON, Swift, Svelte, CSS, Elixir and Markdown. Support is not the same for every feature:
symbol lookups and cannot be syntax-tree searched.symbol lookups, but cannot be syntax-tree searched and contributes nothing to the graph relations (callers, callees, supertypes, subtypes, imports, imported_by, path). JSON contributes nothing to them either.<script> blocks.supertypes and subtypes find nothing in them.(guess) mark flags a hop matched by name alone.ssh://, and they always search the whole session workdir; path only narrows which definitions of name start the query.view and the text-level symbol lookups keep a 5 MB limit.path or an Owner::name form; without one it is not traced.callers, callees and path (Python __init__.py re-exports and import *, JavaScript and TypeScript export ... from, up to 3 hops), for Rust pub use, for C and C++ headers that include another header, and for Swift @_exported import. Re-exports in the other languages are not followed.crate::a::f(), super::f(), self::f() and a::b::f(), Java com.acme.Util.run(), PHP \App\Models\User::find(), Elixir MyApp.Repo.get(id). A Rust path with a capitalised segment (Type::f()) and a PHP function called by namespace path are not resolved this way.cfg_rt! { ... }) count as items of the surrounding module, impl or trait when the macro body parses without errors and holds only items.#ifdef and #else, for example) leads to each of them, marked (guess).path relation searches from both ends one level at a time within the same 600-file and 800 ms budget; a search that was cut says so and repeating the query continues it. "No path ... within depth N" appears only when the search finished.Cargo.toml, the require lines of go.mod, composer.json, pom.xml) or the paths aliases of tsconfig.json and jsconfig.json; an aliased import counts as external.defdelegate counts as a call.go.mod, then in the standard library (src/<path>).getRepo().save(), is resolved by name only and shown as (guess).cargo install octofs
brew install muvon/tap/octofs
npx -y @muvon/octofs --version
The wrapper downloads the matching pre-built binary on first run. MCP config:
{
"mcpServers": {
"octofs": {
"command": "npx",
"args": ["-y", "@muvon/octofs", "mcp"]
}
}
}
Download from GitHub Releases for your platform:
| Platform | Target |
|---|---|
| Linux (x86_64) | x86_64-unknown-linux-musl |
| Linux (ARM64) | aarch64-unknown-linux-musl |
| Windows (x86_64) | x86_64-pc-windows-msvc |
| Windows (ARM64) | aarch64-pc-windows-msvc |
| macOS (Apple Silicon) | aarch64-apple-darwin |
Each release also ships .mcpb bundles for one-click install in clients that support MCP bundles (e.g. Claude Desktop).
Published to the MCP Registry as io.github.Muvon/octofs.
Requires Rust 1.95+.
git clone https://github.com/muvon/octofs
cd octofs
cargo build --release
# Binary at ./target/release/octofs
The shared-ID workflow requires the next Octocode release or a build of the updated source. OctoFS’s existing line-ID format is unchanged.
Use Octocode to find definitions, usages, and code relationships, then use OctoFS to read or edit the matching files. Octocode's MCP structural_search emits the same N:hh content source line IDs that OctoFS accepts for batch_edit, using their shared Octolib utility. You do not need another view just to obtain IDs for lines already returned.
Run both servers against the same checkout. IDs describe that source snapshot: changed targets are verified at edit time, and an error supplies current context rather than guessing where to write. Exact-name lookups return complete small definitions; previews of larger matches name the ranges you can read with OctoFS.
The CLI uses a mcp subcommand — your config must pass ["mcp"] as args.
Claude Code (CLI):
claude mcp add octofs -- octofs mcp --path /path/to/your/project
claude mcp add octocode -- octocode mcp --path /path/to/your/project
Codex CLI:
codex mcp add octofs -- octofs mcp --path /path/to/your/project
codex mcp add octocode -- octocode mcp --path /path/to/your/project
codex mcp list
The Octocode registration is optional. Install the servers you use and replace the paths with the same absolute checkout path. See the official Codex MCP documentation.
Cursor (~/.cursor/mcp.json):
{
"mcpServers": {
"octofs": {
"command": "octofs",
"args": ["mcp"]
}
}
}
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"octofs": {
"command": "octofs",
"args": ["mcp"]
}
}
}
Windsurf (~/.windsurf/mcp.json):
{
"mcpServers": {
"octofs": {
"command": "octofs",
"args": ["mcp"]
}
}
}
If Octofs isn't on your
PATH, use the full path to the binary (e.g./usr/local/bin/octofsor./target/release/octofs).
The MCP server starts automatically when your AI assistant connects.
Ask your AI assistant to:
unwrap() in the codebase"test.rs"src/main.rs declares"flush, two levels up?"src/util.rs?"Every line is addressed by a composite id N:hh — its 1-indexed position plus a
2-character hex hash (FNV-1a) of its content. Octocode structural-search source output uses the same shared utility and IDs. view renders lines as N:hh content:
1:a3 fn main() {
2:f1 println!("Hello");
3:0e }
Edit tools take these ids back as targets and verify the hash against the file
before applying anything. A stale id (the file changed since it was viewed) fails
with the current content around the target and where the expected content moved —
so the model retargets from the error instead of re-reading the file. Edit results
are diffs with fresh ids, so edits chain without re-viewing. Removed lines collapse
to their old id range (-12:a3..15:f1 (4 lines)), and a trailing
shift: lines after 40:b2 +3 line says how original line numbers below each edit
moved, so ids the model still holds can be adjusted without a failed call.
This is the single line-id format — there is no mode switch. Plain line numbers
are still accepted where a position alone is safe: view ranges (negative counts
from the end) and the insert anchors 0 (file start) / -1 (append).
Reading, searching and listing with the shell (cat, grep, rg, find, ls
and similar) run normally. A numbered line of a file in the output (grep -n,
rg -n, nl -ba, cat -n) comes back as N:hh content, the line id view
gives, when a file named by the command or by the output (path:N:text, or a path
heading line above the numbered lines) holds exactly that text on that line, so it
can go straight into batch_edit. Lines without a number, and numbered text that
is not a file line (clock times, counts, compiler positions), stay as printed.
Octofs rejects only programs that cannot work in the shell: bare sleep (a
sleep inside a loop body is fine) and watch/top/htop. The call fails with
an error explaining what to use instead; nothing executes. Writing files with the
usual programs (sed -i, tee, redirects) runs normally. Edits made with the
shell are not in the undo history of text_edit: undo_edit covers only edits
made with the edit tools.
Other guidance (out-of-bounds ranges, fuzzy-match notices) is appended to successful responses as ⚠️ hints without failing the call.
Standard input/output transport. Works with all MCP clients.
octofs mcp
Streamable HTTP transport for remote access or multi-client scenarios. Every tool, shell included, is reachable by whoever can connect, so access is gated:
# Loopback, no token: requests carrying a browser Origin header are rejected
octofs mcp --bind 127.0.0.1:12345
# Any other address requires a bearer token; octofs refuses to start without one
OCTOFS_AUTH_TOKEN="$(openssl rand -hex 32)" octofs mcp --bind 0.0.0.0:12345
Connect clients to http://localhost:12345/mcp; with a token they send Authorization: Bearer <token>. The server speaks plain HTTP, so put it behind TLS or an SSH tunnel when the token crosses a network. --auth-token <TOKEN> works too, but command-line arguments are visible to other local users.
By default, Octofs operates in the current directory. Specify a different root:
{
"mcpServers": {
"octofs": {
"command": "octofs",
"args": ["mcp", "--path", "/path/to/your/project"]
}
}
}
All path parameters — and --path itself — accept ssh:// or sftp:// URLs:
# Remote session root: relative paths resolve on the remote host
octofs mcp --path ssh://deploy@example.com/var/www/app --ssh-key ~/.ssh/id_ed25519
view path="ssh://deploy@example.com/etc/nginx/nginx.conf"
ssh://host (no path) and ssh://host/~/dir resolve against the login user's home, like ssh host / scp host:dir. ssh://host/dir stays absolute.Include and Match) and honor HostName, User, Port, and a single ProxyJump. Explicit URL values win, so both ssh://dev/path and ssh://user@example.com:2222/path work as expected. Multi-hop ProxyJump and ProxyCommand routing are rejected with a clear error.IdentityAgent (e.g. 1Password) or $SSH_AUTH_SOCK, then key files — --ssh-key if given, the host's IdentityFile entries, then the defaults in ~/.ssh (id_ed25519, id_ecdsa). Passphrase-protected key files are not supported directly; use an agent instead.rsa crate has an unfixed timing side-channel (Marvin attack, RUSTSEC-2023-0071), so octofs is built without RSA entirely. Use an ed25519 key instead (ssh-keygen -t ed25519); ecdsa also works. RSA-only setups fail with a clear error naming the key.~/.ssh/known_hosts with the OpenSSH accept-new policy: unknown hosts are recorded on first use, a changed key fails closed.--ssh-timeout SECS — connection timeout (default 30). Connections are pooled per host, kept alive with transport keepalives, and reconnected automatically if they drop.shell stays local — commands always run on the machine where Octofs runs; only file tools (view, text_edit, batch_edit, and symbol with definition/references) reach remote hosts. The graph relations of symbol are local only.view — Read files, list directories, search contentFile reading: (path is one path, or several joined with |; start/end are line numbers or line ids)
{"path": "src/main.rs"} // whole file
{"path": "src/main.rs", "start": 10, "end": 20} // lines 10–20
{"path": "src/main.rs", "start": 42, "end": 42} // single line
{"path": "src/main.rs", "start": 80} // line 80 → end of file
{"path": "src/main.rs", "start": -20} // last 20 lines
{"path": "src/main.rs", "start": "12:a3", "end": "20:f1"} // line ids from prior output
{"path": "src/main.rs", "ranges": [{"start": 10, "end": 20}, {"start": 80, "end": 95}]} // several spans in one read
{"path": "src/a.rs|src/b.rs"} // several files in one call
{"path": "src/a.rs", "ranges": [{"start": 10, "end": 20}, {"path": "src/b.rs", "start": 80}]} // spans of several files
ranges reads several spans in one call. Each span takes the same values as
start/end: a span without start begins at line 1, and one without end runs to
the last line. A span may name its own path to read from another file; without one
it reads the call's path. Spans of one file are sorted, overlapping or adjacent ones
are merged, and each gap shows as [... N lines omitted]. ranges cannot be combined
with start/end or content.
Output renders every line as N:hh content — the N:hh prefix is the line id
that batch_edit takes as targets. Files with the extension .spill
(saved tool output) are shown as stored, without added ids.
To read several files in one call, join their paths with | (up to 32) or name the
file on each ranges span. Each file comes back as its own section, headed by its path.
The other parameters of the call (start/end, flags, full) apply to every path
of a | list, and a directory in the list is listed. A path that cannot be read is
reported in its section and the others are still returned; the call fails only when
none can be read. An image in the list is named and has to be viewed in a call of its
own. A read that would take the result past the size limit of one tool result is named
instead of returned.
Reuse content and line ids already returned. Read a complete relevant function or block
in one call, combining adjacent windows. If its location is unknown, use content with
enough context to understand the matches, then fetch only missing surrounding code.
Do not re-read overlapping ranges or repeatedly narrow a range just to pick edit targets.
Re-read when the file may have changed, output was truncated, or prior context is unavailable.
Empty files return [empty file, 0 lines] on an initial or forced full read.
Images: a path with a png, jpg/jpeg, gif or webp extension returns the
image itself as an MCP image block (up to 5 MB; the bytes must match the extension).
start/end and content do not apply to it.
Delta views: a whole-file view of a file the session already served returns
only the hunks changed since — the same .../-/+ style as edit results, with
removed lines collapsed to their old id range — or
[unchanged since you last viewed or edited it (compared with the file on disk just now): N lines. Pass full: true to re-read, or view a line range.].
Octofs' own edits keep the cache current, so a re-view after your own batch_edit
costs one line. Ranged views and content search always render exactly what was asked.
full has no effect on ranges or searches; omit start/end/ranges and content search
to force a complete file read. It does not change output limits.
{"path": "src/main.rs", "full": true} // force the complete file (e.g. after context compaction)
Directory listing:
{"path": "src/"}
{"path": "src/", "pattern": "*.rs"}
{"path": "src/", "max_depth": 2, "include_hidden": true}
A bare listing of a remote directory (ssh://host/path, no pattern/content)
defaults to max_depth: 1 — root entries only — because every subdirectory costs
an SFTP round trip; pass max_depth explicitly to walk deeper. Searches with
pattern or content always walk the whole tree, like rg.
pattern uses the same gitignore-style glob grammar as ripgrep's -g/--glob:
without / it matches filenames at any depth, while a pattern containing /
matches the returned relative path. It supports * within one path component,
** across directories, ?, character classes such as [abc], brace alternatives
such as *.{rs,toml}, and leading ! exclusions. Use | to pass ordered globs in
one MCP string; later globs take precedence:
{"path": ".", "pattern": "**/*.{rs,toml}|!target/**"}
{"path": ".", "content": "unsafe", "pattern": "src/**/*.rs|!src/generated/**"}
The glob filters files discovered by Octofs' gitignore-aware traversal. Use
include_hidden: true to include hidden paths; gitignored paths remain excluded.
Patterns are limited to 4096 UTF-8 bytes, 64 |-separated rules, and 16 nested
brace levels. They must be a single line and are validated before traversal.
Escape a literal leading # or ! as \# or \!; otherwise # is rejected
instead of silently acting as a gitignore comment. Empty brace alternatives such
as {,rs} are rejected because ripgrep does not support them.
Content search: (literal by default; set regex: true for a Rust regex, (?i) = case-insensitive)
{"path": "src", "content": "fn main"}
{"path": "src", "content": "unwrap()", "context": 3}
{"path": "src", "content": "(?i)error", "regex": true}
{"path": "docs|scripts|BENCHMARK.md", "content": "update_benchmark.py", "context": 4}
For an rg-style search across several roots, path accepts |-separated literal
files and directories when content is set. The roots are not regexes: as with
rg's positional path arguments, each one must exist. A real path containing |
takes precedence over this shorthand. Root lists must be single-line, contain no
duplicates, and are limited to 32 roots and 8192 UTF-8 bytes.
In the default line mode, matches in a file with a grammar are preceded by the
enclosing symbol (e.g. [impl Store › fn flush]), once per symbol change. The
compact modes (c, l, o), inverted searches and files without a grammar
render without them.
Structural outline: (flags: "s" — alone; no content, no start/end/ranges, no other flags)
{"path": "src/main.rs", "flags": "s"}
{"path": "src/", "flags": "s", "pattern": "**/*.rs", "max_depth": 2}
Returns the declarations of a file — or of every supported file under a directory,
locally or over ssh:// — with their bodies elided. Each line keeps its N:hh id,
so the outline feeds batch_edit like any other view. Markdown files yield their
headings. A directory outline honours pattern, max_depth and include_hidden.
Supported languages: Rust, Python, JavaScript, TypeScript, Go, Java,
C/C++, PHP, Bash, Ruby, Lua, JSON, Swift, Svelte, CSS, Elixir, Markdown.
AST search: (ast: true — content holds the ast-grep pattern)
{"path": "src", "ast": true, "content": "fn $NAME($$$ARGS)"}
{"path": "src/main.rs", "ast": true, "content": "$OBJ.unwrap()"}
Matches the pattern against the syntax tree instead of the text: $NAME matches one
node, $$$ARGS a sequence, $_ any single node. The pattern must be complete, valid
code in the target language — a Python pattern may omit the body together with
the colon (def $F($$$A)); a trailing colon without a body (def $F($$$A):)
matches nothing. It works on a file or a directory, locally or over
ssh://, and honours pattern, max_depth, include_hidden, context and the
c/l flags. It cannot be combined with regex, start/end/ranges or the
s/v/o flags. Zero matches return a diagnostic naming the parsed kind, the
metavariables and the plain-text fallback. CSS, JSON and Markdown files are not
AST-searchable.
Directory listings annotate each file as path<TAB>NL<TAB>~Nt (line count + estimated tokens) so you can budget reads before opening files; binary files show path<TAB>(binary).
symbol — Navigate code from a symbol name{"name": "handle_*", "path": "src"} // definitions, `*` wildcards allowed
{"name": "flush", "path": "src/main.rs", "relation": "references"}
{"name": "flush", "path": "src", "flags": "c"} // hits per file
{"relation": "callers", "name": "flush", "depth": 2}
{"relation": "imported_by", "path": "src/util.rs"}
{"relation": "path", "name": "main", "to": "flush"}
relation picks what comes back:
relation | Returns |
|---|---|
definition (default) | The symbol's source, by name, in a file or under a directory (path, default the workdir) |
references | Every use of the name, grouped by enclosing symbol |
callers / callees | Functions that call the symbol / functions it calls |
supertypes / subtypes | Types it extends or implements / types that extend or implement it |
imports / imported_by | What the file in path imports / the files that import it (no name) |
path | How name reaches to through calls, extends and implements (imports are not followed) |
definition and references work locally or over ssh://, render N:hh content lines whose
ids feed batch_edit, and honour pattern, max_depth, include_hidden, context (references)
and flags (c counts per file, l lists files). An exact name renders the whole definition
when it is short enough; wildcard matches render a preview with the omitted range. The s, o,
v and r flags are rejected.
The graph relations (callers, callees, supertypes, subtypes, imports, imported_by,
path) are local only. They print one hop per line as path:line kind Owner::name, grouped
under depth N: (depth defaults to 1, path searches to 5, the maximum is 5), and are resolved
by name and imports, not types. Limits, the in-memory index and one worked example per relation:
doc/code-exploration.md.
text_edit — Create, edit, replace textCreate file:
{"command": "create", "path": "src/new.rs", "content": "pub fn new() {}"}
Replace string: (old_text must match exactly once)
{
"command": "str_replace",
"path": "src/main.rs",
"old_text": "fn old()",
"new_text": "fn new()"
}
Replace ALL occurrences (rename-style edits):
{
"command": "str_replace",
"path": "src/main.rs",
"old_text": "old_name",
"new_text": "new_name",
"replace_all": true
}
Several replacements, possibly in several files (edits apply in order, atomically across files; each path defaults to the call's path):
{
"command": "str_replace",
"path": "src/main.rs",
"edits": [
{"old_text": "fn old()", "new_text": "fn new()"},
{"path": "src/lib.rs", "old_text": "old()", "new_text": "new()", "replace_all": true}
]
}
Matching is progressive: exact → escaped-literal recovery (double-escaped \n/\t
interpreted when the result matches uniquely) → whitespace-normalized fuzzy with
indentation adjustment → rich diagnostics with the closest candidates and their
line ids. CRLF files are matched in LF space and keep their line endings on write.
Delete file: (recoverable with undo_edit)
{"command": "delete", "path": "src/old.rs"}
Undo last edit:
{"command": "undo_edit", "path": "src/main.rs"}
Check after the edit: text_edit and batch_edit accept an optional check, a shell command (for example the test that covers the change) that runs after the edit is written and whose output follows the edit result. It needs the shell tool: a client that filters shell out of a session's tools sets experimental.session.shell to false in its client capabilities, and octofs then hides check from the edit tools and rejects it before writing anything. A missing field or any other value keeps check available.
batch_edit — Atomic multi-operation editsPerform multiple insert/replace operations on a single file atomically.
Give only the new lines. If the first or last line of a replacement repeats the line just
before or after its range, that line is dropped, the edit is applied and a note in the result
says so. A lone closing bracket (}, ], )) or a blank line is kept, since those repeat
legitimately. Content that is nothing but the repeat fails the call.
Each operation has a start. For replace it's the first line of the range as a
line id copied from view output (add end for a range; omit it for a single
line). For insert it's the anchor to insert after — a line id, or the integers
0 (file start) / -1 (after last line). Every id is verified against the file
before anything applies; a stale id fails with the current content so the model
can retarget without a re-view. The result is a diff with fresh ids.
Insert at beginning:
{
"path": "src/main.rs",
"operations": [
{"operation": "insert", "start": 0, "content": "// Header\n"}
]
}
Replace lines:
{
"path": "src/main.rs",
"operations": [
{"operation": "replace", "start": "10:4b", "end": "15:c2", "content": "new code here"}
]
}
Copy lines from another file:
{
"path": "src/new.rs",
"operations": [
{"operation": "insert", "start": -1, "copy_from": {"path": "src/utils.rs", "start": 10, "end": 25}}
]
}
copy_from replaces content in an insert or replace operation; give exactly one of the two. start and end are line ids ("12:a3", verified against the source) or integers (negative counts from the end); end defaults to start. The source can be another file or the edited file. A same-file source is read as it was before the call, so moving lines inside a file is one call: insert the copy and replace the old range with "". If the target file does not exist, it is created (with its folders) only when every operation is a copy_from insert at 0 or -1; any other edit of a missing file fails with "File not found". Copied lines are not checked for duplicates.
shell — Execute commandsCommands start in the foreground and return their output normally when they finish within about 10 seconds:
{"command": "cargo test"}
{"command": "cd foo && cargo build"}
If a command is still running at that boundary, the same process continues in
the background. The response returns its PID and linked output resource, and a
completion notification arrives when it exits. There is no background flag
and the command is never killed or restarted during the handoff. Multiple
distinct commands may run concurrently, including from the same working
directory. An exact duplicate command in the same working directory is rejected
while the first copy is still running.
A client that declares the MCP tasks extension (io.modelcontextprotocol/tasks,
SEP-2663) gets the promoted command as a task whose id is the job id. The client
polls tasks/get and receives the same result a foreground call would have
returned (an error result led by the exit code when the command failed);
tasks/cancel stops the command's process group. While the command runs, the
task's status message names its PID and kill command (kill -- -<pid>), the
elapsed time, and its latest output line.
Other clients get the completion as resources/updated for the job resource (on
a subscriptions/listen stream when the client opened one). Claude Code does not
surface that to the model, so octofs also sends it as a Claude Code channel
message (notifications/claude/channel) on pre-2026-07-28 connections — the
exit code and output tail wake the session. Claude Code accepts channel
messages only from servers enabled for the session, in interactive mode, and
only on pre-2026-07-28 connections. Claude Code negotiates 2026-07-28 with stdio
servers by default, so until it declares the tasks extension, opt out of that as
well:
MCP_PROTOCOL_NEGOTIATION=legacy claude --dangerously-load-development-channels server:octofs
Without it, read the job's resource link when you need the result.
On Windows, shutdown cleanup terminates only direct child processes (no Unix process-group semantics); use
taskkill /PID <pid> /Tfor process trees.
octofs/
├── src/
│ ├── main.rs # Entry point, STDIO/HTTP server setup, signal handling
│ ├── cli.rs # CLI argument parsing (clap): octofs mcp [OPTIONS]
│ ├── mcp/
│ │ ├── mod.rs # McpToolCall, SessionRoot
│ │ ├── server.rs # OctofsServer (rmcp tool impl), Params structs, per-session state
│ │ ├── request_ctx.rs # Per-request hint queue + stale-file stamps
│ │ └── fs/ # Filesystem tool implementations
│ │ ├── mod.rs # Re-exports
│ │ ├── core.rs # view, text_edit, batch_edit
│ │ ├── file_ops.rs # view_file_spec, create_file_spec
│ │ ├── text_editing.rs # str_replace, batch_edit, undo, per-file locking
│ │ ├── directory.rs # Directory listing + content search
│ │ ├── search.rs # literal/regex matcher, symbol breadcrumbs
│ │ ├── structure.rs # Structural outline mode (flags: "s")
│ │ │ ├── symbols.rs # `symbol` tool: definitions, references, parameter validation
│ │ │ ├── code_index.rs # Per-workdir in-memory code index: name filters, parsed-file cache
│ │ │ ├── graph_scoped.rs # `symbol` graph relations answered on the code index
│ │ │ ├── graph.rs # `symbol` graph relations: parameters, rendering
│ │ ├── ast.rs # AST-pattern search mode (ast: true)
│ │ ├── shell.rs # Command execution, background, process cleanup
│ │ ├── remote.rs # SSH/SFTP path abstraction, SshHandler, SFTP pool
│ │ └── fs_tests.rs # Integration tests (cfg(test))
│ ├── structural/ # Tree-sitter grammars: outline, symbols, AST search
│ │ ├── mod.rs # Outline entry point, extension → language map
│ │ ├── signature_extractor.rs # Signature spans, Markdown headings
│ │ ├── symbols.rs # Definitions, references, symbol breadcrumbs
│ │ ├── graph/ # Code graph: files, symbols, calls, imports, extends, implements (no I/O)
│ │ ├── ast_search.rs # ast-grep pattern search over the grammars
│ │ └── languages/ # One grammar + outline rules per language
│ └── utils/
│ ├── mod.rs # Module re-exports
│ ├── line_hash.rs # Composite line ids (N:hh), FNV-1a hashes, endpoint parsing
│ └── truncation.rs # Token estimation, smart truncation
Key design decisions:
rmcp 3.x) for protocol handlingtokio::fs, never blocking std::fstokio::sync::Mutex prevents concurrent write conflictsN:hh id is verified against the file at apply time; a stale id fails with the current content instead of editing the wrong line# Build
cargo build --release
# Run tests
cargo test
# Lint (zero warnings policy)
cargo clippy
# Format
cargo fmt
# Run locally
cargo run -- mcp
# All tests
cargo test
# Specific test
cargo test test_view_file
# With output
cargo test -- --nocapture
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Quick checklist:
cargo fmt before committingcargo clippy passes with zero warningsSee SECURITY.md for security policy and reporting vulnerabilities.
Apache-2.0 — See LICENSE
Built by Muvon
Star the project on GitHub if Octofs is useful to you.