npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

opencode-chatgpt-web-mcp

v0.5.6

Published

OpenCode MCP + plugin: ChatGPT web thinks, OpenCode executes. Use /chatgpt.

Downloads

1,198

Readme

opencode-chatgpt-web-mcp

让你的 AI 编程助手把 ChatGPT 网页版当成「思考大脑」:分析、查引用、下结论在 ChatGPT;改文件、跑命令仍由本机 CLI(OpenCode / Claude Code / Codex 等)执行。

不走 OpenAI 付费 API,不需要 API Key。用你自己登录的 chatgpt.com 账号。

非官方,与 OpenAI 无隶属关系。页面改版、账号策略都可能影响可用性。请遵守你账号的使用条款。

它解决什么问题

| 痛点 | 做法 | | --- | --- | | ChatGPT 网页聪明但读不到你电脑上的项目 | MCP 从当前工作区读文件,把原文发给网页 | | 付费 API 贵 / 想用网页额度 | 不调官方 API,走已登录的网页会话 | | 不想每次把整仓塞进对话 | 先给文件名列表;ChatGPT 用 need_files 要文件时再自动续传 | | OpenCode 想一键触发 | 配套 plugin 提供 /chatgpt 斜杠命令 |

分工:

  1. 你在本机 CLI 里提需求(OpenCode 推荐用 /chatgpt …)
  2. MCP 打开专用 Chrome,把问题(和需要的文件内容)发给 ChatGPT 网页
  3. ChatGPT 若还要其它文件,MCP 自动从项目里读取再发
  4. 得到结论后,由本机 CLI 去改代码、跑命令

5 分钟上手

1. 环境

  • Node.js 20+ 或 Bun
  • Google Chrome / Chromium / Microsoft Edge
  • 能登录的 ChatGPT 账号
  • 下面任一客户端:OpenCode、Claude Code、Codex CLI 等(支持本地 MCP 即可)

2. 每台电脑登录一次

bunx opencode-chatgpt-web-mcp doctor
bunx opencode-chatgpt-web-mcp login

没有 Bun 时把 bunx 换成 npx。

在弹出的专用 Chrome 窗口里登录 ChatGPT。登录资料只保存在本机 ~/.chatgpt-web-mcp/,不会进 npm 包。

3. 按你的 CLI 配好,重启客户端

见下方各客户端章节。

4. 开始用

  • OpenCode:/chatgpt 这个项目有没有用 sass?
  • 其它 CLI:直接让助手「用 chatgpt_ask 问:……」

OpenCode

推荐同时装 plugin(提供 /chatgpt)和 MCP(网页自动化)。

把下面写入项目的 .opencode/opencode.json 或根目录 opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-chatgpt-web-mcp/plugin"],
  "mcp": {
    "chatgpt-web": {
      "type": "local",
      "command": ["bunx", "-y", "opencode-chatgpt-web-mcp"],
      "enabled": true,
      "timeout": 600000
    }
  }
}

没有 Bun:

"command": ["npx", "-y", "opencode-chatgpt-web-mcp"]

然后:

  1. 完全退出并重启 OpenCode
  2. 确认 MCP:opencode mcp list(chatgpt-web 应为 connected)
  3. 在 TUI 里输入:
/chatgpt 这个项目有没有用 sass?

只有打了 /chatgpt 才会走网页思考;普通对话不会自动调用。

同一个 OpenCode session 会粘住同一个 ChatGPT 网页对话(/c/…),退出再打开同一 session 也会自动回到该对话。若要新开网页对话,在 /chatgpt 里明确说「新开对话」即可。

每次 chatgpt_ask 默认会把网页思考档位切到 Medium(发送前自动点选)。可用工具参数 thinking / thinkingLevel,或环境变量 CHATGPT_WEB_THINKING_LEVEL(如 high、instant)覆盖;在 /chatgpt 里明确说「不要思考 / 用 Instant」时才会关掉。

/chatgpt 拿到网页结论后,会先给出改动摘要等你确认(例如回复「改吧」),不会直接改仓库。复杂、多文件改动会先列清单再逐项改。每完成一项(或一次简单改动),若当前目录是带 remote 的 git 仓库,会 commit 并 push 一次(不 force-push)。

本地开发(未发布 / 改源码)可用绝对路径:

{
  "plugin": ["/absolute/path/to/chatgpt-web-mcp/plugin/opencode-chatgpt-web.js"],
  "mcp": {
    "chatgpt-web": {
      "type": "local",
      "command": ["bun", "/absolute/path/to/chatgpt-web-mcp/src/cli.ts"],
      "enabled": true,
      "timeout": 600000
    }
  }
}

排查:

opencode debug config          # 应看到 plugin 与 command.chatgpt
opencode run --command chatgpt "你的问题"

若 / 列表里暂时看不到,可直接输入完整 /chatgpt;Desktop GUI 对自定义斜杠命令支持较弱,请优先用终端 TUI。


Claude Code

Claude Code 用标准 MCP,没有 OpenCode 的 /chatgpt plugin。配置好后,在对话里让 Claude 调用 chatgpt_ask 即可。

claude mcp add chatgpt-web -- bunx -y opencode-chatgpt-web-mcp

或项目根目录 .mcp.json:

{
  "mcpServers": {
    "chatgpt-web": {
      "command": "bunx",
      "args": ["-y", "opencode-chatgpt-web-mcp"]
    }
  }
}

没有 Bun:

{
  "mcpServers": {
    "chatgpt-web": {
      "command": "npx",
      "args": ["-y", "opencode-chatgpt-web-mcp"]
    }
  }
}

使用示例:

用 chatgpt_ask 问:这个项目有没有用 sass?files 先空着,让它需要文件时自己要。

可选:在 .claude/commands/chatgpt.md 里做自己的斜杠命令(Claude 的命令体系,与 OpenCode plugin 无关)。


Codex CLI

codex mcp add chatgpt-web -- bunx -y opencode-chatgpt-web-mcp

或按 Codex 文档写入 MCP 配置(~/.codex/config.toml 等),核心是:

[mcp_servers.chatgpt-web]
command = "bunx"
args = ["-y", "opencode-chatgpt-web-mcp"]

没有 Bun 则用 npx。

对话里同样让 Codex 调用 chatgpt_ask。Codex 没有 OpenCode 那套 /chatgpt plugin。


Cursor 等其它 MCP 客户端

凡支持 本地 stdio MCP 的客户端,启动命令都类似:

| 字段 | 值 | | --- | --- | | command | bunx 或 npx | | args | ["-y", "opencode-chatgpt-web-mcp"] |

超时请尽量调大(建议 ≥ 5–10 分钟),ChatGPT 网页思考经常超过默认 30 秒。

不要给这个 MCP 再配一个会改掉工作区的 cwd,否则它可能读错项目目录。


工具说明(所有客户端通用)

chatgpt_status

查看:是否已登录、专用浏览器是否在跑、当前检测到的项目目录。

chatgpt_ask

| 参数 | 必填 | 说明 | | --- | --- | --- | | prompt | 是 | 要 ChatGPT 思考的问题 | | files | 否 | 第一轮就贴进对话的文件(相对项目根)。一般可留空 | | newChat | 否 | true 时为当前 OpenCode session 新开网页对话;默认继续该 session 已绑定的对话(可跨 OpenCode 重启恢复) |

ChatGPT 若回复 need_files 代码块,MCP 会从当前工作区读这些文件并自动续发(最多约 8 轮)。单文件正文默认截断到约 80KB,不会整仓塞进对话。


常用命令

opencode-chatgpt-web-mcp serve     启动 MCP(客户端一般会自动调)
opencode-chatgpt-web-mcp login     打开专用浏览器登录
opencode-chatgpt-web-mcp status    查看本机登录/浏览器状态
opencode-chatgpt-web-mcp doctor    检查 Node/Bun、Chrome、目录
opencode-chatgpt-web-mcp help

常见问题

退出 OpenCode 再打开,网页对话会不会丢?
同一个 OpenCode session 会记住对应的 ChatGPT /c/…(写在本机 ~/.chatgpt-web-mcp/session-conversations.json)。再 /chatgpt 时会先打开那个对话。要换新网页对话,在命令里明确说「新开对话」。

第一次用要登录吗?
要。每台电脑执行一次 login;之后若掉登录,第一次 chatgpt_ask 也会弹出专用 Chrome 等你登录。

登录资料会不会被上传到 npm?
不会。只在本机 ~/.chatgpt-web-mcp/。

找不到 Chrome?

export CHATGPT_WEB_CHROME="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"

ChatGPT 说看不到文件?
网页读不到你电脑路径。应看到带 chatgpt-web-mcp 版本号的提示和文件名列表;正文由 MCP 粘贴。若仍只有两行路径,请重启客户端并确认用的是较新版本包。

能给多台电脑用吗?
能。各台 bunx/npx 拉同一 npm 包,各自 login 一次;业务项目代码仍在各台自己的仓库里。


可选环境变量

| 变量 | 默认 | 说明 | | --- | --- | --- | | CHATGPT_WEB_CHROME | 自动探测 | 浏览器可执行文件 | | CHATGPT_WEB_PROFILE | ~/.chatgpt-web-mcp/chrome-profile | 专用 Chrome 配置目录 | | CHATGPT_WEB_RESPONSE_TIMEOUT_MS | 180000 | 等待回答超时 | | CHATGPT_WEB_LOGIN_WAIT_MS | 600000 | 等待手动登录超时 | | CHATGPT_WEB_SEND_INTERVAL_MS | 5000 | 两次发送最小间隔 | | CHATGPT_WEB_HEADLESS | false | 无界面(首次登录不要开) | | CHATGPT_WEB_SKIP_COMMAND | — | 设为 1 时不自动写命令文件 |


开发者

git clone <this-repo>
cd chatgpt-web-mcp
bun install
bun test
bun run typecheck
bun run build

发布:

npm login
npm publish --access public

网页选择器参考了 MIT 许可的 Goudu666/chatgpt-web-mcp 的公开实现;本项目面向「本机 CLI 执行 + ChatGPT 网页思考」,并附带 OpenCode plugin。