HTTPS安全请求工具

一个为Claude Code提供安全HTTPS请求功能的MCP服务器,支持自定义TLS配置和多种安全特性。

  • by cyphers-ai
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 cyphers-ai/claude-https-mcp

使用说明

Claude HTTPS MCP工具

MCP(模型上下文协议)服务器,为Claude Code提供安全的HTTPS获取工具,并从JSON配置文件加载自定义TLS配置。

特性

免费功能

  • TLS版本控制:配置最低和最高TLS版本(TLS 1.2、TLS 1.3)
  • 密码套件配置文件:现代、中级、兼容或自定义密码套件
  • CA证书模式:捆绑的Mozilla CA捆绑包、操作系统信任存储或自定义CA路径
  • 代理支持:具有基本身份验证的HTTP代理
  • 可配置超时:请求超时配置

专业功能(需要许可证)

  • 双向TLS:使用客户端证书对API进行身份验证
  • 证书固定:按叶、中间、根证书或SPKI哈希进行Pin
  • FIPS合规性:政府、医疗保健和金融部门需要FIPS 140-3验证的加密技术
  • 证书吊销:基本吊销检查(OCSP+CRL)是免费的

安装

先决条件

  • Node.js 18或更高版本 --检查一下 node --version
  • 克劳德代码 (CLI)-已安装并经过身份验证

步骤1:安装软件包

npm install -g claude-https-mcp

步骤2:使用Claude Code注册MCP服务器

claude mcp add --scope user --transport stdio cyphers-ai -- claude-https-mcp

关于 --scope user: 这将为您的用户帐户注册该工具,使其在每个项目中都可用。使用 --scope project 相反,如果您只希望它在当前项目中可用(这会写入项目的 .mcp.json 而不是您的全局配置)。省略 --scope 完全以交互方式提示。

步骤3:配置

该工具从以下位置读取其配置 ~/.claude/https-config.json。您必须先创建此文件,然后该工具才能处理默认值之外的任何内容。

mkdir -p ~/.claude
cp node_modules/claude-https-mcp/example-config.json ~/.claude/https-config.json

然后编辑 ~/.claude/https-config.json 以适应您的环境。至少要审查:

  • tls.cipherProfile — "intermediate" 对于大多数用例来说,这是一个很好的默认值
  • ca.mode — "bundled" 使用附带的Mozilla CA捆绑包;使用 "osPlusBundled" 如果您需要信任操作系统存储中的内部CA
  • proxy --如果您支持公司代理,请设置 enabled: true 并提供代理URL

看 配置选项 请参阅以下部分以获取完整参考,或 example-config.json 作为注释示例。

步骤4:验证

claude mcp list

你应该看看 cyphers-ai 在输出中。启动一个新的Claude Code会话 SecureWebFetch 工具将可用。

更新中

要更新到最新版本:

npm update -g claude-https-mcp

无需对Claude Code注册或配置文件进行任何更改,更新的二进制文件将自动获取。

替代方案:npx(零安装)

如果您不想全局安装,可以使用 npx 按需运行该工具。Claude Code每次启动会话时都会下载最新版本:

claude mcp add --scope user --transport stdio cyphers-ai -- npx claude-https-mcp

这便于尝试该工具,但在每次会话中都会增加几秒钟的启动延迟 npx 解析包。对于常规使用,建议全局安装。

您仍然需要在以下位置创建配置文件 ~/.claude/https-config.json 如步骤3所述。

备选方案:来源

git clone https://github.com/cyphers-ai/claude-https-mcp.git
cd claude-https-mcp
npm install
npm run build
npm link
claude mcp add --scope user --transport stdio cyphers-ai -- claude-https-mcp

配置

配置文件位于 ~/.claude/https-config.json (或用覆盖路径 CLAUDE_HTTPS_CONFIG 环境变量)。以下是具有默认值的完整模式:

{
  "tls": {
    "minVersion": "TLSv1.2",
    "maxVersion": "TLSv1.3",
    "cipherProfile": "intermediate",
    "customCiphers": null,
    "rejectUnauthorized": true
  },
  "ca": {
    "mode": "bundled",
    "customBundlePaths": [],
    "additionalCaPaths": []
  },
  "clientCert": {
    "enabled": false,
    "certPath": null,
    "keyPath": null,
    "passphrase": null,
    "p12Path": null,
    "p12Passphrase": null
  },
  "pinning": {
    "enabled": false,
    "mode": "leaf",
    "pins": []
  },
  "revocation": {
    "enabled": false,
    "policy": "ocspWithCrlFallback",
    "failMode": "soft",
    "cacheTtlSeconds": 300
  },
  "proxy": {
    "enabled": false,
    "url": null,
    "auth": {
      "type": "none",
      "username": null,
      "password": null
    },
    "bypassList": []
  },
  "defaults": {
    "timeoutMs": 30000,
    "followRedirects": true,
    "maxRedirects": 10,
    "maxBodySizeBytes": 10485760
  },
  "license": {
    "key": null
  }
}

看 example-config.json 一个完整记录的例子。

配置选项

TLS设置

选项 值 描述
minVersion TLSv1.2, TLSv1.3 最低TLS版本
maxVersion TLSv1.2, TLSv1.3 最高TLS版本
cipherProfile modern, intermediate, compatible, fips, custom 密码套件配置文件
customCiphers OpenSSL密码字符串 自定义密码字符串(当配置文件为 custom)
rejectUnauthorized true, false 验证服务器证书

CA模式

模式 描述
bundled 使用Mozilla CA捆绑包(默认)
osPlusBundled 使用操作系统信任存储+Mozilla捆绑包
osOnly 仅使用操作系统信任存储
custom 仅使用自定义CA文件

密码配置文件

简介 描述
modern 仅支持TLS 1.3,安全性最强
intermediate TLS 1.2+,平衡的安全性/兼容性(推荐)
compatible 更广泛的支持,仍然没有遗留密码
fips FIPS 140-3兼容密码(专业版,需要启用FIPS的OpenSSL)
custom 用户定义的密码字符串

用法

配置后,Claude Code将可以访问 SecureWebFetch 工具:

Use SecureWebFetch to get https://api.example.com/data

工具参数

参数 类型 必填 说明
url string 是 要获取的HTTPS URL
method string 否 HTTP方法(GET、POST等)
headers object 否 请求标头
body string 否 请求正文
timeout number No 请求超时(毫秒)

环境变量

变量 描述
CLAUDE_HTTPS_CONFIG 覆盖配置文件路径

许可证

  • 无需许可证即可使用免费功能
  • 专业版功能需要以下许可证https://cyphers.ai

发展

# Install dependencies
npm install

# Build
npm run build

# Watch mode
npm run dev

测试

# Run unit tests
npm test

# Run tests in watch mode
npm run test:watch

# Run tests with coverage report
npm run test:coverage

集成测试

集成测试套件使用Docker来启动TLS测试端点(mTLS、OCSP、CRL、过期证书等):

npm run test:server:start   # Start Docker test environment
npm run test:server:test    # Run integration tests
npm run test:server:stop    # Stop Docker test environment