raspi-bash-mcp

raspi-bash-mcp

Exposes a single tool run_bash for executing arbitrary shell commands on a Raspberry Pi or host, with no security restrictions, using LangChain and Streamable HTTP transport.

Category
访问服务器

README

raspi-bash-mcp

An MCP server that exposes a single tool, run_bash, for executing shell commands on a Raspberry Pi (or any host). The tool is implemented as a LangChain @tool and served over the Streamable HTTP transport so any MCP-compatible client can reach it over the network.

Security

run_bash accepts any command and runs it as the user that started the server, with no allowlist and no sandbox. Do not expose this server on an untrusted network. A compromised client can fully take over the host.

Install

Requires Python 3.10+.

pip install -e .

Run

raspi-bash-mcp --host 0.0.0.0 --port 8000
# or
python server.py --host 0.0.0.0 --port 8000

The server listens at http://<host>:<port>/mcp.

Tool

  • run_bash(command: str) -> str — executes command via /bin/bash -c and returns stdout (and stderr, if any) inside a fenced code block, followed by the exit code.

Debian package

Build

On any Debian-like host with dpkg-dev and python3:

./scripts/build-deb.sh

The artifact is written to dist/raspi-bash-mcp_<version>_all.deb.

Install on the Raspberry Pi

Copy the .deb to the Pi, then install it. The Pi needs internet access during install so pip can fetch mcp and langchain-core into /opt/raspi-bash-mcp/venv.

# from your workstation
scp dist/raspi-bash-mcp_0.1.0_all.deb pi@raspberrypi.local:~

# on the Pi
sudo apt install ./raspi-bash-mcp_0.1.0_all.deb

apt install ./<file>.deb is preferred over dpkg -i because it resolves dependencies automatically. If you do use dpkg -i and it complains about missing deps, fix them with sudo apt -f install.

Manage the systemd service

The package installs raspi-bash-mcp.service and starts it on install. It is enabled by default, so it also starts at boot.

sudo systemctl status raspi-bash-mcp      # show current state
sudo systemctl start raspi-bash-mcp       # start
sudo systemctl stop raspi-bash-mcp        # stop
sudo systemctl restart raspi-bash-mcp     # restart (e.g. after editing the unit)
sudo systemctl disable raspi-bash-mcp     # do not start at boot
sudo systemctl enable raspi-bash-mcp      # start at boot
journalctl -u raspi-bash-mcp -f           # follow logs

Once running, clients connect to http://<pi-host>:8000/mcp. Verify with:

curl -i http://localhost:8000/mcp         # should return an HTTP response from the MCP server
ss -tlnp | grep 8000                      # confirm it is listening

Change host or port

Edit the ExecStart= line in /lib/systemd/system/raspi-bash-mcp.service (or create a drop-in at /etc/systemd/system/raspi-bash-mcp.service.d/override.conf), then:

sudo systemctl daemon-reload
sudo systemctl restart raspi-bash-mcp

Upgrade and uninstall

sudo apt install ./raspi-bash-mcp_<new-version>_all.deb   # upgrade in place
sudo apt remove raspi-bash-mcp                             # remove binaries + unit
sudo apt purge raspi-bash-mcp                              # also delete /opt/raspi-bash-mcp

Self-hosted apt repository

For installing on multiple machines (or just to get apt update / apt upgrade semantics), publish the .deb as a flat apt repository.

Build the repo

./scripts/build-deb.sh         # produces dist/raspi-bash-mcp_<ver>_all.deb
./scripts/build-apt-repo.sh    # produces dist/apt/{Packages,Packages.gz,Release,*.deb}

The output in dist/apt/ is a self-contained flat repo. Build host needs dpkg-dev and apt-utils.

Serve it

Any static HTTP server works. For a quick local test:

python3 -m http.server --directory dist/apt 8080

For production use, point nginx/Caddy/Apache at dist/apt/, or push the directory to GitHub Pages / S3 / any static host.

Install from the repo (client side)

echo 'deb [trusted=yes] https://slonnik.github.io/mcp/ ./' \
    | sudo tee /etc/apt/sources.list.d/raspi-bash-mcp.list
sudo apt update
sudo apt install raspi-bash-mcp

The trailing ./ is required — it tells apt this is a flat repo (no dists/ layout). [trusted=yes] skips GPG verification because the repo is unsigned; if you need signing, run gpg --clearsign Release after build-apt-repo.sh and distribute the public key to clients via /etc/apt/keyrings/.

Subsequent upgrades are then just:

sudo apt update && sudo apt upgrade raspi-bash-mcp

Automated publish via GitHub Pages

.github/workflows/publish-apt-repo.yml builds the .deb, builds the apt repo, and deploys dist/apt/ to GitHub Pages on every v* tag push (and on manual dispatch). After enabling Pages for the repo (Settings → Pages → "GitHub Actions" as the source), tagging v0.1.0 makes the repo available at https://<owner>.github.io/<repo>/ and clients install with:

echo 'deb [trusted=yes] https://<owner>.github.io/<repo>/ ./' \
    | sudo tee /etc/apt/sources.list.d/raspi-bash-mcp.list
sudo apt update && sudo apt install raspi-bash-mcp

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选