Skip to main content
Glama
HackTricks MCP Server

HackTricks MCP Server

by Xplo8E

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

Related MCP server: Bug Bounty MCP Server

Quick Start

Installation

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):

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

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

Alternative: Install from Source

git clone https://github.com/Xplo8E/hacktricks-mcp-server.git
cd hacktricks-mcp-server
git submodule update --init --recursive
npm install
npm run build

Configuration for source install:

{
  "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:

find / -perm -4000 2>/dev/null
./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 lines
get_page(file1)               → 3000 tokens
get_page(file2)               → 2500 tokens  
Total: ~5500 tokens, 3 calls

After (efficient):

search_hacktricks("SUID", category="linux-hardening")  → Grouped results
get_outline(best_match)                                 → 20 lines
get_section(best_match, "SUID")                         → 200 tokens
Total: ~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:

bun run dev

Test locally:

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

Available Tools

7 tools
get_hacktricks_cheatsheetA

Extract ALL CODE BLOCKS from a page (commands, payloads, scripts, one-liners). Skips explanatory text. Perfect for: 'give me the exploit command', 'show me the payload', 'what's the syntax'. Returns code with language tags (bash, python, etc.).

Inputs: path (required).

get_hacktricks_outlineA

Get TABLE OF CONTENTS (all section headers) of a page. Returns ~20-50 lines showing page structure. Use this FIRST after search to: (1) verify page is relevant, (2) find exact section names for get_hacktricks_section. Cost: ~100 tokens vs 3000+ for full page.

Inputs: path (required).

get_hacktricks_pageA

Get FULL page content. ⚠️ EXPENSIVE: Pages average 3000-15000 tokens. PREFER: get_hacktricks_section for specific topics, get_hacktricks_cheatsheet for just commands. Only use this when you need the complete page or multiple sections.

Inputs: path (required).

get_hacktricks_sectionA

Extract ONE SECTION from a page. MOST EFFICIENT way to read content. Typical sections: 'Exploitation', 'Enumeration', 'Prevention', 'Example', 'Payload', 'PoC', 'Bypass'. Use get_hacktricks_outline first to see exact section names. Returns ~200-500 tokens vs 3000+ for full page.

Inputs: path (required), section (required).

hacktricks_quick_lookupA

⚡ ONE-SHOT exploitation lookup. Searches, finds best page, and returns exploitation sections + code blocks. Use for: 'how do I exploit X', 'give me X payload', 'X attack technique'. Handles aliases (sqli→SQL injection, xss→Cross-site scripting, rce, lfi, ssrf, etc.). Returns: page title, exploitation sections, and top 5 code blocks.

Inputs: topic (required), category.

list_hacktricks_categoriesA

Browse HackTricks structure. Without params: list all categories. With category: show all pages in that category. Use when: (1) unsure which category to search, (2) want to explore what's available, (3) need exact file paths.

Inputs: category.

search_hacktricksA

Search HackTricks for pentesting techniques, exploits, and security info. Returns results GROUPED BY FILE with: page title, match count, relevant sections, and top matches. WORKFLOW: search → get_hacktricks_outline (see structure) → get_hacktricks_section (read specific part). ALWAYS use category filter when possible - saves time and tokens.

Inputs: query (required), category, limit.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.5/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool serves a distinct purpose: extracting code blocks, outlines, sections, full pages, quick lookups, category browsing, and search. No overlap in functionality.

    Naming Consistency4/5

    Most tools follow a verb_noun pattern (e.g., get_hacktricks_section, search_hacktricks). The compound name hacktricks_quick_lookup deviates slightly but is still action-oriented and clear.

    Tool Count5/5

    Seven tools is well-scoped for a specialized reference server, covering all needed operations without being excessive or insufficient.

    Completeness5/5

    The tool set covers the full workflow: search, browse categories, get structure, get specific section, get code blocks, and full page retrieval. No obvious missing operations for a read-only reference.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides comprehensive access to documentation for 600+ Kali Linux penetration testing and security tools through Claude Desktop, enabling users to search, explore, and get detailed information about security tools by category or functionality.
      1
      -
    • A
      license
      A
      quality
      D
      maintenance
      Provides Claude Code with access to a comprehensive bug bounty knowledge base including techniques, payloads, wordlists, and real-world reports through 14 tools for searching, retrieving payloads, and assessing report quality.
      14
      21
      GPL 3.0
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI models to search and retrieve offline security knowledge from over 20 curated sources including HackTricks, PayloadsAllTheThings, and OWASP guides, via the Model Context Protocol.
      9
      206
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Wraps common web penetration testing tools in a Docker container and exposes them as Claude tools for educational use in controlled lab environments.
      -