Octofs
The fastest, most capable filesystem MCP server built in Rust, giving AI agents superpowers to read, search, edit, and manage files and directories.
README
<div align="center">
π Octofs
Give your AI assistant filesystem superpowers
The fastest, most capable filesystem MCP server. Built in Rust for AI agents that actually ship.
Installation β’ Quick Start β’ Features β’ Tools Reference
MCP Registry name: mcp-name: io.github.Muvon/octofs
</div>
Why Octofs?
Your AI coding assistant (Cursor, Claude, Windsurf, etc.) is smartβbut it's blind to your filesystem. Octofs bridges that gap, giving your AI:
- Eyes β Read files, search content, explore directories
- Hands β Create, edit, batch-modify files atomically
- Context β Execute commands, manage working directories
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β You: "Refactor all error handling to use anyhow::Context" β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β AI without Octofs: β
β β’ "I can't see your project structure" β
β β’ "Please paste the relevant files" β
β β’ *Wastes 10 minutes on back-and-forth* β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β AI with Octofs: β
β β’ Scans entire codebase in milliseconds β
β β’ Finds all 47 error handling patterns β
β β’ Suggests atomic batch edits β
β β’ Applies changes with your approval β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
What Makes It Different
| Feature | Octofs | Others |
|---|---|---|
| Speed | Rust-powered, sub-millisecond responses | Python/Node-based, slower |
| Content Search | Built-in search with context lines | String matching only |
| Batch Operations | Atomic multi-edit on single file | One-at-a-time |
| Line Modes | Hash-based (stable across edits) or number-based | Number-only |
| Transport | STDIO + HTTP (Streamable HTTP) | STDIO only |
| Shell Integration | Background process support | Limited or none |
| Safety | Gitignore-aware, path validation | Full filesystem access |
Installation
From Source
Requires Rust 1.95+.
# Clone and build
git clone https://github.com/muvon/octofs
cd octofs
cargo build --release
# Binary will be at ./target/release/octofs
# Optionally install globally
cargo install --path .
Pre-built Binaries
Download from GitHub Releases for your platform.
Quick Start
1. Configure Your AI Assistant
Cursor (~/.cursor/mcp.json):
{
"mcpServers": {
"octofs": {
"command": "/path/to/octofs"
}
}
}
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"octofs": {
"command": "/path/to/octofs"
}
}
}
Windsurf (~/.windsurf/mcp.json):
{
"mcpServers": {
"octofs": {
"command": "/path/to/octofs"
}
}
}
2. Restart Your AI Assistant
The MCP server will start automatically when your AI assistant connects.
3. Try It
Ask your AI assistant to:
- "Show me the project structure"
- "Read the main.rs file"
- "Search for all uses of
unwrap()in the codebase" - "Create a new file called
test.rs"
Features
π Filesystem Operations
- View Files & Directories β Read a single file (call
viewin parallel for several), list directories with glob patterns, search content - Smart Truncation β Large files are truncated intelligently to avoid overwhelming context
- Gitignore-Aware β Respects
.gitignorepatterns during directory traversal - Line Ranges β Read specific line ranges with negative indexing support (
-1= last line)
βοΈ Text Editing
- Create Files β Create new files with automatic parent directory creation
- String Replace β Replace exact string matches with fuzzy fallback for whitespace
- Delete β Remove a file (recoverable via undo)
- Undo β Revert last edit (up to 10 undo levels per file)
- Batch Edit β Perform multiple insert/replace operations atomically on a single file
- Stale-Write Protection β Edits fail fast if the file changed on disk since it was last viewed (external-edit detection, like an IDE's "file changed on disk" guard)
π Code Intelligence
- Content Search β Search for strings within files with context lines
- Line Extraction β Copy specific line ranges from one file to another
π₯οΈ Shell & System
- Command Execution β Run shell commands with output capture
- Background Processes β Run long commands in background, get PID for later management
- Working Directory β Set/get/reset working directory context for operations
Configuration
Line Identifier Modes
Octofs supports two modes for identifying lines in files:
Number Mode (default)
Lines are identified by 1-indexed line numbers:
1: fn main() {
2: println!("Hello");
3: }
Use for: Simple operations, one-off edits.
Hash Mode
Lines are identified by 4-character hex hashes derived from content:
a3bd: fn main() {
c7f2: println!("Hello");
e9f1: }
Use for: Complex multi-step edits where line numbers would shift. Hashes stay stable across edits.
Enable hash mode:
{
"mcpServers": {
"octofs": {
"command": "/path/to/octofs",
"args": ["--line-mode", "hash"]
}
}
}
Transport Modes
STDIO (default)
Standard input/output transport. Works with all MCP clients.
octofs # defaults to STDIO
HTTP
Streamable HTTP transport for remote access or multi-client scenarios.
octofs --bind 0.0.0.0:12345
Connect clients to http://localhost:12345/mcp.
Working Directory
By default, Octofs operates in the current directory. Specify a different root:
{
"mcpServers": {
"octofs": {
"command": "/path/to/octofs",
"args": ["--path", "/path/to/your/project"]
}
}
}
MCP Tools Reference
view β Read files, list directories, search content
File reading: (path is a single path; start/end are line numbers or hashes)
{"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": "a3bd", "end": "c7f2"} // hash mode
To read several files, make multiple view calls β they run in parallel.
Directory listing:
{"path": "src/"}
{"path": "src/", "pattern": "*.rs"}
{"path": "src/", "max_depth": 2, "include_hidden": true}
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}
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).
text_editor β Create, edit, replace text
Create file:
{"command": "create", "path": "src/new.rs", "content": "pub fn new() {}"}
Replace string:
{
"command": "str_replace",
"path": "src/main.rs",
"old_text": "fn old()",
"new_text": "fn new()"
}
Delete file: (recoverable with undo_edit)
{"command": "delete", "path": "src/old.rs"}
Undo last edit:
{"command": "undo_edit", "path": "src/main.rs"}
batch_edit β Atomic multi-operation edits
Perform multiple insert/replace operations on a single file atomically.
Each operation has a start (line number or hash). For insert it's the anchor
(0 = file start, -1 = after last line, N = after line N). For replace add end
for a range (omit end for a single line). start and end must be the same kind β
both line numbers or both hashes (no mixing).
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, "end": 15, "content": "new code here"}
]
}
Hash mode (stable across edits):
{
"path": "src/main.rs",
"operations": [
{"operation": "replace", "start": "a3bd", "end": "c7f2", "content": "new code"}
]
}
extract_lines β Copy lines between files
{
"from_path": "src/utils.rs",
"from_start": 10,
"from_end": 25,
"append_path": "src/new.rs",
"append_line": -1
}
from_end is optional (omit to copy a single line). from_start, from_end, and
append_line each accept a line number or a content hash. append_line positions the
copy in the target: 0 = beginning, -1 = end, N = after line N.
shell β Execute commands
Foreground:
{"command": "cargo test"}
{"command": "cd foo && cargo build"}
Background:
{"command": "python -m http.server 8000", "background": true}
// Returns PID; the response includes the platform-specific kill command
On Windows, shutdown cleanup terminates only direct child processes (no Unix process-group semantics); use
taskkill /PID <pid> /Tfor process trees.
workdir β Manage working directory
Get current:
{}
Set new:
{"path": "/path/to/project"}
Reset to session root:
{"reset": true}
Architecture
octofs/
βββ src/
β βββ main.rs # Entry point, STDIO/HTTP server setup
β βββ cli.rs # CLI argument parsing (clap)
β βββ mcp/
β βββ server.rs # MCP protocol handler (rmcp SDK)
β βββ request_ctx.rs # Per-request hints + stale-file stamps
β βββ fs/ # Filesystem tools
β βββ core.rs # view, batch_edit, extract_lines, text_editor
β βββ text_editing.rs # str_replace, undo, batch operations
β βββ directory.rs # Directory traversal
β βββ file_ops.rs # File operations
β βββ search.rs # Content search
β βββ shell.rs # Command execution
β βββ workdir.rs # Working directory management
β βββ fs_tests.rs # Unit tests
βββ src/utils/
βββ line_hash.rs # Content-based line hashing
βββ truncation.rs # Smart content truncation
Key components:
- rmcp SDK β Official Rust MCP SDK for protocol handling
- Tokio β Async runtime for concurrent operations
- File locking β Per-file async locks prevent concurrent write conflicts
- Undo history β Up to 10 undo levels per file, thread-safe storage
Development
# Build
cargo build --release
# Run tests
cargo test
# Lint (zero warnings policy)
cargo clippy
# Format
cargo fmt
# Run locally
cargo run
Running Tests
# All tests
cargo test
# Specific test
cargo test test_view_file
# With output
cargo test -- --nocapture
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Quick checklist:
- Run
cargo fmtbefore committing - Ensure
cargo clippypasses with zero warnings - Add tests for new functionality
- Update documentation as needed
Security
See SECURITY.md for security policy and reporting vulnerabilities.
License
Apache-2.0 β See LICENSE
Acknowledgments
- rmcp β Official Rust MCP SDK
- Model Context Protocol β The protocol specification
<div align="center">
Built with π¦ by Muvon
Star us on GitHub if Octofs helps you ship faster! β
</div>
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.