|
Entropic 2.3.8
Local-first agentic inference engine
|
Concrete base class for MCP servers (80% logic). More...
#include <entropic/mcp/server_base.h>


Public Member Functions | |
| 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 | skip_duplicate_check (const std::string &tool_name) const |
| Check if a tool should skip duplicate detection. | |
| virtual bool | configure (const std::string &config_json) |
| Configure the server after creation. | |
| virtual bool | set_working_dir (const std::string &path) |
| Set the working directory. | |
| const ToolRegistry & | registry () const |
| Get the tool registry (const). | |
Protected Attributes | |
| std::string | name_ |
| Server name. | |
| ToolRegistry | registry_ |
| Tool registry. | |
Concrete base class for MCP servers (80% logic).
Owns a ToolRegistry. Provides:
Concrete servers (FilesystemServer, BashServer, etc.) subclass and:
Definition at line 66 of file server_base.h.
|
explicit |
Construct with server name.
| name | Server name (e.g., "filesystem", "bash", "git"). |
| name | Server name. |
Definition at line 23 of file server_base.cpp.
|
virtual |
Configure the server after creation.
Default configure: no-op.
| config_json | JSON configuration string. |
Default: no-op, returns true. Override for server-specific init.
| config_json | Configuration JSON (unused in default). |
Definition at line 112 of file server_base.cpp.
| std::string entropic::MCPServerBase::execute | ( | const std::string & | tool_name, |
| const std::string & | args_json | ||
| ) |
Execute a tool and wrap result in ServerResponse JSON.
Execute a tool and return ServerResponse JSON.
| tool_name | Tool name (without server prefix). |
| args_json | JSON string of arguments. |
Flow:
| tool_name | Tool name (without server prefix). |
| args_json | JSON arguments. |
Definition at line 64 of file server_base.cpp.
|
virtual |
Generate permission pattern for 'Always Allow/Deny'.
Default permission pattern: tool-level.
| tool_name | Fully-qualified tool name (e.g., "filesystem.read_file"). |
| args_json | Tool call arguments as JSON string. |
Default: returns tool_name (tool-level granularity). Override in subclasses for finer granularity.
| tool_name | Fully-qualified tool name. |
| args_json | Tool arguments (unused in default). |
Reimplemented in entropic::BashServer.
Definition at line 87 of file server_base.cpp.
| std::string entropic::MCPServerBase::list_tools | ( | ) | const |
List all registered tools as a JSON array string.
List all registered tools as JSON array.
Definition at line 52 of file server_base.cpp.
| const std::string & entropic::MCPServerBase::name | ( | ) | const |
Get the server name.
Definition at line 32 of file server_base.cpp.
| void entropic::MCPServerBase::register_tool | ( | ToolBase * | tool | ) |
Register a tool with this server.
| tool | Non-owning pointer. Server does NOT take ownership. |
| tool | Tool pointer (non-owning). |
Definition at line 42 of file server_base.cpp.
|
inline |
Get the tool registry (const).
Definition at line 165 of file server_base.h.
|
virtual |
Set the working directory.
Default set_working_dir: no-op.
| path | New working directory path. |
Default: no-op, returns true. Override in directory-aware servers.
| path | Working directory (unused in default). |
Reimplemented in entropic::BashServer, entropic::FilesystemServer, and entropic::GitServer.
Definition at line 123 of file server_base.cpp.
|
virtual |
Check if a tool should skip duplicate detection.
Default: do not skip duplicate check.
| tool_name | Local tool name (without server prefix). |
Override for tools with side effects that must always execute (e.g., read_file updates FileAccessTracker).
| tool_name | Tool name (unused in default). |
Reimplemented in entropic::EntropicServer, and entropic::FilesystemServer.
Definition at line 100 of file server_base.cpp.
|
protected |
Server name.
Definition at line 168 of file server_base.h.
|
protected |
Tool registry.
Definition at line 169 of file server_base.h.