machine-root-mcp
A self-hosted MCP server that gives AI coding assistants direct shell access to your local machine, enabling execution of arbitrary bash commands for development workflows.
README
machine-root-mcp
⚠ Personal use only. Do not deploy to a real server. See Security.
A self-hosted MCP (Model Context Protocol) server that gives AI coding assistants — Claude, Codex, or any MCP-compatible client — direct shell access to your local machine. One tool. Full access. No restrictions.
Built for personal local development workflows where you want AI to actually do things: run builds, read/write files, execute git commands, run tests, install packages, grep codebases — anything you'd type in a terminal.
What it is
An HTTP server implementing the Model Context Protocol spec with a single tool: run_command. When an AI client connects, it can call that tool with any bash command and get back stdout/stderr. That's it. No wrappers, no abstractions over the shell — just raw access.
The server handles full OAuth 2.0 Authorization Code + PKCE so any standard MCP client can connect using the discovery flow (/.well-known/oauth-authorization-server). OAuth state — registered clients, access tokens, refresh tokens — is persisted in a local SQLite database so registered clients survive server restarts without re-authenticating.
What it does
- Exposes a single MCP tool:
run_command(command, cwd, timeout) - Implements a complete self-contained OAuth 2.0 authorization server (no external IdP)
- Supports dynamic client registration — AI clients register themselves automatically
- Serves a browser consent page when a client requests authorization
- Persists all OAuth state to SQLite (WAL mode) across restarts
- Logs every HTTP request, OAuth event, and tool call via structured pino logs
- Shuts down gracefully on SIGTERM/SIGINT (drains connections, closes DB)
What it will be used for
Running AI coding assistants against local projects as if they had a terminal open on your machine:
- Navigate and explore codebases (
find,rg,cat,tree) - Read, write, and edit source files
- Run builds, tests, and linters (
pnpm build,vitest,eslint) - Execute git operations (
git log,git diff,git commit) - Install dependencies, restart dev servers, tail logs
- Anything else you'd do in a terminal — because it literally is a terminal
The intent is to connect this to Claude or Codex as a persistent MCP server and let the AI operate on your local workspace without constant copy-pasting.
Stack
| Layer | Technology |
|---|---|
| Runtime | Node.js 24 |
| Language | TypeScript (ESM, strict) |
| HTTP server | Express 5 |
| MCP protocol | @modelcontextprotocol/sdk |
| OAuth 2.0 | Built-in (Authorization Code + PKCE) |
| Persistence | SQLite via better-sqlite3 (WAL) |
| Logging | pino + pino-pretty |
| Package manager | pnpm |
Quick start
git clone https://github.com/yugalkishor/machine-root-mcp
cd machine-root-mcp
pnpm install
# Build better-sqlite3 native binary (required once)
cd node_modules/better-sqlite3 && node_modules/.bin/prebuild-install && cd ../..
cp .env.example .env # edit if needed
pnpm build
pnpm start
Server starts at http://localhost:3100.
Exposing publicly
To connect from a remote MCP client you need a public HTTPS URL. Deploy this on any server you have access to — a VPS (DigitalOcean, Hetzner, Linode), a home server with a static IP, or any machine you can put behind a reverse proxy (nginx, Caddy). Set BASE_URL in .env to your public HTTPS URL before building.
BASE_URL=https://your-server.com pnpm build && pnpm start
MCP endpoint: https://your-server.com/mcp
Environment variables
| Variable | Default | Description |
|---|---|---|
PORT |
3100 |
HTTP listen port |
BASE_URL |
http://localhost:3100 |
Public base URL (set to your public server URL) |
MCP_DB_PATH |
./data/local-mcp.db |
SQLite database path |
LOG_LEVEL |
info |
trace / debug / info / warn / error / fatal |
NODE_ENV |
development |
development = pretty logs, production = JSON logs |
Security
This project is intentionally insecure. It is designed for local personal use only.
run_commandexecutes arbitrary shell commands with no blocklist, no sandboxing, and no path restrictions- The OAuth server issues tokens to anyone who completes the consent flow
- SQLite tokens are stored unencrypted on disk
- There is no rate limiting, no audit log, no scope enforcement beyond the single
mcpscope
Do not run this on a public server, a shared machine, or expose it without a tunnel you control. Whoever holds a valid access token has full shell access to your machine as your user.
License
Personal use. Not intended for distribution.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。