read_fileLABSCO SUMMARY
Safe by default is the part other shell servers skip.
Most shell servers hand the model a command string and then try to police it. This one takes the string away: by default the server builds every command itself, so the model reads, searches and inspects git history through typed tools that cannot reach outside the working directory. Writes and scripts are switches you turn on, and a raw shell is a separate mode you have to ask for by name.
What it is
An MCP server written in Go that gives a model typed tools for files, search and git instead of a shell string. With no configuration it boots in secure mode: read-only file, grep/glob and git inspection tools, every path confined to working_directory, and no raw shell command. A YAML config turns on writes and scripts; MCP_SHELL_ALLOW_UNSAFE=1 swaps all of it for a single unrestricted shell_exec.
What you get
- Read-only tools on by default:
read_file,list_dir,glob,grep,stat,diff_filesandsystem_info - Git inspection on by default —
git_status,git_log,git_diff,git_show,git_blame, branches, tags, stashes and remotes — with no push, fetch or clone - Path confinement: every path parameter is resolved against
working_directory, symlinks followed, and anything outside it is rejected - File and git write tools —
write_file,edit_file,mkdir,move,delete,git_add,git_commit,git_switch,git_restore,git_stash— only after you setwrites_enabled: true run_scriptfor scripts you define in the config: the client picks a name, the command behind it is yours and cannot be altered- Policy knobs in YAML:
working_directory,max_execution_time,max_output_size,run_as_userandaudit_log - An unrestricted mode, only with
MCP_SHELL_ALLOW_UNSAFE=1, whose single toolshell_execrunsbash -cwith no validation
Requirements
The Docker image sonirico/mcp-shell:latest — non-root, Alpine-based — or a Go build with make install. No config file is needed to start safely. MCP_SHELL_SEC_CONFIG_FILE points at your YAML policy; MCP_SHELL_ALLOW_UNSAFE=true disables all validation. Logging is controlled by MCP_SHELL_LOG_LEVEL, MCP_SHELL_LOG_FORMAT and MCP_SHELL_LOG_OUTPUT. The README recommends pairing the container with an OS sandbox — read-only filesystem, dropped capabilities — as defense in depth.
Setup effort
One command — docker run -it --rm -v /tmp/mcp-workspace:/tmp/mcp-workspace sonirico/mcp-shell:latest
USE CASES
Letting an assistant look around a directory
Run it with the built-in defaults and it can list, read and search files and inspect git history inside the working directory, and nothing else.
Letting it edit files and commit, on purpose
Set writes_enabled: true in the YAML config to expose the file and git write tools, still confined to the working directory.
Capping what a runaway command can cost you
Set max_execution_time, max_output_size and a working_directory, and turn the audit log on.
Running it where it can do least harm
Use the non-root container image with a mounted policy file, alongside OS-level confinement.
30 tools
Listed in project docs. Your client may show a different list.
list_dirglobgrepstatdiff_filessystem_infogit_statusgit_loggit_diffgit_showgit_blamegit_branchesgit_tagsgit_rev_parsegit_ls_filesgit_stash_listgit_remoteswrite_fileedit_filemkdirmovedeletegit_addgit_commitgit_switchgit_restoregit_stashrun_scriptshell_execBEFORE YOU INSTALL
What to know first
Tools you get
30 tools named in the project's documentation.
Requires
docker on PATH
Where it runs
The documented client runs the server on your machine.
INSTALLATION
Connect your client
Server setup
docker run -it --rm -v /tmp/mcp-workspace:/tmp/mcp-workspace sonirico/mcp-shell:latestMCP Clients
Claude Desktop
{
"mcpServers": {
"shell": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"sonirico/mcp-shell:latest"
],
"env": {
"MCP_SHELL_LOG_LEVEL": "info"
}
}
}
}