惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
aimingoo的专栏
aimingoo的专栏
S
SegmentFault 最新的问题
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
博客园 - 【当耐特】
月光博客
月光博客
C
Check Point Blog
T
The Blog of Author Tim Ferriss
罗磊的独立博客
博客园 - Franky
MongoDB | Blog
MongoDB | Blog
H
Help Net Security
Microsoft Security Blog
Microsoft Security Blog
B
Blog
阮一峰的网络日志
阮一峰的网络日志
腾讯CDC
美团技术团队
N
Netflix TechBlog - Medium
Stack Overflow Blog
Stack Overflow Blog
Y
Y Combinator Blog
L
LangChain Blog
The Cloudflare Blog

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店
GitHub - devrelopers/shell-mcp: MCP server for scoped she...
DavidCanHelp · 2026-05-01 · via Hacker News: Show HN

CI Crate License: MIT

Scoped, allowlisted shell access for Claude Desktop and other MCP clients.

shell-mcp is a small Rust binary that speaks the Model Context Protocol over stdio. It exposes two tools — shell_exec and shell_describe — and enforces a strict, layered safety model so you can hand a Claude session useful read access by default and opt in to write access per directory.

Why another shell server?

Most "shell" MCP servers either run anything the model asks (scary) or require you to enumerate every command up front (tedious). shell-mcp takes a middle path:

  • A curated, platform-aware read-only allowlist is on by default (ls, git status, cargo metadata, etc.).
  • Write commands require an explicit .shell-mcp.toml in the project, with shell-style glob patterns (cargo build **).
  • Configuration files are discovered by walking up the directory tree like git does, so a workspace can layer rules over a repo over a global default in ~/.shell-mcp.toml.
  • A small hard denylist (sudo, rm -rf /, fork bombs) is enforced before the allowlist and cannot be overridden.
  • All shell metacharacters (; && || | $() backticks > < >>) are rejected. If you need a pipeline, write a script and allowlist the script.

Install

cargo install shell-mcp

This drops a shell-mcp binary on your PATH.

Wire it into Claude Desktop

Edit your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS; %APPDATA%\Claude\claude_desktop_config.json on Windows):

{
  "mcpServers": {
    "shell": {
      "command": "shell-mcp",
      "args": ["--root", "/Users/you/code/your-project"]
    }
  }
}

Or use the env var form, which is equivalent:

{
  "mcpServers": {
    "shell": {
      "command": "shell-mcp",
      "env": { "SHELL_MCP_ROOT": "/Users/you/code/your-project" }
    }
  }
}

Heads up: setting cwd in your Desktop MCP config does NOT scope shell-mcp. Claude Desktop launches MCP servers from an undefined working directory (often / on macOS), and cwd in the Desktop config is not honoured for stdio servers. Always pass --root or set SHELL_MCP_ROOT when running under Desktop — otherwise the safety boundary collapses to the whole filesystem.

Restart Claude Desktop and the shell_exec and shell_describe tools will be available.

Launch-root precedence

shell-mcp resolves the launch root from these sources, highest precedence first:

  1. --root <PATH> CLI flag
  2. SHELL_MCP_ROOT environment variable
  3. The process's current working directory at launch (fine for direct shell invocations; unsafe under Claude Desktop — see above)

A user-supplied path (flag or env) must be absolute, must exist, and must be a directory. The chosen path is canonicalized so symlinks are resolved up front.

Tools

shell_describe

Returns the merged allowlist for the given subdirectory (or the launch root), the resolved working directory, the platform label, and the list of TOML files that were loaded in merge order. Call this first in every new session so the model can see what it's allowed to run.

shell_exec

Returns:

If the command is rejected, ok: false and a rejection block names the layer that refused it (metacharacter, hard_deny, escapes_root, not_allowlisted).

Configuration

A .shell-mcp.toml file looks like this:

include_defaults = true

allow = [
  "cargo build",
  "cargo build **",
  "git commit -m **",
  "./scripts/deploy.sh **",
]

Pattern syntax (one entry = one shell-tokenized pattern):

Pattern Matches
git status exactly git status
cargo build * cargo build plus exactly one more argument
cargo build ** cargo build plus any number of arguments (incl. zero)
cargo test foo?? cargo test foo plus any two characters

** only acts as a rest-matcher when it's the final token.

Discovery and merging:

  1. Start at the working directory shell-mcp is asked to run a command in.
  2. Walk up to filesystem root collecting every .shell-mcp.toml.
  3. Prepend ~/.shell-mcp.toml if present.
  4. Merge outermost-first; the innermost file wins for include_defaults, and rules from every file are concatenated.

The merge result is cached per (launch_root, cwd) pair.

Safety model in one paragraph

shell-mcp runs commands by spawning the program directly with discrete arguments — no shell is invoked. Any input containing shell metacharacters is rejected outright before parsing. Tokenized commands are checked against a small hard denylist (sudo, rm -rf /, etc.) that no user TOML can override. The working directory is normalized lexically and forced to stay inside the launch root. Only after all of that does the allowlist matcher decide whether the command runs. Output is captured separately for stdout and stderr, normalized from CRLF, and clipped at 200 lines or 8 KB per stream with an explicit truncated flag.

Default allowlist

Unix (macOS + Linux): ls, cat, head, tail, wc, grep, rg, find, tree, file, stat, pwd, which, echo, env, git status|log|diff|show|branch, git remote -v, cargo metadata|tree|--version, rustc --version.

Windows: dir, type, findstr, where, tree /F, git status|log|diff|show|branch, git remote -v, cargo metadata|tree|--version, rustc --version, whoami.

Building from source

git clone https://github.com/devrelopers/shell-mcp
cd shell-mcp
cargo build --release
./target/release/shell-mcp --root .

Run the tests:

cargo test

CI runs the full matrix on Ubuntu, macOS, and Windows on every push.

Status

v0.1.0. The MCP wire shape and the TOML schema are stable for the v0.1 series. Pipelines, environment variable controls, and per-rule timeouts are on the v0.2 roadmap.

License

MIT — see LICENSE.