🦞 Claw
Your agent's claw on every machine.
Give any AI agent bash, read, write, edit, grep, and glob
on any machine you can SSH into.
Quickstart · How it works · Tools · Configuration · CLI
______________________________________________________________________
AI代理可以编写代码,但它们被困在一台机器上。他们无法检查prod上的日志,无法跨服务检查grep上的错误,也无法在staging上编辑配置。
爪子是一种 MCP服务器 它将代理的工具扩展到任何远程计算机。 8个工具。任何可以通过SSH连接到的主机。远程配置为零。
You: "Check why the API is returning 500s on prod, look at the logs, and fix the nginx config"
Agent: connects to prod-api via SSH
greps /var/log/nginx/error.log for errors
reads the nginx config
edits the misconfigured upstream block
runs nginx -t && systemctl reload nginx
Done. Across machines. Autonomously.没有要打开的端口。没有守护进程。不需要root。 Claw使用您的SSH密钥,在第一次连接时部署一个微小的二进制文件,并在自己之后进行清理。
快速入门
1.安装
npx -y @opsyhq/claw serve
# or install globally
npm install -g @opsyhq/claw2.联系您的代理
Claude Code
claude mcp add claw -- npx -y @opsyhq/claw serve或者运行安装程序:
npx -y @opsyhq/claw install claude-codeCursor
添加 .cursor/mcp.json:
{
"mcpServers": {
"claw": {
"command": "npx",
"args": ["-y", "@opsyhq/claw", "serve"]
}
}
}Claude Desktop
添加 claude_desktop_config.json:
{
"mcpServers": {
"claw": {
"command": "npx",
"args": ["-y", "@opsyhq/claw", "serve"]
}
}
}Any MCP client
npx -y @opsyhq/claw serve
# Speaks MCP over stdio3.添加您的机器
代理可以通过以下方式自行添加机器 claw_machines 工具,或者您可以提前设置它们:
# Import from your SSH config
claw init --from-ssh
# Or add manually
claw add prod-api --ssh deploy@prod-api.example.com
claw add staging --ssh deploy@staging.example.com4.去吧
和你的经纪人谈谈。现在,您配置的每台机器上都有爪子。
"Show me running containers on prod-api"
"Grep for 'connection refused' in the logs on staging"
"Find all .env files across prod-api and staging"
"Edit the upstream block in nginx.conf on prod-api"运作原理
┌─────────────────────────────────────┐
│ AI Agent (Claude, Cursor, etc.) │
│ ↓ MCP tool calls │
├─────────────────────────────────────┤
│ Claw (runs locally) │
│ │
│ ┌─────────────┐ ┌───────────────┐ │
│ │ Tool Router │ │ Conn Pool │ │
│ └──────┬──────┘ └──────┬────────┘ │
│ └───────┬───────┘ │
│ ┌──────┴───────┐ │
│ │ SSH │ Local │ │
│ └──┬───┘───┬───┘ │
└─────────────┼───────┼──────────────┘
▼ ▼
┌──────┐ ┌──────┐
│ prod │ │ your │
│ api │ │ mac │
└──────┘ └──────┘首次连接时,Claw会自动部署一个小型静态二进制文件(钳子)to ~/.claw/pincer 在远程主机上。Pincer通过stdin/stdout使用JSON-RPC,并处理所有工具执行——结构化文件编辑、安全命令处理、支持正则表达式的grep。
连接是持久的和池化的。不按命令重新连接。
工具
爪露出8个MCP工具。这些工具与代理从本地开发中已经知道的工具(Claude Code的读/写/编辑/Bash/Grep/Glob/LS)相匹配,刚刚扩展到远程机器。
| 工具 | 说明 |
|---|---|
| 抓斗机 | 列出、添加、删除和更新计算机 |
| 爪鱼 | 运行shell命令 |
| clav_read | 读取具有可选行范围的文件 |
| 爪石 | 创建或覆盖文件 |
| clav_编辑 | 在文件中查找和替换 |
| clav_grep | 使用正则表达式搜索文件内容 |
| clav_glob | 按模式查找文件 |
| 爪\_ ls | 列出目录内容 |
每个工具都需要一个 host 参数——目标机器名。
claw_bash(host: "prod-api", command: "docker ps")
claw_grep(host: "prod-api", pattern: "error|timeout", path: "/var/log", include: "*.log")
claw_edit(host: "staging", path: "/app/config.yaml", old_string: "port: 80", new_string: "port: 8080")配置
全局配置-- ~/.config/claw/machines.yaml
machines:
prod-api:
transport: ssh
host: prod-api.example.com
user: deploy
staging:
transport: ssh
host: staging.example.com
user: deploy
local:
transport: localSSH传输使用您现有的 ~/.ssh/config 自动——密钥、端口、跳转主机都能正常工作。
项目配置-- claw.yaml
放下一个 claw.yaml 在项目根目录中:
machines:
dev:
transport: local
staging:
transport: ssh
host: staging.myapp.com
user: deploy将此提交到您的repo。您的整个团队都使用相同的机器设置,每个人都使用自己的SSH密钥。
安全
- 您现有的访问权限 --Claw使用您的SSH密钥。它只能到达你已经能到达的地方。
- 无开放端口 --所有连接都是从您的计算机发出的SSH。
- 没有毅力 --远程二进制文件仅在会话期间运行。
- 审计日志 --每次工具调用都会记录到
~/.config/claw/logs/. - 想要护栏吗? --有关远程操作的审批工作流和策略执行,请查看 选项.
CLI参考
claw serve # Start MCP server (stdio)
claw init --from-ssh # Import machines from ~/.ssh/config
claw add --ssh user@host # Add a remote machine
claw add --local # Add local machine
claw install claude-code # Write MCP config for Claude Code
claw install cursor # Write MCP config for Cursor路线图
- \[x\] SSH传输
- \[x\] 当地交通
- \[x\] 从GitHub发布版下载运行时二进制文件
- \[x\] npm可信发布(OIDC)
- \[\]Docker传输
- \[\]Kubernetes传输
- \[\]AWS SSM传输
贡献
PR欢迎。请参阅 开发指南 开始吧。
Development
npm install # Install dependencies
npm run build # Build TypeScript
npm run typecheck # Type-check without emitting
npm run build-pincer # Cross-compile pincer (requires Go)
npm run dev # Watch mode项目结构:
claw/
├── bin/claw.ts # CLI entrypoint
├── src/
│ ├── cli/ # CLI commands (serve, init, add, install)
│ ├── config/ # YAML config loading + SSH config parser
│ ├── server/ # MCP server, tool schemas, router
│ ├── tools/ # Local tool implementations
│ ├── transports/ # Transport layer (local, SSH, pool, deployer)
│ └── logging/ # Audit log
├── pincer/ # Go binary deployed to remote hosts
│ ├── main.go # JSON-RPC stdin/stdout server
│ ├── rpc/ # Request dispatcher
│ └── tools/ # Tool implementations in Go
└── scripts/build-pincer.sh # Cross-compile for linux/amd64+arm64______________________________________________________________________
Built by OpsyHQ · MIT License
Claw icon by Lorc / Game Icons (CC BY 3.0)
