ryanInf/http_mcp
基于 FastMCP 的安全 HTTP 请求工具,支持原始报文发送、安全控制、HTTP 代理与文件上传。A secure MCP tool for sending raw HTTP/1.1 requests with built-in security controls and proxy support.
Platform-specific configuration:
{
"mcpServers": {
"http_mcp": {
"command": "npx",
"args": [
"-y",
"http_mcp"
]
}
}
}Add the config above to .claude/settings.json under the mcpServers key.
发送 HTTP/1.1 请求的 MCP 工具,带有安全控制。
基于 FastMCP 构建。
适用于Web渗透测试、调试。
发送原始 HTTP 请求报文。
参数:
| 参数 | 类型 | 默认值 | 说明 | |------|------|--------|------| | content | string | 必需 | 原始 HTTP 请求报文| | baseurl | string | 必需 | 完整 URL,如 https://example.com | | timeout | number | 30 | 超时时间(秒) | | strip_html | boolean | true | 去除响应中的 HTML 标签 | | allow_custom_host | boolean | false | 允许自定义 Host 头 | | allow_custom_content_length | boolean | false | 允许自定义 Content-Length |
原始请求报文格式:
POST /api/users HTTP/1.1
Host: example.com
Content-Type: application/json
User-Agent: Mozilla/5.0
{"name": "test", "value": 123}使用示例:
# 1. 简单请求
http_send_request(
content="GET / HTTP/1.1\r\nHost: example.com\r\n\r\n",
baseurl="https://example.com"
)
# 2. 指定目标服务器
http_send_request(
content="GET /api HTTP/1.1\r\nHost: example.com\r\n\r\n",
baseurl="https://api.server.com"
)
# 3. 自定义 Host 头(用于测试 CDN 或虚拟主机)
http_send_request(
content="GET / HTTP/1.1\r\nHost: custom-host.com\r\n\r\n",
baseurl="https://example.com",
allow_custom_host=True
)
# 4. 保留 HTML 标签
http_send_request(
content="GET /page HTTP/1.1\r\nHost: example.com\r\n\r\n",
baseurl="https://example.com",
strip_html=False
)
**注意:** 当使用 `allow_custom_host=True` 时:
- `baseurl` 指定实际连接的服务器
- HTTP 请求头中的 `Host` 使用原始请求中的值
- 如果目标服务器不认识自定义的 Host 头,会返回错误
### http_build_request
从方法、URL、头部和请求体构建原始 HTTP 请求报文。
**参数:**
- `method` (必需): HTTP 方法
- `url` (必需): 完整 URL
- `headers`: 请求头对象
- `body`: 请求体
## 安全提示
⚠️ **默认配置风险说明**:
- `allow_private_ips: true`:默认允许访问内网IP地址,在不可信环境中使用存在SSRF攻击风险,生产环境建议设置为`false`
- `verify_ssl: false`:默认不验证SSL证书,存在中间人攻击风险,生产环境建议设置为`true`
- `follow_redirects: false`:默认不自动跟随重定向,Loading reviews...