Bundle
http-request-dsh-plugin
Native DSH http_request tool with configurable credential whitelist and usage skill.
- Source
- gao-gao-zai
- stars
- 1 stars
- License
- MIT
- Updated
- Updated 14 days ago
Readme
# HTTP Request DSH Plugin
原生 DeepSeek Harness(DSH)插件,提供 `http_request` 工具、凭据白名单 Settings,以及对应的使用技能。
本插件是纯 DSH Plugin,不使用 MCP,不启动 MCP Server,也不通过 MCP stdio 通信。
## 功能
- 直接使用 `undici` 发起 HTTP(S) 请求
- 支持 `GET`、`POST`、`PUT`、`PATCH`、`DELETE`、`HEAD`、`OPTIONS`
- 支持请求 headers、query、JSON 或文本 body
- 支持直连、系统代理和手动 HTTP(S) 代理
- 支持超时、响应截断、响应头展示和完整响应保存
- 支持 Windows Credential Manager 凭据引用
- 支持 DSH Settings 配置 Credential Manager 白名单
- 注册 `http-request-tool` skill,自动介绍工具和白名单配置方式
- 所有工具结果均返回纯文本 JSON 字符串
## 工具参数
工具名:`http_request`
```json
{
"method": "GET",
"url": "https://api.example.com/status",
"headers": {},
"query": {},
"body": null,
"proxy": "none",
"timeoutMs": 30000,
"showHeaders": false,
"maxChars": 10000,
"outputFile": ""
}
```
此外支持:
- `headersFromCredential`
- `queryFromCredential`
- `bodyFromCredential`
- `maxResponseBytes`(兼容字段)
工具的 canonical output 类型固定为 `string`,并由 Native render 输出一个 `text` block。成功、HTTP 非 2xx、超时和异常都会返回合法 JSON 文本。
## 返回限制
单次请求可以通过 `maxChars` 设置返回预览字符数,也可以使用 `maxResponseBytes` 兼容字段估算字符数:
```json
{
"url": "https://example.com",
"maxChars": 10000
}
```
不传 `maxChars` 时,插件使用 Settings 中的 `defaultMaxChars`。返回上限可以在 DSH Web GUI 的 **Settings > Plugins > http-request-mcp** 中修改:
```json
{
"defaultMaxChars": 2048,
"maxCharsLimit": 200000
}
```
`maxCharsLimit` 是人工配置的上限,单次请求传入的 `maxChars` 不能超过它。插件还保留 `1000000` 字符的内部绝对安全上限;设置超过该值时会自动按 `1000000` 处理。修改 Settings 后实时生效。
即使返回预览被截断,指定 `outputFile` 仍会保存完整响应体。
默认允许的 target 前缀:
```text
newapi/
openclaw/
upstreamops/
```
在 DSH Web GUI 中打开:
```text
Settings > Plugins > http-request-mcp
```
修改 `credentialPrefixes` 字符串数组即可。设置使用 `applies: live`,修改后实时生效,并由 DSH Settings Provider 持久化到 Profile 配置文件。
也支持环境变量:
```powershell
$env:HTTP_REQUEST_MCP_CREDENTIAL_PREFIXES = "newapi/,openclaw/,upstreamops/"
```
优先级为:DSH Settings > 环境变量 > 内置默认值。
只有 target 以允许的前缀开头时,插件才会访问 Windows Credential Manager。未通过白名单的请求会返回 JSON 错误,不会读取或发送秘密。
## 安装教程
### 方式一:DSH CLI 一键安装
DSH 会自动修改目标 Profile、安装依赖并注册 bundle:
```powershell
dsh plugin --profile web add github:gao-gao-zai/http-request-dsh-plugin
```
这个命令**不要求先克隆仓库**。其中 `github:gao-gao-zai/http-request-dsh-plugin` 是 pnpm 支持的 GitHub shorthand,DSH 会将它交给 pnpm 直接下载并安装。
其中:
- `web` 是目标 Profile 名称;如果使用其他 Profile,请替换它
- `github:gao-gao-zai/http-request-dsh-plugin` 是本仓库的 GitHub 安装标识
- 不需要手动执行 `git clone`
- 不需要手动编辑 Profile 配置文件
安装完成后刷新 WebUI;如果 DSH 提示需要重启,则重启 DSH 使新 bundle 生效。
### 方式二:克隆仓库后本地安装
如果希望保留源码、离线查看或自行修改,可以先克隆仓库,再让 DSH 从本地目录安装:
```powershell
$PLUGIN_DIR = Join-Path (Get-Location) "http-request-dsh-plugin"
git clone https://github.com/gao-gao-zai/http-request-dsh-plugin.git $PLUGIN_DIR
pnpm --dir $PLUGIN_DIR install
pnpm --dir $PLUGIN_DIR run check
dsh plugin --profile web add $PLUGIN_DIR
```
`$PLUGIN_DIR` 可以是任意本地目录。DSH 会把这个目录作为本地依赖安装到 `web` Profile,并自动注册 bundle,不需要手动编辑 Profile 配置文件。
如果之后修改了源码,重新执行:
```powershell
pnpm --dir $PLUGIN_DIR run check
dsh plugin --profile web add $PLUGIN_DIR
```
这个方式也适合本地开发和调试;普通安装可直接使用上面的 GitHub CLI 方式。
### 安装后验证
重启或刷新 DSH 后依次检查:
1. 工具目录中出现 `http_request`
2. `Settings > Plugins > http-request-mcp` 中出现 `credentialPrefixes`
3. Skill 目录中出现 `http-request-tool`
4. 调用工具后结果是纯文本 JSON,而不是对象或 MCP 内容块
本插件是纯 DSH Plugin,不需要注册 MCP Server,也不需要启动 MCP 进程。
## 开发检查
```powershell
pnpm install
pnpm run check
```
## License
MIT,详见 [LICENSE](./LICENSE)。
Install
dsh plugin --profile web add github:gao-gao-zai/http-request-dsh-plugin
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install http-request-dsh-plugin from the hub
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.