前言¶
在 DSH(DeepSeek Harness)里做联调或接口文档维护时,Postman 往往仍是团队存放 Collection 的主战场。人工在 Postman 网页端逐条增删改,再和对话里的 AI 来回核对,成本高且容易漏改。常见做法是复制 JSON、手写 curl,或让 AI 只「建议」变更而不真正写入云端。
dsh-postman 是社区维护的 DSH 插件,通过 Postman 官方 API 把查询、增删改、导入导出接到模型可见工具上。插件不绑定任何语言或框架,只负责与 Postman 通信;从源码整理接口清单再批量写入,由模型和使用者完成。
这是什么¶
- 名称:dsh-postman(npm 包名同为
dsh-postman) - 维护者:LiuJiaCheng11
- 分类:联网工具(SkillHub 目录)
- 定位:DeepSeek Harness 插件,允许 AI 直接操作 Postman(网页版)的 Collections
- 仓库:https://github.com/LiuJiaCheng11/dsh-postman
- 许可:MIT(见仓库
package.json) - 版本:资料中
package.json为 0.5.0;安装 GitHub 源时默认跟踪main最新提交
注意仓库归属:GitHub 上另有
zhousun55-byte/dsh-postman(文件上传类插件),包名相同,装错会互相覆盖。安装请认准LiuJiaCheng11/dsh-postman。
核心功能¶
插件向模型暴露 9 个工具,并注册 /postman-skill 技能(用法类似 /browser-skill,可在输入框 / 列表中选择,将工具表与典型流程注入当前会话)。
| 工具 | 作用 |
|---|---|
postman_list |
列出全部集合(名称 + uid) |
postman_tree |
展示某集合的目录树与接口清单;可限定 path,输出过长会显式提示截断 |
postman_add |
在指定目录新增一个接口(可自动建目录、继承集合 auth) |
postman_add_many |
批量新增;整批仅 GET / 备份 / PUT 一次集合,同名跳过,支持 dryRun |
postman_edit |
就地修改已有接口(改名、URL、方法、头、体、说明、auth 等) |
postman_rm |
按名称删除接口 |
postman_pull |
导出集合为 Postman v2.1 JSON |
postman_push |
用本地 JSON 整体覆盖集合 |
postman_config |
查看 / 设置 / 清除 API Key |
设计要点(来自 README):
- 只管 Postman,不管源码:插件内无语言、框架或路由约定;批量加接口时由 AI 读项目代码整理清单,再交给
postman_add_many一次写入。 - 配置:推荐在 dsh 「设置 → Postman」 填写 API Key;字段标了
role('secret'),明文不回传浏览器。依赖仅@deepseek-ai/schemastery,其余使用 Node 内置模块。 - 修改接口:应优先用
postman_edit就地 patch;不要用「先postman_rm再postman_add」,否则会静默丢失 Pre-request / Tests 脚本、示例响应等字段。
运行环境(package.json):Node >=22.5,dsh >=0.1.1-rc.1。
安装与启用¶
插件目录本身是 dsh bundle,用 dsh 自带命令从 GitHub 安装:
dsh plugin --profile web add github:LiuJiaCheng11/dsh-postman
固定到某一提交:
dsh plugin --profile web add github:LiuJiaCheng11/dsh-postman#<commit-sha>
安装后 dsh 会把 dsh-postman 写入 ~/.dsh/profiles/web/package.json 的 dsh.profile.bundles。需要重启 dsh(重新执行 dsh web)后插件才生效;刷新浏览器或新开标签不足以热重载插件代码。
验证是否装配:
dsh --profile web --dump-config | grep -i postman
配置 Postman API Key¶
- 在 Postman 账号设置 → API Keys 生成 Key(
PMAK-开头)。 - 在 dsh 「设置 → Postman」 填入(推荐)。保存后若当前会话仍读到旧 Key,可新开会话或重启 dsh;也可用
postman_config查看status与 Key 来源。 - 0.2.x 提供上述设置分区;0.1.x 无 Web 客户端该页时,可用备用页
http://127.0.0.1:<port>/dsh-postman,或直接编辑 profile 的cordis.patch.yml。
Key 读取回退顺序(README 说明):
- 设置表单中的
apiKey(写入~/.dsh/profiles/<profile>/cordis.patch.yml) ~/.dsh/dsh-postman/config.json(备用页写入,权限 0600)~/.postman_api_key(历史文件)- 环境变量
POSTMAN_API_KEY
备用页每次取 Key 都会重读文件,改完可立即生效,适合排查设置页与会话缓存问题。
典型用法¶
安装、配置 Key 并重启 dsh 后,可直接用自然语言驱动工具;也可先输入 /postman-skill 注入完整说明。
README 中的对话示例:
- 列出我的 Postman 集合
- 在 App 的「测试」目录下加一个 GET 接口
http://localhost:8080/api/v1/models - 把 App 集合里「健康检查」的地址改成
/healthz - 把 Converter 集合导出到
D:/tmp/converter.json - 扫一下
D:/src/MyApi,看哪些接口还没进 Postman - 把
D:/src/MyApi里没同步的接口写进 App 集合
大集合查看时,对 postman_tree 使用 path 缩小范围,或调大 limit;截断时输出会带明确提示与顶层目录名。
批量新增前可用 postman_add_many 的 dryRun: true 预演将新增或跳过的项。
适用场景与注意¶
适合:已在用 DSH Web profile、Collection 托管在 Postman 云端、希望对话内完成集合浏览与 CRUD、或从本地代码/清单一次性同步多条接口的团队或个人。
使用前请知悉:
- 插件以 当前 dsh 进程权限 运行,并持有你配置的 Postman API Key,可对云端 Collection 做破坏性操作(删除、整体 push 覆盖等)。安装前请阅读仓库源码与 MIT 许可证,自行评估信任边界。
- 联网工具会访问 Postman API;网络与 Key 权限范围由你的 Postman 账号决定。
- 社区目录 SkillHub 插件页 与 DeepSeek / 幻方无官方从属关系;DSH 生态理念是「一切皆插件」,本文事实以 GitHub README 与仓库文件为准。
结尾¶
dsh-postman 把 Postman 云端 Collections 的读写收成一组模型工具,并辅以 /postman-skill 与 Web 设置页,减少在 Postman 网页与 AI 对话之间手工搬运 JSON 的步骤。若你的联调流程以 Postman 为中心,可在 DSH 中按上文命令安装、配置 Key 并重启后试用。