所有文章
AI

Claude Code / Codex 里多了 Postman 插件怎么查怎么删(含 hook、MCP 和 CLI)

Postman 桌面版 12.33.4 起会给 Claude Code 和 Codex 自动装插件、hook、MCP 和 CLI。附日志原文、检查命令和逐个文件的删除步骤。

2026 年 10 月下旬起,有用户发现打开 Postman 桌面版后,Claude Code 和 Codex 里多了一个 Postman 插件、一个 SessionStart hook 和一个连不上的远程 MCP,~/.local/bin 里还多了 Postman CLI。下面按文件一项项查、一项项删,最后关掉自动重装的入口。

发生了什么

报告来自 Postman 官方仓库的 GitHub issue #14370,报告人用的是 macOS 上的 Postman 12.33.4。Postman 自己的日志 ~/Library/Application Support/Postman/logs/main.log 记下了安装过程:

PostmanAgentPluginService~install: script completed
{"source":"auto-existing-upgrade","results":["claude-code:installed","codex:installed"],"installer":"script"}

Main: autoInstall.plugin.existing-user finished
{"outcome":"installed","platform":"darwin","exposed":true,"signedIn":true,"flagTimedOut":false,"useScript":true,"installer":"script","scriptResults":"claude-code:installed,codex:installed"}

auto-existing-upgrade 和 autoInstall.plugin.existing-user 表明这一步针对的是老用户升级。另一位用户在 12.31.3 升到 12.35.1 时看到同样的日志,新下载检查记的是 skipped-not-fresh,说明 12.35.1 仍会走这条路径。

报告里列出的改动:

  • ~/.codex/config.toml 新增 [marketplaces.postman]、[plugins."postman@postman"] enabled = true,以及一条带 trusted_hash 的 [hooks.state."postman@postman:hooks/codex-hooks.json:session_start:0:0"]。
  • 插件注册了 SessionStart hook(matcher 为 startup|clear|compact),每次开会话都会让智能体在“任何非简单的 API 工程任务”前加载 postman:api-engineer skill。
  • 远程 MCP 指向 https://mcp.postman.com/mcp,未登录时 Codex 日志报 MCP server startup failed server_name="postman" ... Auth required。
  • ~/.claude/settings.json 启用了 postman@claude-plugins-official,版本 2.0.1,user 作用域。
  • ~/.local/bin 里多了 Postman 可执行文件和 lib 目录。

Postman 插件仓库的 README 自己写明:“For Codex, installation also approves Postman’s session-start hook”。也就是说,安装器会替你给它自己的 hook 签发信任记录。报告人明确说没有证据表明数据外泄。有评论补充,GitHub Copilot CLI 的 ~/.copilot/settings.json 也被写入了。

检查自己有没有中招

# Claude Code 已装插件
claude plugin list

# Codex 已装插件
codex plugin list

# 两个配置文件里有没有 postman
grep -il postman ~/.claude/settings.json ~/.codex/config.toml

# 看具体行(hook 信任记录、marketplace、MCP)
grep -n -i -A3 postman ~/.codex/config.toml
grep -n -i postman ~/.claude/settings.json ~/.claude/plugins/installed_plugins.json

# CLI
ls -la ~/.local/bin | grep -i postman

# Copilot CLI(装了的话)
grep -il postman ~/.copilot/settings.json

# macOS 上 Postman 自己的日志
grep -n "auto-existing-upgrade" ~/Library/Application\ Support/Postman/logs/main.log

MCP 和 hook 都打包在插件里,插件删掉它们就跟着失效。config.toml 里单独残留的 hooks.state 记录需要手动删,见下文。

逐项删除

1. Postman 官方卸载入口

Postman 桌面版菜单:Help → Postman CLI and Plugins → Uninstall Postman Coding Agent Plugin。有用户反馈这个按钮没有清掉 Copilot 里的插件,所以点完后仍要用上面的命令复查。

插件仓库还提供命令行卸载:

npx @postman/postman-plugin remove
# 只处理某一个智能体
npx @postman/postman-plugin remove --agent codex

这条命令要从 npm 拉 Postman 的安装器来执行。如果你不想再运行它的脚本,直接用下面各工具自带的命令。

2. Claude Code

命令来自 Claude Code 插件 CLI 文档,插件 ID 与 Postman 安装器源码里的一致:

claude plugin uninstall postman@claude-plugins-official --scope user
# 如果 list 里还有这个 ID 也删掉
claude plugin uninstall postman@postman --scope user
claude plugin list

成功会打印 Successfully uninstalled plugin: ...。删完再 grep -i postman ~/.claude/settings.json,enabledPlugins 里不应再有 postman。settings.json 各层路径见 Claude Code settings.json 路径说明。

3. Codex

Postman 安装器自己卸载时用的就是下面的命令(见插件仓库 installer/src/hosts/codex.ts):

codex plugin remove postman@postman
codex plugin marketplace remove postman
codex plugin list

安装器的 remove 流程不会动 hooks.state,所以要手动打开 ~/.codex/config.toml,删掉这几段(先备份):

cp ~/.codex/config.toml ~/.codex/config.toml.bak

[marketplaces.postman]           # 整段删除
[plugins."postman@postman"]      # 整段删除
[hooks.state."postman@postman:hooks/codex-hooks.json:session_start:0:0"]   # 整段删除,含 trusted_hash / trusted_content_hash

我推测残留的信任记录在插件删掉后不会再执行任何东西,但以后同一个 hook 被重新装回来时会被直接当成已信任,所以建议一并删掉。如果你在 config.toml 里单独加过 mcp.postman.com 的 MCP 条目,也一起删。

4. Postman CLI

ls -la ~/.local/bin | grep -i postman
# 确认修改时间对得上安装时间后再删
rm ~/.local/bin/postman
rm -r ~/.local/bin/<postman 的 lib 目录>

issue 里只写了“Postman 可执行文件和它的 lib 目录”,没给出 lib 目录的确切名字,按你 ls 看到的名字删。我没有找到 Postman 文档里的官方 CLI 卸载命令,用 Help → Postman CLI and Plugins 菜单是更稳的做法。

5. Copilot CLI(如果装了)

copilot plugin list
# 再手动删 ~/.copilot/settings.json 里的 extraKnownMarketplaces.postman 和 enabledPlugins."postman@postman"
ls ~/.copilot/installed-plugins

怎么防止它再装回来

截至 2026 年 11 月 5 日,issue 仍是 open 状态,Postman 没有公布关闭自动安装的开关。11 月 3 日(北京时间 11 月 4 日 07:36)一位以 Postman 名义回复的账号 zecoquit 表示会“make the opt-in clearer, especially for existing users”,并在复查 hook 审批和 session-start 行为。这个账号在 GitHub 上没有标注 Postman 成员身份。

目前能做的:

  • 不用 Postman 桌面版就直接卸载,换别的 API 客户端。
  • 继续用的话,每次 Postman 升级后跑一遍上面的检查命令,尤其是 grep -n "auto-existing-upgrade" 那条日志。
  • Codex 启动时如果提示有新 hook 待审查,不认识的一律不批。
  • 我推测把 ~/.codex/config.toml 和 ~/.claude/settings.json 纳入 git 管理、定期 diff,是发现这类静默改动最省事的办法。

hook 和 MCP 的权限边界可以看 Claude Code Skills 和 MCP 区别、Claude Code hooks 推荐配置 和 Claude Code MCP 推荐。如果你在 Postman 里存过 API key,并担心被插件读到,可以按 API key 泄露处理 5 步 轮换一遍。其他 Claude Code 报错见 Claude Code 报错速查。

留下你的想法

你的邮箱不会公开。