Compile an Agent project's MCP configs, tool snapshots, skills, scripts, and permissions into a capability graph and a least-privilege policy.
git clone https://github.com/ShunjunGu/agentsurface.git
cd agentsurface
moon build --target native
# 扫描项目,默认发现 high/critical 时退出码为 1
./_build/native/debug/build/cmd/main/main.exe scan fixtures/risky-agent
# 输出能力图谱
./_build/native/debug/build/cmd/main/main.exe graph fixtures/risky-agent
# 生成 Claude 风格的权限设置
./_build/native/debug/build/cmd/main/main.exe policy fixtures/risky-agent --format claude
# 列出规则
./_build/native/debug/build/cmd/main/main.exe rules| 命令 | 说明 |
|---|---|
| scan <dir> [--format text\|json\|sarif\|md] [--out <file>] [--fail-on critical\|high\|medium\|low\|none] [--tools <file>]... | 扫描并输出报告 |
| graph <dir> [--format mermaid\|json] [--out <file>] | 只输出能力图谱 |
| policy <dir> [--format json\|claude] [--out <file>] | 只输出最小权限策略 |
| rules | 列出规则 ID、级别与名称 |
| version | 版本 |
| 类型 | 文件 | 说明 |
|---|---|---|
| MCP 配置 | mcp.json / .mcp.json / claude_desktop_config.json | 读取启动命令、参数、env 键名、远程 URL;不读取 env 值 |
| 工具快照 | tools.json / tools-list.json / *.tools.json | 接受裸 {"tools":[...]} 与 JSON-RPC {"result":{"tools":[...]}} |
| 技能包 | SKILL.md | 解析 frontmatter 与正文;支持 allowed-tools |
| 宿主权限 | .claude/settings.json / .codex/settings.json | 只读 permissions.allow / permissions.deny |
| 技能脚本 | SKILL.md 同目录下的 .sh/.ps1/.py/.js/.ts | 只提取关键词信号,不做语法分析 |
| ID | 级别 | 条件 |
|---|---|---|
| AS001 | Critical | 同一组件同时具备 secrets.read 与 net.egress |
| AS002 | High | 同一组件同时具备 fs.read 与 shell.exec |
| AS003 | High | 权限设置 allow 包含 * / all |
| AS004 | Medium | 远程端点为明文 http:// |
| AS005 | High | 脚本包含破坏性命令(rm -rf、chmod 777、写系统路径) |
| AS006 | Medium | 同一组件同时具备 secrets.read 与 model.call |
| AS007 | Medium | 同一组件同时具备 fs.write 与 net.egress |
| AS008 | Medium | 存在 shell.exec / secrets.read,但没有对应 deny |
| AS009 | Medium | 同一组件同时具备 browser.control 与 secrets.read |
| AS010 | Low | 同一组件同时具备 clipboard 与 net.egress |
| AS011 | Low | 工具无可判定能力信号 |
| AS012 | Medium | 同一组件同时具备 process.spawn 与 secrets.read |
| 能力 | 默认决策 |
|---|---|
| fs.read、model.call | allow |
| fs.write、net.egress、shell.exec、db.query、browser.control、process.spawn | ask |
| secrets.read | ask;若存在 AS001 则 deny |
| clipboard | deny |
| unknown:* | ask,需人工审阅 |
| 项目 | 它做什么 | agentsurface 的差异 |
|---|---|---|
| mcpscan | 单个 tools/list 快照的投毒/隐藏能力检测 | 本项目是项目级、多产物;可把工具快照作为输入之一 |
| moongate | 运行时 MCP 策略执行、密钥替身、审批 | 本项目在部署前做静态能力盘点与策略生成,不代理流量 |
| moonskill | SKILL.md 格式校验 | 本项目看技能声明的能力、正文信号与脚本,输出策略 |
| configscope | 配置契约兼容性 | 本项目分析能力与风险,不做兼容性判定 |
| moonjail / moonpermit / promptgate | 运行时沙箱、最小权限执行、工具调用拦截 | 本项目不执行、不拦截;只做部署前的静态盘点与策略文件 |
| permscope | 浏览器 Permissions-Policy 审计 | 本项目审计 Agent 项目产物,不是 Web 响应头 |
| runledger | Agent 日志离线审计 | 本项目分析部署前配置与代码,不分析事后日志 |
moon check --deny-warn
moon test
moon fmt
moon infoInstall
Download zipCompile an Agent project's MCP configs, tool snapshots, skills, scripts, and permissions into a capability graph and a least-privilege policy.