httpx MCP Server
MCP Server tích hợp công cụ httpx từ ProjectDiscovery để thực hiện reconnaissance và probing HTTP/HTTPS targets thông qua Model Context Protocol.
📋 Mô tả
Server này cung cấp một tool httpx_probe cho phép bạn sử dụng httpx để:
- Quét và kiểm tra các URL/IP targets
- Phát hiện công nghệ (CMS, Server, Framework)
- Kiểm tra hỗ trợ HTTP/2, WebSocket, VHOST
- Thu thập thông tin về status code, title, web server, IP, port
- Tùy chỉnh các port cần scan
✨ Tính năng
- ✅ Tech Detection: Phát hiện công nghệ sử dụng (
-tech-detect) - ✅ HTTP/2 Support: Kiểm tra hỗ trợ HTTP/2 (
-http2) - ✅ WebSocket Detection: Kiểm tra hỗ trợ WebSocket (
-websocket) - ✅ VHOST Detection: Kiểm tra VHOST (
-vhost) - ✅ Follow Redirects: Tự động đi theo redirects (
-follow-redirects) - ✅ Custom Ports: Quét các port tùy chỉnh
- ✅ JSON Output: Kết quả trả về dạng JSON dễ xử lý
- ✅ Timeout Protection: Bảo vệ khỏi các scan quá lâu (5 phút)
🔧 Yêu cầu
- Python 3.8+
- httpx từ ProjectDiscovery đã được cài đặt và có trong PATH
Cài đặt httpx
Linux/macOS:
go install -v github.com/projectdiscovery/httpx/cmd/httpx@latestWindows:
go install -v github.com/projectdiscovery/httpx/cmd/httpx@latestHoặc tải binary từ releases.
📦 Cài đặt
- Clone repository:
git clone
cd httpx-server- Cài đặt dependencies:
pip install fastmcp🔌 Cấu hình MCP Server cho Cursor và Claude Desktop
Cấu hình cho Cursor
- Mở Cursor Settings (Ctrl+, hoặc Cmd+,)
- Tìm đến phần MCP Servers hoặc mở file cấu hình MCP
- Thêm cấu hình sau vào file
mcp.json(thường nằm tại~/.cursor/mcp.jsonhoặc trong workspace settings):
{
"mcpServers": {
"httpx": {
"command": "python",
"args": ["server.py"],
"cwd": "${workspaceFolder}/httpx-server"
}
}
}Lưu ý:
cwdsử dụng biến${workspaceFolder}để trỏ đến thư mục project trong workspace- Nếu project nằm trong subfolder, điều chỉnh đường dẫn tương ứng:
"${workspaceFolder}/path/to/httpx-server" - Đảm bảo Python đã có trong PATH hoặc sử dụng đường dẫn đầy đủ đến Python interpreter
Cấu hình cho Claude Desktop
- Mở file cấu hình Claude Desktop:
- Windows: %APPDATA%\Claude\claude_desktop_config.json - macOS: ~/Library/Application Support/Claude/claude_desktop_config.json - Linux: ~/.config/Claude/claude_desktop_config.json
- Thêm cấu hình sau vào
mcpServers:
{
"mcpServers": {
"httpx": {
"command": "python",
"args": ["server.py"],
"cwd": "~/path/to/httpx-server"
}
}
}Lưu ý:
- Thay
~/path/to/httpx-serverbằng đường dẫn tương đối từ home directory của bạn - Hoặc sử dụng biến môi trường như
$HOME/path/to/httpx-server - Đảm bảo đường dẫn đến
server.pylà chính xác
Cấu hình với Virtual Environment (Khuyến nghị)
Nếu bạn sử dụng virtual environment, cấu hình như sau:
Cursor:
{
"mcpServers": {
"httpx": {
"command": "${workspaceFolder}/httpx-server/venv/bin/python",
"args": ["server.py"],
"cwd": "${workspaceFolder}/httpx-server"
}
}
}Claude Desktop:
{
"mcpServers": {
"httpx": {
"command": "~/path/to/httpx-server/venv/bin/python",
"args": ["server.py"],
"cwd": "~/path/to/httpx-server"
}
}
}Kiểm tra cấu hình
Sau khi cấu hình:
- Khởi động lại Cursor/Claude Desktop
- Trong chat, bạn sẽ thấy tool
httpx_probecó sẵn - Thử gọi tool để kiểm tra:
Sử dụng httpx_probe để scan example.comTroubleshooting
- Lỗi "command not found": Đảm bảo Python đã có trong PATH hoặc sử dụng đường dẫn đầy đủ
- Lỗi "No module named 'fastmcp'": Cài đặt dependencies trong virtual environment hoặc global Python
- Lỗi "httpx not found": Kiểm tra httpx đã được cài đặt và có trong PATH (xem phần Xử lý lỗi)
⚙️ Cấu hình
Nếu httpx không có trong PATH (đặc biệt trên Windows), bạn có thể hardcode đường dẫn trong server.py:
# Thay đổi dòng 12 trong server.py
HTTPX_PATH = r"C:\Users\YourUser\go\bin\httpx.exe" # Windows
# hoặc
HTTPX_PATH = "/usr/local/bin/httpx" # Linux/macOS🚀 Sử dụng
Chạy MCP Server
python server.pyTool: httpx_probe
Tham số
targets(List[str], bắt buộc): Danh sách URL/IP cần scan
- Ví dụ: ["google.com", "192.168.1.1", "https://example.com"]
ports(str, tùy chọn): Các port cần scan, phân cách bằng dấu phẩy
- Ví dụ: "80,443,8080,8443"
tech_detect(bool, mặc định:True): Bật phát hiện công nghệ (-tech-detect)
follow_redirects(bool, mặc định:True): Tự động đi theo redirects (-follow-redirects)
websocket(bool, mặc định:True): Kiểm tra hỗ trợ WebSocket (-websocket)
vhost(bool, mặc định:True): Kiểm tra VHOST (-vhost)
http2(bool, mặc định:True): Kiểm tra hỗ trợ HTTP/2 (-http2)
no_fallback(bool, mặc định:False): Không fallback sang HTTP nếu HTTPS lỗi (-no-fallback)
Kết quả trả về
Kết quả là một JSON array chứa các object với các trường:
url: URL đầy đủip: IP address của targetport: Port được phát hiệnstatus_code: HTTP status codetitle: Tiêu đề trang webwebserver: Web server (Apache, Nginx, etc.)tech: Mảng các công nghệ được phát hiện (nếu có)http2: Có hỗ trợ HTTP/2 hay khôngwebsocket: Có hỗ trợ WebSocket hay khôngvhost: Thông tin VHOST (nếu có)
📝 Ví dụ
Ví dụ 1: Scan đơn giản một domain
httpx_probe(
targets=["example.com"],
tech_detect=True,
follow_redirects=True
)Ví dụ 2: Scan nhiều targets với port tùy chỉnh
httpx_probe(
targets=["192.168.1.1", "192.168.1.100", "internal.company.com"],
ports="80,443,8080,8443",
tech_detect=True,
http2=True
)Ví dụ 3: Scan với tất cả tính năng
httpx_probe(
targets=["target.com", "subdomain.target.com"],
ports="80,443,8000,8080,8443",
tech_detect=True,
follow_redirects=True,
websocket=True,
vhost=True,
http2=True,
no_fallback=False
)Ví dụ 4: Scan nhanh không tech detection
httpx_probe(
targets=["quick-scan.com"],
tech_detect=False,
websocket=False,
vhost=False,
http2=False
)🔍 Output mẫu
[
{
"url": "https://example.com:443",
"ip": "93.184.216.34",
"port": 443,
"status_code": 200,
"title": "Example Domain",
"webserver": "nginx",
"http2": true,
"tech": ["nginx", "PHP"]
}
]⚠️ Lưu ý
- Timeout mặc định là 5 phút cho mỗi lần scan
- Kết quả được trả về dạng JSON, dễ dàng xử lý và tích hợp
- Các trường
Nonehoặc rỗng sẽ được loại bỏ khỏi output để tiết kiệm context - Đảm bảo httpx đã được cài đặt và có trong PATH trước khi sử dụng
🐛 Xử lý lỗi
Nếu gặp lỗi "Không tìm thấy lệnh 'httpx'":
- Kiểm tra httpx đã được cài đặt:
httpx -version - Kiểm tra PATH:
which httpx(Linux/macOS) hoặcwhere httpx(Windows) - Hardcode đường dẫn trong
server.pynếu cần
📚 Tài liệu tham khảo
📄 License
MIT License
