RU

Rust MCP Server for Fast Asynchronous Filesystem Operations

Accelerate filesystem operations with a fast, asynchronous Rust MCP server for efficient, reliable handling of file I/O and management at scale.

Quick Install
npx -y @rust-mcp-stack/rust-mcp-filesystem

Overview

This Rust MCP server provides a lightweight, high-performance backend for asynchronous filesystem operations. It implements the Model Context Protocol (MCP) interface for file I/O so language models, agents, and other MCP-aware components can read, write, list, and manage files without blocking application threads. Built in Rust and powered by asynchronous IO, the server is intended for deployments that require predictable latency and safe concurrency when accessing on-disk content at scale.

The server is useful whenever you need a dedicated, network-exposed filesystem service for AI pipelines, agents, or microservices that must handle many concurrent transfers, stream large artifacts, or enforce a filesystem root and access controls. It can be run as a standalone daemon or embedded as a library in Rust-based projects, and it exposes metrics and configuration hooks for production deployment.

Features

  • Async, non-blocking file operations using Rust async runtime
  • MCP protocol endpoints for common filesystem actions (read, write, list, delete, metadata)
  • Streaming uploads and downloads to handle large files without buffering whole content in memory
  • Configurable filesystem root to restrict access to a subtree
  • Per-operation concurrency limits and timeouts
  • Optional TLS and Unix socket support for secure local or networked deployments
  • Prometheus-style metrics endpoint for throughput and latency monitoring
  • Small runtime footprint and safe memory behavior (Rust)
  • Simple JSON or binary MCP payloads for easy client integration

Installation / Configuration

Build from source (requires Rust toolchain):

# Clone the repository and build the release binary
git clone https://github.com/rust-mcp-stack/rust-mcp-filesystem.git
cd rust-mcp-filesystem
cargo build --release

# The binary will be in target/release/rust-mcp-filesystem
./target/release/rust-mcp-filesystem --help

Example minimal configuration (TOML):

# config.toml
listen = "127.0.0.1:8080"
root_path = "/var/lib/mcpfs"
max_concurrent_ops = 100
operation_timeout_secs = 30
metrics_listen = "127.0.0.1:9100"

[tls]
enabled = false
cert_path = "/etc/mcpfs/cert.pem"
key_path = "/etc/mcpfs/key.pem"

Run the server with a config file:

./target/release/rust-mcp-filesystem --config config.toml

Environment variable overrides:

  • MCPFS_LISTEN — override listen address
  • MCPFS_ROOT_PATH — override root_path
  • MCPFS_MAX_OPS — override max_concurrent_ops

Systemd unit example:

[Unit]
Description=Rust MCP Filesystem
After=network.target

[Service]
ExecStart=/usr/local/bin/rust-mcp-filesystem --config /etc/mcpfs/config.toml
Restart=on-failure
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target

Configuration reference

KeyTypeDefaultDescription
listenstring127.0.0.1:8080TCP address to bind MCP server
root_pathstring./dataFilesystem root enforced for all ops
max_concurrent_opsint50Maximum concurrent filesystem operations
operation_timeout_secsint30Per-operation timeout in seconds
metrics_listenstring127.0.0.1:9100Metrics endpoint address
tls.enabledboolfalseEnable TLS for transport

Available Tools / Resources

  • GitHub repository: https://github.com/rust-mcp-stack/rust-mcp-filesystem
  • Example client snippets and integration tests are provided in the examples/ directory of the repo
  • Prometheus metrics endpoint exposed at /metrics (default port from config)
  • Command-line flags: –config, –listen, –root-path, –log-level
  • Crate (library) export for embedding the server into other Rust applications

Use Cases

  1. Model context storage for agents

    • Provide agents with a secure, fast way to persist model artifacts, prompt histories, and temporary files. Agents communicate over MCP to read/write context files asynchronously while maintaining throughput.
  2. Asynchronous ingestion pipeline

    • Backend for high-throughput content ingestion (logs, user uploads, artifacts). Streaming writes allow ingestion of large files without large memory use.
  3. Edge and multi-tenant deployments

    • Use root_path to partition storage per tenant or per device; run the server on edge nodes where a small binary footprint and Rust safety matter.
  4. Checkpoint and artifact distribution

    • Stream model checkpoints and binaries to consumers over MCP without fully loading them into memory; clients can perform range reads or chunked downloads.

Concrete examples

  • Upload a file via a simple HTTP gateway (if enabled) using curl:
curl -X POST "http://127.0.0.1:8080/upload?path=/models/checkpoint.pt" \
  -F "file=@./checkpoint.pt"
  • Download a file as a stream:
curl "http://127.0.0.1:8080