Skip to main content

Crate fs_mcp_rs

Crate fs_mcp_rs 

Source
Expand description

A bounded, root-isolated filesystem server for the Model Context Protocol (MCP).

The crate separates path-policy enforcement, filesystem operations, search, protocol types, configuration, and child-process management into independent modules. Applications can embed these modules directly or run the bundled fs-mcp-rs binary using either HTTP POST or STDIO JSON-RPC transports.

§Transports & Execution Modes

  • STDIO Mode: Standard input/output line-delimited JSON-RPC 2.0 streaming, ideal for local MCP client subprocess integration (e.g. via npx fs-mcp-rs).
  • HTTP Mode: Streamable HTTP server exposing /mcp and /health endpoints with optional OAuth 2.0 / OIDC authentication metadata.
  • CLI Quickstart: Roots can be passed directly as positional arguments or configured via TOML files and environment variables.

§Security model

All filesystem entry points accept a security::Policy. The policy canonicalizes paths, confines them to configured roots, optionally rejects symbolic links, and can disable every write operation.

§Resource bounds

Reads, writes, search results, terminal output, terminal reads, execution time, and concurrency are bounded by configuration. File replacement is performed through a temporary file in the destination directory.

§Modules

  • filesystem provides bounded and atomic filesystem operations.
  • search implements parallel filename and text search.
  • security validates paths against the configured access policy.
  • protocol contains the JSON-RPC and MCP wire types.
  • settings loads and validates TOML configuration.
  • terminal manages bounded persistent command sessions.
  • tree generates bounded and paginated directory trees.
  • patch validates and applies unified diff text patches.
  • cli_format generates client configuration snippets and help views.
  • wizard interactive setup wizard for initial configuration.

Modules§

cli_format
Formatting utilities for CLI guidance, tools catalog, client snippets, and config validation summaries.
filesystem
Bounded filesystem operations guarded by an access policy.
patch
Safe, bounded application of a unified diff to one existing UTF-8 file.
protocol
JSON-RPC 2.0 and Model Context Protocol wire types.
search
Parallel, bounded filename and file-content search.
security
Filesystem access-policy enforcement.
settings
Command-line and TOML configuration.
terminal
Bounded command execution and persistent terminal sessions.
tree
Bounded, deterministic, flat directory-tree traversal.
wizard
Interactive CLI setup wizard for creating fs-mcp-rs configuration files.