|
Entropic 2.3.8
Local-first agentic inference engine
|
Filesystem MCP server with read-before-write enforcement. More...
#include <entropic/mcp/servers/filesystem.h>


Public Member Functions | |
| FilesystemServer (const std::filesystem::path &root_dir, const FilesystemConfig &config, const std::string &data_dir, int model_context_bytes=0) | |
| Construct with root directory, config, and data dir. | |
| ~FilesystemServer () override | |
| Destructor (default, unique_ptr cleanup). | |
| 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). | |
| const std::filesystem::path & | root_dir () const |
| Get the root directory. | |
| FileAccessTracker & | tracker () |
| Get the file access tracker. | |
| const FilesystemConfig & | config () const |
| Get the filesystem config. | |
| int | max_read_bytes () const |
| Get max read bytes (size gate). | |
| std::filesystem::path | resolve_path (const std::string &requested) const |
| Resolve and validate a path against root. | |
| const IgnoreMatcher & | ignore () const |
| Get the ignore matcher (#15, v2.1.4). | |
Public Member Functions inherited from entropic::MCPServerBase | |
| MCPServerBase (std::string name) | |
| Construct with server name. | |
| const std::string & | name () const |
| Get the server name. | |
| void | register_tool (ToolBase *tool) |
| Register a tool with this server. | |
| std::string | list_tools () const |
| List all registered tools as a JSON array string. | |
| std::string | execute (const std::string &tool_name, const std::string &args_json) |
| Execute a tool and wrap result in ServerResponse JSON. | |
| virtual std::string | get_permission_pattern (const std::string &tool_name, const std::string &args_json) const |
| Generate permission pattern for 'Always Allow/Deny'. | |
| virtual bool | configure (const std::string &config_json) |
| Configure the server after creation. | |
| const ToolRegistry & | registry () const |
| Get the tool registry (const). | |
Additional Inherited Members | |
Protected Attributes inherited from entropic::MCPServerBase | |
| std::string | name_ |
| Server name. | |
| ToolRegistry | registry_ |
| Tool registry. | |
Filesystem MCP server with read-before-write enforcement.
Definition at line 74 of file filesystem.h.
| entropic::FilesystemServer::FilesystemServer | ( | const std::filesystem::path & | root_dir, |
| const FilesystemConfig & | config, | ||
| const std::string & | data_dir, | ||
| int | model_context_bytes = 0 |
||
| ) |
Construct with root directory, config, and data dir.
Construct filesystem server, create and register all tools.
| root_dir | Project root directory. |
| config | Filesystem configuration. |
| data_dir | Path to bundled data directory (for tool JSONs). |
| model_context_bytes | Model context window in bytes (for size gate). |
Issue #15 (v2.1.4): also loads .gitignore + .explorerignore via the IgnoreMatcher member so glob/grep/read filter ignored paths.
| root_dir | Project root directory. |
| config | Filesystem configuration. |
| data_dir | Path to bundled data directory. |
| model_context_bytes | Model context window in bytes. |
Definition at line 1332 of file filesystem.cpp.
| const FilesystemConfig & entropic::FilesystemServer::config | ( | ) | const |
Get the filesystem config.
Definition at line 1468 of file filesystem.cpp.
| const IgnoreMatcher & entropic::FilesystemServer::ignore | ( | ) | const |
Get the ignore matcher (#15, v2.1.4).
Loaded from .gitignore (recursive) + .explorerignore at server construction and on set_working_dir. Used by glob, grep, and read_file to filter results / refuse access.
Definition at line 1458 of file filesystem.cpp.
| int entropic::FilesystemServer::max_read_bytes | ( | ) | const |
Get max read bytes (size gate).
Get max read bytes for size gate.
Definition at line 1478 of file filesystem.cpp.
| fs::path entropic::FilesystemServer::resolve_path | ( | const std::string & | requested | ) | const |
Resolve and validate a path against root.
Resolve and validate a path against root directory.
| requested | User-requested path. |
| std::runtime_error | if path escapes root. |
Resolves relative paths against root_dir_, canonicalizes, and checks that the result does not escape root. Throws on escape unless allow_outside_root is configured.
Containment uses lexically_relative so that "/home/user/project" does not falsely contain "/home/user/projectile" via string-prefix.
| requested | User-requested path string. |
| std::runtime_error | if path escapes root. |
Definition at line 1498 of file filesystem.cpp.
| const fs::path & entropic::FilesystemServer::root_dir | ( | ) | const |
Get the root directory.
Definition at line 1438 of file filesystem.cpp.
|
overridevirtual |
Set working directory (changes root_dir).
Set working directory by updating root_dir.
| path | New root directory. |
Issue #15 (v2.1.4): also reloads IgnoreMatcher rules so the new root's .gitignore + .explorerignore take effect immediately.
| path | New root directory. |
Reimplemented from entropic::MCPServerBase.
Definition at line 1417 of file filesystem.cpp.
|
overridevirtual |
read_file must always execute (updates FileAccessTracker).
read_file always executes (updates FileAccessTracker).
| tool_name | Tool name. |
| tool_name | Tool name to check. |
Reimplemented from entropic::MCPServerBase.
Definition at line 1401 of file filesystem.cpp.
| FileAccessTracker & entropic::FilesystemServer::tracker | ( | ) |
Get the file access tracker.
Definition at line 1448 of file filesystem.cpp.