Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

markdownfs

A high-performance, concurrent markdown database built in Rust. Supports Unix-like commands, Git-style versioning with content-addressable storage, disk persistence, multi-user permissioning, HTTP/REST API, and MCP (Model Context Protocol) for AI agents.

mdfs is also a strong fit for agent workspace use cases: durable markdown memory, inspectable artifacts, search, permissions, commits, and rollback in one shared surface.

Only Markdown (.md) files are supported by design.

🚀 Live demo: subramanya97-markdownfs.hf.space — a free Hugging Face Space running this exact binary. Web UI, REST, and MCP all available at one URL.

📚 Docs: docs.markdownfs.com · 🤗 Space: huggingface.co/spaces/Subramanya97/markdownfs

Access Methods

mdfs can be used five ways:

MethodSurfaceUse Case
CLI/REPLmarkdownfs binaryInteractive terminal use
HTTP/REST APImdfs-server binaryWeb apps, services, any HTTP client
MCP Servermdfs-mcp binaryAI agents (Cursor, Claude, etc.)
TypeScript SDKmarkdownfs on npmNode 18+ / browsers, via Bun or npm
Python SDKmarkdownfs on PyPIPython 3.9+, sync and async

All transports share the same concurrent core (MarkdownDb) with tokio::RwLock for safe multi-reader/single-writer access.

📚 Full documentation: docs.markdownfs.com

Quick Start

CLI

cargo build --release
cargo run --release --bin markdownfs

On first launch, you create an admin account. mdfs sets up your home directory and drops you right in:

markdownfs v0.2.0 — Markdown Virtual File System

Welcome! Let's set up your account.
Admin username: alice

Created admin 'alice' (uid=1, groups=[alice, wheel])
Home directory: /home/alice

Type 'help' for available commands, 'exit' to quit.

alice@markdownfs:~ $ touch hello.md
alice@markdownfs:~ $ write hello.md # Welcome to mdfs
alice@markdownfs:~ $ cat hello.md
# Welcome to mdfs

HTTP Server

MARKDOWNFS_LISTEN=127.0.0.1:3000 cargo run --release --bin mdfs-server

MCP Server

cargo run --release --bin mdfs-mcp

Add to your MCP client config (e.g., Cursor mcp.json):

{
  "mcpServers": {
    "mdfs": {
      "command": "/path/to/mdfs-mcp",
      "env": {
        "MARKDOWNFS_DATA_DIR": "/path/to/data"
      }
    }
  }
}

Documentation

Detailed guides are available in the docs/ folder:

GuideDescription
Getting StartedInstall, build, first run walkthrough for CLI, HTTP, and MCP
User ManagementUsers, groups, permissions, chmod/chown, delegation, team setup
Filesystem GuideFiles, directories, search, pipes, symlinks
Version ControlCommit, log, revert, deduplication
HTTP API GuideFull REST endpoint reference with curl examples
MCP GuideAI agent integration, tool reference, setup for Cursor/Claude
Agent Workspace PositioningMessaging, category, narrative, and competitive framing
Agent Workspace DemoRunnable 7-minute demo using CLI tools and the HTTP API
Demo ReadinessWhich gaps matter before the first polished demo
Semantic IndexVector-based retrieval as a derived index over markdown workspaces
Execution RoadmapHow to evolve from workspace layer to execution layer

Examples

Example demo content lives in examples/:

ExampleDescription
Incident WorkspaceSeed markdown files for the agent-workspace demo
Notebook ExamplesJupyter walkthroughs for getting started, mounting, and user-to-agent delegation

HTTP API Reference

All endpoints accept Authorization: Bearer <token> or Authorization: User <username> headers.

Filesystem

MethodEndpointDescription
GET/fs/{path}Read file (markdown) or list directory (JSON)
PUT/fs/{path}Write file or create directory (X-Markdownfs-Type: directory)
DELETE/fs/{path}?recursive=trueDelete file or directory
POST/fs/{path}?op=copy&dst=...Copy file
POST/fs/{path}?op=move&dst=...Move file
GET/fs/{path}?stat=trueFile metadata (JSON)

Search

MethodEndpointDescription
GET/search/grep?pattern=...&path=...&recursive=trueSearch file contents
GET/search/find?path=...&name=...Find files by glob
GET/tree/{path}Directory tree

Version Control

MethodEndpointDescription
POST/vcs/commitCommit ({"message": "..."})
GET/vcs/logCommit history
POST/vcs/revertRevert ({"hash": "..."})
GET/vcs/statusStatus

Auth & Health

MethodEndpointDescription
POST/auth/loginLogin ({"username": "..."})
GET/healthHealth check + stats

Example

# Write a file
curl -X PUT http://localhost:3000/fs/docs/readme.md \
  -H "Authorization: User alice" \
  -d "# Hello World"

# Read it back
curl http://localhost:3000/fs/docs/readme.md

# Commit
curl -X POST http://localhost:3000/vcs/commit \
  -H "Content-Type: application/json" \
  -d '{"message": "initial commit"}'

# Search
curl "http://localhost:3000/search/grep?pattern=Hello&recursive=true"

MCP Tools

The MCP server exposes these tools for AI agents:

ToolDescription
read_fileRead a markdown file by path
write_fileWrite content to a file (creates if needed)
list_directoryList files in a directory
search_filesGrep for a pattern across files
find_filesFind files by glob pattern
create_directoryCreate a directory (with parents)
delete_fileDelete a file or directory
move_fileMove or rename
commitCommit current state
get_historyShow commit log
revertRevert to a commit

CLI Commands

File Operations

CommandDescription
ls [-l] [path]List directory contents (filtered by permission)
cd [path]Change directory
pwdPrint working directory
mkdir [-p] <path>Create directory
touch <file.md>Create empty markdown file
cat <file>Display file contents
write <file> [content]Write content to file
edit <file.md>Multi-line editor with auto-commit
rm [-r] <path>Remove file or directory
mv <src> <dst>Move or rename
cp <src> <dst>Copy file
stat <path>Show metadata
tree [path]Directory tree
find [path] [-name pattern]Find files
grep [-r] <pattern> [path]Search contents
chmod <mode> <path>Change permissions
chown <user:group> <path>Change ownership
ln -s <target> <link>Symbolic link

User Management

CommandDescription
adduser <name>Create user with home directory (admin only)
addagent <name>Create agent with API token
deluser <name>Delete user (root only)
addgroup <name>Create group
delgroup <name>Delete group
usermod -aG <group> <user>Add user to group
groups [user]Show group memberships
whoamiShow current user
su <user>Switch user

Version Control

CommandDescription
commit <message>Snapshot state
logShow history
revert <hash>Revert to commit
statusSummary

Configuration

Environment variables:

VariableDefaultDescription
MARKDOWNFS_DATA_DIRCurrent directoryData storage directory
MARKDOWNFS_LISTEN127.0.0.1:3000HTTP server listen address
MARKDOWNFS_AUTOSAVE_SECS5Auto-save interval (seconds)
MARKDOWNFS_AUTOSAVE_WRITES100Auto-save after N writes
MARKDOWNFS_MAX_FILE_SIZE10485760 (10MB)Maximum file size
MARKDOWNFS_MAX_INODES1000000Maximum number of inodes
MARKDOWNFS_MAX_DEPTH256Maximum directory depth
RUST_LOGmarkdownfs=infoLog level (tracing)

Architecture

src/
  db.rs            Concurrent MarkdownDb (Arc<RwLock<DbInner>>)
  config.rs        Configuration from env vars
  server/          HTTP/REST API (axum)
    mod.rs           Router setup
    routes_fs.rs     Filesystem endpoints
    routes_vcs.rs    VCS endpoints
    routes_auth.rs   Auth + health endpoints
    middleware.rs    Auth extraction
  bin/
    mdfs_server.rs  HTTP server binary
    mdfs_mcp.rs     MCP server binary
    mdfs_mount.rs   FUSE mount binary
  auth/            Multi-user identity & permissions
    mod.rs           User, Group types
    registry.rs      UserRegistry CRUD
    perms.rs         Permission checks
    session.rs       Session context
  cmd/             Command dispatch & pipes
  fs/              Virtual filesystem core
    mod.rs           VirtualFs — inodes, path resolution, all ops
    inode.rs         Inode types
  store/           Content-addressable object store
  vcs/             Version control (commit, revert, log)
  persist.rs       Disk persistence (atomic bincode)
  error.rs         VfsError enum
  main.rs          CLI/REPL binary

Performance

~102.8x average speedup over native filesystem in the latest release benchmark run (in-memory, zero-copy reads, content-addressable dedup).

cargo test --release --test perf -- --nocapture
cargo test --release --test perf_comparison -- --nocapture

Testing

239 tests across 5 suites:

cargo test                        # all tests (18 unit + 111 integration + 37 perf + 1 perf_comparison + 72 permissions)
cargo test --test integration     # 111 integration tests
cargo test --test permissions     # 72 permission tests
cargo test --test perf --release  # 37 perf benchmarks

Docs site

The MkDocs source lives in docs/. Build locally with:

uv sync
uv run mkdocs serve   # http://localhost:8000
uv run mkdocs build --strict

CI deploys to docs.markdownfs.com on every push to master. See .github/workflows/docs.yml.

License

MIT

关于 About

A high-performance, in-memory virtual file system for Markdown files. Unix-like commands, Git-style versioning, content-addressable storage, and multi-user permissions — built in Rust.

语言 Languages

Rust83.6%
JavaScript4.6%
Python4.5%
TypeScript3.2%
CSS1.9%
HTML1.4%
Shell0.6%
Dockerfile0.2%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
32
Total Commits
峰值: 28次/周
Less
More

核心贡献者 Contributors