HackTricks MCP Server

io.github.Xplo8E由 GitHub 账号 Xplo8E 发布v1.3.4更新于 Oct 24, 2026

Search and query HackTricks pentesting documentation with quick lookup and section extraction

已验证STDIO仅桌面知识与记忆安全与监控

概览

AI 生成的概览

本地 MCP 服务器,让助手搜索和阅读 HackTricks 渗透测试文档,支持快速查询、大纲、章节提取和速查表。

可以做什么
搜索 HackTricks 文档,结果按文件分组,可按类别过滤并使用正则查询;也可按主题或 sqli、xss、suid 等别名做一次性漏洞利用查询。浏览类别和文件路径以发现可用主题。获取页面大纲、按标题提取单个章节,或只提取页面中的代码块作为速查表。需要时可读取整页内容,但 README 建议用大纲加章节提取以节省 token。
适用场景
适合让助手直接基于 HackTricks 知识库回答渗透测试技术、载荷或提权命令相关问题,无需离开对话。适用于安全学习、CTF 类研究和命令速查。
运行要求
以 npm 包(hacktricks-mcp-server)形式通过 stdio 在本地运行,需要 Node.js v18 或更高版本,README 还要求 ripgrep 和 Bun。postinstall 脚本会克隆 HackTricks 仓库,首次安装约需两分钟并需要网络访问。未声明账号、API 密钥或环境变量。
安装前请注意
postinstall 脚本会在安装时自动克隆第三方仓库,请先了解其拉取的内容。内容属于攻击性安全资料:返回的命令和载荷仅限授权测试使用,对未获授权或不属于自己的系统执行可能违法。该服务器只读取本地文档,不会执行返回的命令。

安装

在 SourceWeft 中

  1. 打开 控制台中的 HackTricks MCP Server,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

HackTricks MCP Server

MCP (Model Context Protocol) server for searching and querying HackTricks pentesting documentation directly from Claude.

Features

  • Quick lookup - One-shot exploitation info with alias support (sqli, xss, ssrf, etc.)
  • Grouped search results - Results aggregated by file with match count, title, and relevant sections
  • Page outline - Quick table of contents to identify relevant sections
  • Section extraction - Read specific sections instead of full pages (token-efficient)
  • Cheatsheet mode - Extract only code blocks/commands from pages
  • Category browsing - Discover available topics and file paths
  • Fast grep search - Uses ripgrep for instant results
  • Security hardened - Protection against command injection and path traversal

Quick Start

Installation

bash
npm install -g hacktricks-mcp-server

The postinstall script automatically clones the HackTricks repository (~2 minutes on first install).

Configure Claude Desktop

Add to your Claude settings (~/.claude/settings.json):

json
{  "mcpServers": {    "hacktricks": {      "command": "npx",      "args": ["hacktricks-mcp-server"]    }  }}

Restart Claude Desktop and try: "Search HackTricks for SQL injection"

Alternative: Install from Source

bash
git clone https://github.com/Xplo8E/hacktricks-mcp-server.gitcd hacktricks-mcp-servergit submodule update --init --recursivenpm installnpm run build

Configuration for source install:

json
{  "mcpServers": {    "hacktricks": {      "command": "node",      "args": ["/absolute/path/to/hacktricks-mcp-server/dist/index.js"]    }  }}

Usage Examples

Once configured in Claude Desktop, you can ask:

  • "Search HackTricks for SQL injection techniques"
  • "Give me SUID privilege escalation commands"
  • "Show me XSS payloads"
  • "List all pentesting categories in HackTricks"
  • "How do I exploit XXE vulnerabilities?"

The server provides 7 specialized tools for efficient HackTricks searching.

Available Tools

hacktricks_quick_lookup

⚡ One-shot exploitation lookup. Searches, finds best page, and returns exploitation sections + code blocks in one call.

Parameters:

  • topic (string, required): Attack/technique to look up (e.g., 'SUID', 'sqli', 'xss', 'docker escape')
  • category (string, optional): Category filter for faster results

Supported aliases: sqli, xss, rce, lfi, rfi, ssrf, csrf, xxe, ssti, idor, jwt, suid, privesc

Example:

hacktricks_quick_lookup("SSRF", category="pentesting-web")

Benefits: Reduces 3+ tool calls to 1 for "how do I exploit X" questions.


search_hacktricks

Search through HackTricks documentation. Returns results GROUPED BY FILE with match count, page title, and relevant section headers.

Parameters:

  • query (string, required): Search term or regex pattern
  • category (string, optional): Filter to specific category (e.g., 'pentesting-web')
  • limit (number, optional): Max grouped results (default: 20)

Example output:

Found matches in 5 files for: "SUID"
────────────────────────────────────────────────────────────
📄 **Linux Privilege Escalation**   Path: src/linux-hardening/privilege-escalation/README.md   Matches: 12   Sections: SUID Binaries | Finding SUID | GTFOBins   Preview:     L45: Find files with SUID bit set...     L78: Common SUID exploitation techniques...
────────────────────────────────────────────────────────────

get_hacktricks_outline

Get the table of contents of a page (all section headers). Use this BEFORE reading full pages to understand structure.

Parameters:

  • path (string): Relative path to markdown file

Example output:

# Linux Privilege Escalation  ## Enumeration    ### System Information    ### Network  ## SUID Binaries    ### Finding SUID Files    ### Exploiting SUID  ## Capabilities

Benefits: See page structure in ~20 lines vs reading 500+ lines.


get_hacktricks_section

Extract a specific section from a page by header name. Much more efficient than reading the full page.

Parameters:

  • path (string): Relative path to markdown file
  • section (string): Section header to extract (partial match, case-insensitive)

Example:

get_hacktricks_section("src/linux-hardening/privilege-escalation/README.md", "SUID")

Benefits: Read just "SUID Binaries" section (~200 tokens) instead of entire page (~3000 tokens).


get_hacktricks_cheatsheet

Extract only code blocks from a page. Perfect when you just need commands, payloads, or examples.

Parameters:

  • path (string): Relative path to markdown file

Example output:

bash
find / -perm -4000 2>/dev/null
bash
./vulnerable_suid -p

Benefits: Skip explanatory text when you just need "give me the command".


get_hacktricks_page

Get full content of a HackTricks page.

Parameters:

  • path (string): Relative path to markdown file

Warning: Pages can be very long (3000+ tokens). Consider using get_hacktricks_outline + get_hacktricks_section instead.


list_hacktricks_categories

List categories and their contents.

Parameters:

  • category (string, optional): Category to expand

Without category: Lists top-level categories With category: Shows full directory tree with file paths

Efficient Usage Pattern

For optimal token usage, Claude should:

  1. Search with category filter → Get grouped results with context
  2. Get outline of relevant page → See structure before reading
  3. Extract specific section → Read only what's needed
  4. Get cheatsheet → Quick command reference

Before (inefficient):

search_hacktricks("SUID")     → 50 raw linesget_page(file1)               → 3000 tokensget_page(file2)               → 2500 tokens  Total: ~5500 tokens, 3 calls

After (efficient):

search_hacktricks("SUID", category="linux-hardening")  → Grouped resultsget_outline(best_match)                                 → 20 linesget_section(best_match, "SUID")                         → 200 tokensTotal: ~400 tokens, 3 calls

Requirements

  • Node.js (v18 or higher)
  • ripgrep (rg) - usually pre-installed on macOS/Linux
  • Bun (for package management)

Development

Watch mode:

bash
bun run dev

Test locally:

bash
bun run start

Contributing

Contributions are welcome! If you'd like to improve the server:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/improvement)
  3. Make your changes and test locally
  4. Submit a pull request

Please ensure your PR includes tests for new features and maintains the existing code style.

License

MIT

Credits

来源:README.md,提交 931b474

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.3.4最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分