Skip to main content
Glama

CapHost

让 AI 改你电脑上的项目时,走固定流程、改完还能验收——而不是东写西写、说完就算。

适合:用 Cursor、xCodex、DeepSeek Harness 等带 AI 的工具写代码的人。
不适合:想找「把 AI 关进虚拟机里」那种安全沙箱的人(我们不是那个,说明见 定位)。


它到底干什么?

平常 AI 可以直接改文件、跑命令,做完了也没人核对。

CapHost 多加三道规矩:

  1. 只能动你指定的文件夹(叫安全根)

  2. 改文件 / 跑命令要经过登记过的能力(不是聊天里随口一说)

  3. 做完跑一次验收(verify):过了才算完

你可以把它想成:给 AI 配的「工牌 + 打卡机」,不是给它建的监狱。


Related MCP server: MCP ToolHub

开始之前你要有

  • 电脑上已安装 Node.js 20 或更新

  • 包管理器用 pnpm(没有就:npm install -g pnpm)

  • 一个空文件夹当「安全根」,例如:C:\work\cap-safe(路径换成你的)


五步跑起来(复制即可)

把下面的 <本仓库路径> 和安全根路径换成你自己的。

① 下载并安装

git clone https://github.com/Sadako-Girlfriend/caphost.git
cd caphost
pnpm install
pnpm gen && pnpm check && pnpm test

可选自检(不依赖你的安全根):

pnpm demo

② 告诉 CapHost:只能动哪个文件夹

Windows(命令提示符):

set CAPHOST_SAFE_ROOTS=C:\work\cap-safe

也可以复制仓库里的 caphost.local.json.example,改名成 caphost.local.json,把里面的路径改成你的。

③ 接到你的 AI 工具(四选一)

你用的工具

怎么接

Cursor

复制 .cursor/mcp.json.example → 你的项目里的 .cursor/mcp.json,把路径填上,然后 Reload MCP

xCodex

按 examples/mcp/xcodex.config.toml.example 写进配置

DeepSeek Harness

按 examples/mcp/deepseek-harness.yaml.example 加一条

先不接 AI

只用命令行也行,见下一步

更细的说明:examples/mcp · MCP 说明

④ 给 AI 一份「规矩」(很重要)

打开 agent/INSTRUCTIONS.md,整份贴进你 AI 工具的系统提示 / Rules。
否则工具挂上了,AI 仍可能用手写文件绕开 CapHost。

Cursor 还可以把 agent/rules/、agent/skills/ 拷进自己的 .cursor/。

⑤ 建一个小项目并验收

pnpm scaffold -- --name hello-cap --template tool
pnpm verify -- --workspace C:\work\cap-safe\hello-cap

看到验收通过,就算通了。


常见问题(先看这)

Q:我要会写契约 / TypeScript 吗?
不用。先会「安装 → 配路径 → 接工具 → 贴规矩 → scaffold / verify」就够。

Q:安全根是什么?
就是你允许 AI 动的文件夹。没写进安全根的路径,CapHost 不会帮它改。

Q:PHP / Java / Go 行不行?
可以,但要按语言「打开开关」,见 工具链说明。别自己猜命令名。

Q:和 Docker / 云沙箱比呢?
不是一类东西。我们管的是「在你本机当前项目里怎么改、怎么验收」,不是把整个环境隔离起来。


还想看什么

想了解

打开

一步步完整版

上手指南

换一台电脑怎么配

换机检查单

多个 AI 窗口一起用

冷启动(一人一个文件夹)

我们是什么 / 不是什么

定位


许可证

MIT · 见 LICENSE

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      B
      maintenance
      Enables coding agents to perform workspace-confined file operations, read-only Git inspection, and structured shell commands, while requiring out-of-band human approval for mutations and external executions and maintaining an audit trail.
      14
      3
      -
    • A
      license
      A
      quality
      B
      maintenance
      Enables coding agents to safely inspect and modify project files within explicitly allowed workspace roots, with controls for file operations, git status/diff, and optionally allowlisted command execution.
      11
      Apache 2.0