Skip to main content

emperor_folder/
lib.rs

1//! An MCP server confined to one folder (or a few named ones).
2//!
3//! The operator names one or more root directories; the model gets seven tools (`list`, `read`,
4//! `search`, `stat`, and with `--writable` also `write`, `edit`, `move`) over them and nothing
5//! else. Confinement is enforced by
6//! [`cap_std::fs::Dir`]: every file operation is a root-relative call on the opened root, and the
7//! operating system refuses anything that resolves outside its root, symlinks included. Listing and
8//! search use the [`ignore`] walker, so `.gitignore` and hidden files are honoured. The server is
9//! read-only unless started with `--writable`; read-only, the mutating tools are not listed.
10//!
11//! Built on [emperor-mcp](https://github.com/yarenty/emperor-mcp): stateless Streamable HTTP,
12//! framed output, a `doctor` subcommand. stdio is available for desktop clients.
13
14#![warn(missing_docs)]
15
16pub mod doctor;
17pub mod error;
18pub mod folder;
19pub mod path;
20pub mod server;
21
22pub use emperor_mcp::ServeOptions;
23pub use error::FolderError;
24pub use folder::{Config, Folder, ReadOutput, RootSpec, WriteMode};
25pub use server::{FolderServer, default_allowed_hosts, serve_http, serve_stdio};