# pentest-ai — Offensive Security MCP for Claude Code > pentest-ai is a Python CLI and MCP server that lets Claude Code run verified probes, chain attack paths, and export reports for authorized testing. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use ```bash pip install ptai # (optional) interactive wizard for MCP client config ptai setup --mcp # register as an MCP server for Claude Code claude mcp add pentest-ai -- ptai mcp ``` ## Intro pentest-ai is a Python CLI and MCP server that lets Claude Code run verified probes, chain attack paths, and export reports for authorized testing. - **Best for:** Authorized pentests where you want a probe-by-probe MCP loop (not a black-box scanner) - **Works with:** Claude Code or any MCP client; `ptai` CLI for standalone/CI; common security tools auto-installed on first run (per README) - **Setup time:** 5–15 minutes ## Practical Notes - GitHub: 215 stars · 44 forks; pushed 2026-05-12 (verified via GitHub API). - README introduces iterative MCP tools `list_probes` / `run_probe` / `http_request` for scoped, step-by-step driving. - README claims 47 MCP tools and 200+ tool wrappers (nmap, nuclei, ffuf, sqlmap, gobuster, …) with auto-install on first run. ## Main A practical “agent-safe pentest” setup looks like this: 1. **Declare scope explicitly** (domains, auth method, rate limits) in the prompt you give Claude Code. 2. Use **iterative driving**: start with `list_probes`, run one probe at a time, and only escalate when evidence supports it. 3. Prefer **proof over guesses**: keep PoCs small, reproducible, and logged; treat every finding as “untrusted” until verified. 4. Keep a clean separation between: - *tool execution* (ptai running probes) - *reasoning + coordination* (your MCP client / assistant) 5. When you need CI-style runs, switch to the CLI path (`ptai start …`) and pin provider/model settings so results are comparable run-to-run. The big win is control: you get a repeatable probe library, plus an MCP interface that lets an LLM coordinate without inventing results. ### FAQ **Q: Is it for authorized testing only?** A: Yes. The README includes responsible-use warnings; only scan targets you own or have permission to test. **Q: Do I need an API key?** A: Not always. The README notes that when wired into Claude Code via MCP, your Claude subscription can run the engagement; otherwise you can run `ptai` with API keys (or via LiteLLM). **Q: What should I run first?** A: Start with low-risk recon-style probes, then iterate: run one probe, inspect evidence, and only then escalate to exploit attempts. ## Source & Thanks > Source: https://github.com/0xSteph/pentest-ai > License: MIT > GitHub stars: 215 · forks: 44 --- ## 快速使用 ```bash pip install ptai #(可选)交互式向导,自动写入 MCP 客户端配置 ptai setup --mcp # 注册为 Claude Code 的 MCP server claude mcp add pentest-ai -- ptai mcp ``` ## 简介 pentest-ai 是 Python CLI + MCP server,可让 Claude Code 调用 list_probes/run_probe/http_request 逐步驱动探测,输出可复现的 PoC 与报告(仅限授权测试)。 - **适合谁:** 想让 LLM“逐步驱动探测”的授权测试场景,而不是黑盒扫描器 - **可搭配:** Claude Code 或任意 MCP 客户端;也可用 `ptai` 单独跑 CI;常见安全工具首次运行会自动安装(见 README) - **准备时间:** 5–15 分钟 ## 实战建议 - GitHub:215 stars · 44 forks;最近更新 2026-05-12(GitHub API 验证)。 - README 强调可迭代驱动:`list_probes` / `run_probe` / `http_request` 让 MCP 以“逐步可审计”的方式执行。 - README 声称提供 47 个 MCP tools、200+ 安全工具封装(nmap/nuclei/ffuf/sqlmap/gobuster…),首次运行自动安装依赖。 ## 主要内容 一个更“agent 安全”的渗透工作流可以这样搭: 1. **先声明范围**(域名/接口、登录方式、速率限制)再开始执行。 2. 用 **迭代驱动**:先 `list_probes`,一次只跑一个 probe,有证据再升级动作。 3. 追求 **可复现 PoC**:每个结论都以最小可复现实验证据收尾,避免“猜测式”报告。 4. 把角色分清: - *ptai 负责执行*(跑 probes) - *MCP 客户端负责推理与编排*(Claude Code / Cursor 等) 5. 需要做 CI 或定时扫描时,走 CLI 路径(`ptai start …`),并固定 provider/model,保证不同批次结果可对比。 核心收益是“可控”:你得到可重复的 probe 库 + MCP 接口,让 LLM 做编排而不是编造。 ### FAQ **只能用于授权测试吗?** 答:是的。README 有 Responsible use 提示;只对自己拥有或明确授权的目标执行。 **一定要 API Key 吗?** 答:不一定。README 提到接入 Claude Code 的 MCP 后可用订阅执行;否则可按文档配置 API key(或走 LiteLLM)。 **第一步建议怎么跑?** 答:先从低风险的探测/信息收集开始,再按证据迭代:一次只跑一个 probe,确认结果后再升级动作。 ## 来源与感谢 > Source: https://github.com/0xSteph/pentest-ai > License: MIT > GitHub stars: 215 · forks: 44 --- Source: https://tokrepo.com/en/workflows/pentest-ai-offensive-security-mcp-for-claude-code Author: MCP Hub