21#include <unordered_map>
38 void record_read(
const std::string& path,
size_t hash);
48 size_t current_hash)
const;
56 bool was_read(
const std::string& path)
const;
59 std::unordered_map<std::string, size_t> reads_;
86 const std::string& data_dir,
87 int model_context_bytes = 0);
112 const std::filesystem::path&
root_dir()
const;
142 std::filesystem::path
resolve_path(
const std::string& requested)
const;
163 void create_fs_tools(
const std::string& data_dir);
170 void register_fs_tools();
172 std::filesystem::path root_dir_;
174 int max_read_bytes_ = 0;
179 std::unique_ptr<ReadFileTool> read_file_;
180 std::unique_ptr<WriteFileTool> write_file_;
181 std::unique_ptr<EditFileTool> edit_file_;
182 std::unique_ptr<GlobTool> glob_;
183 std::unique_ptr<GrepTool> grep_;
184 std::unique_ptr<ListDirectoryTool> list_dir_;
Tracks file read state for read-before-write enforcement.
bool was_read(const std::string &path) const
Check if a file was ever read.
void record_read(const std::string &path, size_t hash)
Record that a file was read.
bool was_read_unchanged(const std::string &path, size_t current_hash) const
Check if a file was read and content unchanged.
Filesystem MCP server with read-before-write enforcement.
int max_read_bytes() const
Get max read bytes (size gate).
const IgnoreMatcher & ignore() const
Get the ignore matcher (#15, v2.1.4).
bool skip_duplicate_check(const std::string &tool_name) const override
read_file must always execute (updates FileAccessTracker).
bool set_working_dir(const std::string &path) override
Set working directory (changes root_dir).
~FilesystemServer() override
Destructor (default, unique_ptr cleanup).
std::filesystem::path resolve_path(const std::string &requested) const
Resolve and validate a path against root.
const FilesystemConfig & config() const
Get the filesystem config.
FileAccessTracker & tracker()
Get the file access tracker.
const std::filesystem::path & root_dir() const
Get the root directory.
gitignore-style path matcher (#15, v2.1.4).
Concrete base class for MCP servers (80% logic).
Configuration structs with defaults.
Path-relative ignore matching honoring .gitignore + .explorerignore.
Activate model on GPU (WARM → ACTIVE).
MCPServerBase concrete base class + ServerResponse.
Filesystem MCP server configuration.