|
Entropic 2.14.3
Local-first agentic inference engine
|
Bash MCP server for shell command execution. More...
#include <entropic/mcp/servers/bash.h>


Public Member Functions | |
| BashServer (const std::filesystem::path &working_dir, const std::string &data_dir, int timeout=30) | |
| Construct with working directory and data dir. | |
| ~BashServer () override | |
| Destructor. | |
| std::string | get_permission_pattern (const std::string &tool_name, const std::string &args_json) const override |
| Permission pattern: "execute:{base_cmd} *". | |
| bool | set_working_dir (const std::string &path) override |
| Set working directory. | |
| const std::filesystem::path & | working_dir () const |
| Get the working directory. | |
| int | timeout () const |
| Get the enforced per-command timeout. | |
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 &raw_args_json) |
| Execute a tool and wrap result in ServerResponse JSON. | |
| 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. | |
| 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. | |
Bash MCP server for shell command execution.
Single tool: execute. Runs /bin/sh -c in the server's working directory as the leader of its OWN process group, captures stdout and stderr together, and enforces timeout() on the wall clock: on expiry the whole group is SIGKILLed (background children included), the shell is reaped, and the model gets a typed timeout error naming the limit and the elapsed time, with whatever the command printed so far. When the command finishes normally, anything it left running in its group is killed too — a tool call does not leave processes behind. (A command that deliberately leaves its group, e.g. via setsid, escapes this.)
permissions.allow / permissions.deny patterns, keyed by get_permission_pattern()) and the tool-approval gate. Until v2.13.0 this comment claimed the server "blocks dangerous
commands" and "enforces timeout"; neither was true — there was never a denylist, and the timeout was stored and never read.| entropic::BashServer::BashServer | ( | const std::filesystem::path & | working_dir, |
| const std::string & | data_dir, | ||
| int | timeout = 30 |
||
| ) |
Construct with working directory and data dir.
| working_dir | Default working directory for commands. |
| data_dir | Path to bundled data directory. |
| timeout | Per-command wall-clock limit in seconds (enforced since v2.13.0; mcp.bash.timeout_seconds, default 30). |
A thin MCPServerBase subclass: it builds its one tool, registers it, and overrides only get_permission_pattern and set_working_dir.
| working_dir | Default working directory for commands. |
| data_dir | Path to bundled data directory. |
| timeout | Command timeout in seconds. @req REQ-MCP-001 @req REQ-MCP-023 |
|
overridedefault |
Destructor.
@dg_internal
|
overridevirtual |
Permission pattern: "execute:{base_cmd} *".
| tool_name | Tool name. |
| args_json | Arguments JSON. |
Approval granularity matters here: keying on the base command means an operator's "always allow" applies to a command family rather than to every shell invocation.
| tool_name | Tool name. |
| args_json | Arguments JSON. |
python -m x, the pattern names python. Unparseable arguments degrade to a base command of "unknown" (logged), never a wildcard. @req REQ-MCP-023 @req REQ-MCP-009 Reimplemented from entropic::MCPServerBase.
Set working directory.
Set the working directory.
| path | New working directory. |
Re-targets the server so a sandbox swap does not require reconstructing it.
| path | New working directory. |
Reimplemented from entropic::MCPServerBase.
| int entropic::BashServer::timeout | ( | ) | const |
| const std::filesystem::path & entropic::BashServer::working_dir | ( | ) | const |