# Octofs: MCP Filesystem Server and Code Search 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 [![CI](https://github.com/muvon/octofs/actions/workflows/ci.yml/badge.svg)](https://github.com/muvon/octofs/actions/workflows/ci.yml) [![Coverage](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fmuvon%2Foctofs%2Fbadges%2Fcoverage.json&style=flat-square)](https://github.com/muvon/octofs/actions/workflows/ci.yml) [![Rust](https://img.shields.io/badge/Rust-1.95+-orange.svg?logo=rust)](https://www.rust-lang.org) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) [![MCP](https://img.shields.io/badge/MCP-2026--07--28-green.svg)](https://modelcontextprotocol.io) [![Version](https://img.shields.io/crates/v/octofs.svg)](https://crates.io/crates/octofs) *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](#overview) · [Installation](#installation) · [Quick Start](#quick-start) · [Filesystem tools](#filesystem-tools) · [Code exploration](#code-exploration) · [Tools Reference](#mcp-tools-reference) · [Docs](doc/tools.md) · [Architecture](#architecture) · [Changelog](CHANGELOG.md) · [Contributing](CONTRIBUTING.md) · [Good first issues](https://github.com/Muvon/octofs/contribute) MCP Registry: [`io.github.Muvon/octofs`](https://registry.modelcontextprotocol.io)
--- ## Overview 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. ## Filesystem tools 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-letter 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. - Transport is STDIO or Streamable HTTP. A non-loopback HTTP bind requires a bearer token. - Remote files use SSH/SFTP with your OpenSSH config. `shell` always runs locally. RSA keys are not supported (see [Remote Filesystem](#remote-filesystem-sshsftp)). ## Code exploration 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`. - **Outline.** `view` with `flags: "s"` lists the declarations of a file or a directory, bodies elided. - **Syntax-tree search.** `view` with `ast: true` matches an ast-grep pattern such as `$OBJ.unwrap()` against the syntax tree instead of the text. - **Symbol lookups.** The `symbol` tool takes a `relation`: `definition` (default), `references`, `callers`, `callees`, `supertypes`, `subtypes`, `imports`, `imported_by`, or `path` (how one symbol reaches another). - **Search with context.** In files that have a grammar, plain `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](doc/code-exploration.md). ### Supported languages 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: - CSS and JSON have an outline but name no symbol for `symbol` lookups and cannot be syntax-tree searched. - Markdown yields its headings for the outline and for `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. - Svelte files are read through their `