π 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
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.92+.
# Clone and build
# Binary will be at ./target/release/octofs
# Optionally install globally
Pre-built Binaries
Download from GitHub Releases for your platform.
Quick Start
1. Configure Your AI Assistant
Cursor (~/.cursor/mcp.json):
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
Windsurf (~/.windsurf/mcp.json):
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 single/multiple files, 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
- Undo β Revert last edit (up to 10 undo levels per file)
- Batch Edit β Perform multiple insert/replace operations atomically on a single file
π 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:
Transport Modes
STDIO (default)
Standard input/output transport. Works with all MCP clients.
HTTP
Streamable HTTP transport for remote access or multi-client scenarios.
Connect clients to http://localhost:12345/mcp.
Working Directory
By default, Octofs operates in the current directory. Specify a different root:
MCP Tools Reference
view β Read files, list directories, search content
File reading:
// hash mode
Multi-file reading (max 50):
Directory listing:
Content search:
text_editor β Create, edit, replace text
Create file:
Replace string:
Undo last edit:
batch_edit β Atomic multi-operation edits
Perform multiple insert/replace operations on a single file atomically.
Insert at beginning:
Replace lines:
Hash mode (stable across edits):
extract_lines β Copy lines between files
shell β Execute commands
Foreground:
Background:
// Returns PID, kill later with: {"command": "kill 12345"}
workdir β Manage working directory
Get current:
Set new:
Reset to session root:
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)
β βββ shared_utils.rs # Shared utilities
β βββ hint_accumulator.rs # Tool feedback hints
β βββ 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/
βββ glob.rs # Glob pattern matching
βββ 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
# Run tests
# Lint (zero warnings policy)
# Format
# Run locally
Running Tests
# All tests
# Specific test
# With output
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
Built with π¦ by Muvon
Star us on GitHub if Octofs helps you ship faster! β