chatgpt-web-mcp
This server is a local MCP server that lets MCP clients operate a dedicated persistent ChatGPT web browser session—without OpenAI API keys—to send messages, manage conversations, adjust model/thinking/tier settings, and inspect status.
Manage the dedicated browser lifecycle: start/keep it resident, check status, or close it on explicit request.
Create new chats (normal or temporary), switch modes, models, thinking levels, and capability tiers.
Write prompts, upload files, send messages, and retrieve complete answers; a combined send tool handles the full flow.
List, search, and select history conversations by ID, URL, or title.
Probe Pro identity with caching and configurable routing for requests that explicitly ask for Pro.
Apply safety features: circuit breaker status/clearing, network diagnostics, and throttling-aware operation.
Inspect current capabilities, answer tier status, and browser lifecycle without guessing model names.
Provides tools to interact with the ChatGPT web interface, allowing AI agents to send prompts, upload files, read responses, manage conversations, and configure model settings through a persistent browser session.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@chatgpt-web-mcp Ask ChatGPT to explain quantum computing in simple terms"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ChatGPT Web MCP
一个本地、非官方的 MCP Server,让 Codex 等 MCP 客户端通过独立的持久浏览器配置操作 chatgpt.com。它不使用 OpenAI 官方付费 API,也不需要 API Key。消息发送通过网页完成;历史读取可能使用当前网页会话的内部接口。它不读取用户日常浏览器配置,也不会把登录信息写进 MCP 配置。
本项目与 OpenAI 无隶属或背书关系。它依赖 ChatGPT 网页界面,页面改版、账号权限、地区或工作区策略都可能影响可用性。请遵守适用于你账号的条款,不要用它绕过访问控制、用量限制或安全机制。
主要能力
写入提示词、上传文件、发送消息并读取完整回答
新建普通或临时对话,选择历史对话
动态读取和选择页面实际显示的模型、思考强度与能力档位
普通请求默认使用“极高”;临时 Pro 身份探针默认停用,避免额外创建临时对话和发送测试消息
浏览器和 ChatGPT 页面默认常驻,工具结束后只断开本地控制连接
跨进程串行操作、低频节流、回答完成后的切换静默期
遇到页面限流文字或非历史接口 HTTP 429 时熔断;历史接口 429 不触发全局熔断,不自动重试该接口
对话达到 40 轮或出现 ChatGPT maximum-length banner 时,发送前先滚动加载完整 transcript(含较早历史),再归档并轮换普通对话;直接
chatgpt_submit_prompt会安全拦截只记录脱敏后的异常请求方法、路径、状态码和资源类型
Related MCP server: ChatGPT Local Terminal Plugin
运行要求
Node.js 20 或更高版本
Google Chrome、Chromium 或 Microsoft Edge
支持本地 stdio MCP 的客户端,例如 Codex
可正常访问并手动登录的 ChatGPT 账号
项目会在 macOS、Windows 和 Linux 的常见位置查找浏览器。找不到时可通过 CHATGPT_WEB_CHROME 指定可执行文件。
安装
git clone https://github.com/Goudu666/chatgpt-web-mcp.git
cd chatgpt-web-mcp
npm ci
npm run doctor为了在任意目录使用统一命令,可以建立本地全局链接:
npm link
chatgpt-web-mcp doctor首次登录
chatgpt-web-mcp login未执行 npm link 时也可以使用:
npm run login在打开的专用浏览器窗口中手动登录。登录资料默认保存在 ~/.chatgpt-web-mcp/chrome-profile,与日常浏览器配置分离。不要复制、提交或分享这个目录,也不要把密码、Cookie、令牌或验证码写进环境变量。
添加到 Codex
使用统一命令:
codex mcp add chatgpt-web -- chatgpt-web-mcp serve
codex mcp get chatgpt-web如果 Codex 找不到全局命令,可以直接使用 Node.js 和项目的绝对路径:
codex mcp add chatgpt-web -- node /absolute/path/to/chatgpt-web-mcp/src/index.jsCodex 的 MCP 配置方式可参考 OpenAI Docs。
CLI
chatgpt-web-mcp serve 启动 stdio MCP Server(默认命令)
chatgpt-web-mcp login 打开专用浏览器并等待手动登录
chatgpt-web-mcp status 读取当前本地状态
chatgpt-web-mcp doctor 检查 Node.js、浏览器和本地数据路径
chatgpt-web-mcp help 显示帮助MCP 工具
工具按用途分为以下几组:
状态:
chatgpt_status、chatgpt_capabilities、chatgpt_browser_lifecycle对话:
chatgpt_new_chat、chatgpt_set_temporary、chatgpt_list_history、chatgpt_search_history、chatgpt_select_history设置:
chatgpt_list_modes、chatgpt_select_mode、chatgpt_list_models、chatgpt_select_model、chatgpt_list_thinking_levels、chatgpt_select_thinking_level、chatgpt_answer_tier_status、chatgpt_select_answer_tier输入与输出:
chatgpt_write_prompt、chatgpt_upload_files、chatgpt_submit_prompt、chatgpt_send_message、chatgpt_get_latest_response、chatgpt_archive_conversation安全:
chatgpt_circuit_breaker_status、chatgpt_clear_circuit_breaker、chatgpt_network_diagnostics策略路由:
chatgpt_probe_pro_identity、chatgpt_route_new_chat
只有用户明确要求关闭专用浏览器时,才应调用 chatgpt_close_browser。
默认路由策略
普通请求默认新建非临时对话并选择页面可用的“极高”档位,使用 chatgpt_route_new_chat(requestPro=false)。
临时 Pro 身份探针默认停用(CHATGPT_WEB_PROBE_ENABLED=false)。chatgpt_probe_pro_identity 或 requestPro=true 会明确报错,不新建临时对话,也不发送“你是什么模型?”;forceProbe=true 不能绕过停用设置。这样可以避免探针产生额外对话和请求。停用探针不等于禁止手动选择页面实际提供的 Pro 档位,但本工具不保证账号实际路由到哪一个模型。
仅在确实需要实验性身份核对时,才手动设置 CHATGPT_WEB_PROBE_ENABLED=true 并重启 MCP。当前实验流程在临时对话的可用档位发送探针,读取网络响应的 model_slug:mini 回退默认档位,其他非空标记记为 network-verified,缺少标记则停止。非 mini 不等于 Pro,该流程不会强制选择 Pro。工具名及 requestPro 参数为兼容旧客户端而保留,不能把它们理解为 Pro 保证。
启用探针时,同一浏览器与页面会话持续复用可靠缓存;检测到关闭后保留 3 小时,再次请求时才重验。普通 MCP 调用结束只断开控制连接,不关闭网页,不启动重验计时。默认停用状态下不会因缓存过期自动发起探针,也不会要求重新登录。
相关配置:
环境变量 | 默认值 | 用途 |
|
| 是否显式启用实验性临时身份探针 |
|
| 普通请求和回退使用的倒数第二档名称 |
|
| 滑杆最高档名称 |
|
| 临时身份探针提示词 |
|
| 接受分类标识 |
|
| 回退分类标识 |
| GPT-5.6 Pro 正则 | 接受回答的匹配表达式 |
| GPT-5.5 mini 正则 | 回退回答的匹配表达式 |
|
| 页面或浏览器关闭后,重新验证前继续复用可靠结果的时间 |
参考配置见 .env.example。项目不会自动读取 .env;请通过 MCP 客户端、Shell 或系统环境注入变量。
新对话前的可选刷新
CHATGPT_WEB_REFRESH_BEFORE_NEW_CHAT=false,默认不额外刷新旧页面。设置为 true 并重启 MCP 后,新建对话执行“检查草稿和附件 → 刷新当前页面 → 站内新建”。刷新失败或出现限流时停止,不重试。
这与现有的“发送前刷新”是两个步骤。开启后,一次新建并发送通常会刷新两次,增加请求量和耗时;它用于按需处理旧页面状态,不是防限流功能。已完成的小规模测试只能说明该流程可用,不能证明额外刷新能降低限流。浏览器与网页仍默认常驻。
安全节流
环境变量 | 默认值 |
| 1000 ms |
| 5000 ms |
| 5000 ms |
| 5000 ms |
| 5000 ms |
| 6000 ms |
| 300000 ms |
| 300000 ms |
默认 5 秒是最小间隔,不是每 5 秒必定完成一次操作,也不是免于限流或封禁的保证。 页面加载、页面交互、生成回答以及其他等待会叠加;完成上一条回答后才开始下一条,不并发发送。已有客户端环境变量会覆盖新默认值;例如原先显式配置了 30000,升级后仍使用 30 秒。
新建、临时切换和历史选择受独立的 5 秒对话变更间隔约束,回答完成后至少静默 5 秒才允许切换。首次打开 ChatGPT 页面后仍等待 6 秒。若账号出现请求频繁提示,应停止并增大间隔,例如把上述三个 5000 配置改回 30000,不要反复重试。
人工确认限流消失并清除本地熔断后,首次站点操作仍等待 5 分钟;页面明确提示历史限流时还有独立的 5 分钟静默截止时间,清除熔断不会绕过它。仅历史接口返回 HTTP 429 不触发全局熔断:浏览器响应保留诊断日志,主动读取失败则沿用页面 transcript 回退,不自动重试该接口。网页明确出现“请求过于频繁”等限流提示时仍停止。缺少现成请求头时不再额外打开页面取认证信息。
保留 PR 的旧进程锁回收逻辑:记录的 MCP 进程已退出时,后续操作会自动清除其生成标记,避免遗留锁阻塞。进程仍存活或标记未记录进程 ID 时,不按此规则清除;这不会同时清除限流熔断,也不会关闭浏览器。
其他环境变量
CHATGPT_WEB_CHROME:浏览器可执行文件绝对路径CHATGPT_WEB_PROFILE:专用浏览器配置目录CHATGPT_WEB_HEADLESS:是否无界面运行,默认falseCHATGPT_WEB_ACTION_TIMEOUT_MS:单次页面操作超时CHATGPT_WEB_RESPONSE_TIMEOUT_MS:普通档位回答超时CHATGPT_WEB_RECONNECT_DELAY_MS:浏览器异常重连间隔CHATGPT_WEB_AUTH_CACHE_MS:登录状态本地缓存时间CHATGPT_WEB_PRO_RECHECK_AFTER_CLOSE_MS:页面或浏览器关闭后的探针重验间隔,默认 3 小时CHATGPT_WEB_BROWSER_STATE、CHATGPT_WEB_RUNTIME_STATE:本地状态文件CHATGPT_WEB_OPERATION_LOCK:跨进程浏览器独占锁CHATGPT_WEB_NETWORK_LOG:脱敏网络异常日志CHATGPT_WEB_MAX_CONVERSATION_TURNS:发送前自动轮换阈值,默认40CHATGPT_WEB_CONTEXT_ARCHIVE_DIR:对话轮换前 Markdown 归档目录
隐私与局限
登录资料、运行状态和诊断日志默认位于
~/.chatgpt-web-mcp,不在仓库中。文件上传只接受调用者明确提供的绝对路径。
网络诊断不保存查询参数、Cookie、请求体、响应体或对话 ID。
等待回答使用页面内的变更事件,不持续轮询页面。
每次发送前只做一次当前对话整页刷新并重新校验;页面、对话 URL、用户草稿或附件状态异常时停止,不自动重试。
对话轮换前的完整 transcript(含懒加载的较早消息)由
chatgpt_archive_conversation或原子发送路径以0600Markdown 文件保存;归档目录应按部署需要纳入受控的研究文档路径。ChatGPT 网页不是稳定 API;选择器可能随页面更新而需要维护。
模型自我说明和网络模型标记都不构成对实际服务模型的独立证明;尤其不能把“非 mini”当作 Pro 保证。
开发
npm ci
npm test
npm run smoke
npm pack --dry-runCI 只运行离线测试和打包检查,不登录 ChatGPT,也不执行真实网页请求。贡献前请阅读 CONTRIBUTING.md;安全问题请阅读 SECURITY.md。
许可证
Available Tools
27 toolschatgpt_answer_tier_statusA
读取输入框右侧能力滑杆的当前档位和可访问值域,例如“极高,第 4 项,共 5 项”。不会发送提示词。
Inputs: no named parameters.
chatgpt_browser_lifecycleA
读取专用 ChatGPT 浏览器的常驻状态。MCP 调用结束后浏览器会继续保持打开,后续调用直接接管,不重复进站。
Inputs: no named parameters.
chatgpt_capabilitiesA
一次读取当前模式、模型、思考强度、临时状态和少量可见历史摘要;用于确需综合预检时,避免连续调用多个状态工具。不会展开模型或思考强度子菜单。
Inputs: historyLimit.
chatgpt_circuit_breaker_statusA
只读取本地安全熔断和未确认生成任务状态,不访问 ChatGPT 网页。
Inputs: no named parameters.
chatgpt_clear_circuit_breakerA
仅在用户已经人工确认 ChatGPT 限流提示消失后,清除本地安全熔断。不会访问网页。
Inputs: confirmed (required).
chatgpt_close_browserA
明确关闭 ChatGPT MCP 的专用常驻浏览器。仅在用户明确要求关闭时调用。
Inputs: no named parameters.
chatgpt_get_latest_responseB
读取当前 ChatGPT 对话最近一条完整回复和对话状态。默认不为状态展示额外展开高级菜单。
Inputs: includeSettings.
chatgpt_list_historyA
列出 ChatGPT 侧栏当前加载的历史对话,可按标题筛选。返回 title、conversationId 和 URL。
Inputs: limit, query.
chatgpt_list_modelsA
按“当前档位→高级→模型”的页面层级,动态列出当前 ChatGPT 账号实际可用的模型。不要猜测模型名称。
Inputs: no named parameters.
chatgpt_list_modesA
列出 ChatGPT 新版页面顶部当前可用的模式,例如“聊天”和“工作”。
Inputs: no named parameters.
chatgpt_list_thinking_levelsA
按“当前档位→高级→思考强度”的页面层级,列出账号实际可用的思考强度。
Inputs: no named parameters.
chatgpt_network_diagnosticsA
读取本地脱敏网络异常记录。只包含时间、方法、脱敏路径、状态码和资源类型;不含查询参数、Cookie、请求体或响应体。
Inputs: limit.
chatgpt_new_chatB
创建新的普通或临时对话,并可同时选择模式、模型、思考强度和能力档位。
Inputs: mode, model, temporary, answerTier, +1 more.
chatgpt_probe_pro_identityA
执行 Pro 身份探针:默认优先复用 30 分钟内同模式的可靠结果;没有缓存时才新建临时对话、切到“Pro”、发送“你是什么模型?”并无限等待。返回原回答及配置的接受/回退/unknown 分类,不创建正常对话。
Inputs: mode, force.
chatgpt_route_new_chatA
按可配置策略新建并发送:普通请求使用“极高”;明确请求 Pro 时先执行临时身份探针,命中“gpt-5.6-pro”才在正常对话继续使用“Pro”,命中“gpt-5.5-mini”则回退默认档位,其他回答停止。浏览器始终常驻。
Inputs: prompt (required), mode, wait, files, +3 more.
chatgpt_search_historyA
使用 ChatGPT 网页自带的“搜索聊天”界面查找历史对话,因此不受侧栏当前加载数量限制。返回 title、conversationId 和 URL。
Inputs: query (required), limit.
chatgpt_select_answer_tierA
选择输入框右侧的能力档位。当前支持精确选择配置的最高档“Pro”,并校验页面显示结果。
Inputs: answerTier (required).
chatgpt_select_historyA
通过 conversationId、ChatGPT /c/... URL 或唯一标题打开历史对话,并返回最近一条回答。优先使用 ID。
Inputs: url, title, conversationId.
chatgpt_select_modeA
选择 ChatGPT 新版页面顶部模式,例如“聊天”或“工作”,并校验选中状态。
Inputs: mode (required).
chatgpt_select_modelA
按“当前档位→高级→模型”选择当前对话使用的模型,并校验结果。
Inputs: model (required).
chatgpt_select_thinking_levelA
选择 ChatGPT 网页当前对话的思考强度,并校验页面显示的结果。
Inputs: thinkingLevel (required).
chatgpt_send_messageA
组合工具:可新建或继续对话、选择模式/模型/思考强度/能力档位、切换临时对话、上传文件、写入提示词、发送并取得回答。能力档位为“Pro”或模型名称带 Pro 时自动无限等待;普通档位仍使用 timeoutMs。只有用户明确要求上传时才传 files。
Inputs: prompt (required), mode, wait, files, +6 more.
chatgpt_set_temporaryA
开启或关闭新对话的临时对话模式,并通过页面状态进行校验。切换可能会打开一个新对话。
Inputs: enabled (required).
chatgpt_statusA
检查专用浏览器、登录、当前对话、模式与临时对话状态。仅在诊断或确需状态时调用;正常发送无需预先调用。默认不展开高级菜单。
Inputs: includeSettings.
chatgpt_submit_promptB
发送当前输入框中的提示词,并可等待 ChatGPT 网页回答完成。当前能力档位为“Pro”或模型名称带 Pro 时自动无限等待,timeoutMs 仅用于普通档位。
Inputs: wait, timeoutMs.
chatgpt_upload_filesA
向当前 ChatGPT 对话上传用户明确授权的本地文件。路径必须是绝对路径。不会自动发送提示词。
Inputs: files (required).
chatgpt_write_promptA
把提示词准确写入 ChatGPT 网页输入框但不发送,适合先上传文件或让用户检查草稿。
Inputs: prompt (required), append.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 27 tools
Several tools overlap significantly: chatgpt_status and chatgpt_capabilities both report current mode/model/thinking state, and composite tools like chatgpt_send_message overlap with chatgpt_write_prompt, chatgpt_submit_prompt, and chatgpt_new_chat. An agent must carefully parse descriptions to pick the right tool, and misselection is likely.
Most tools follow a chatgpt_<verb>_<noun> pattern (list_models, select_model, submit_prompt), but several use noun-only or noun+noun forms (chatgpt_status, chatgpt_capabilities, chatgpt_browser_lifecycle). The overall snake_case prefix is consistent, but the mixed verb/noun styles create a noticeable deviation.
With 27 tools, the server exceeds the 25-tool threshold for 'too many'. Many status and configuration tools could be consolidated into fewer, more comprehensive operations without losing functionality, making the surface feel heavier than necessary.
The tool set covers the full ChatGPT web workflow: listing and selecting modes/models/thinking/tier, composing and sending messages, uploading files, managing history, and browser lifecycle. Minor gaps like editing or deleting conversations exist, but they are not critical for core usage and can be worked around.
Maintenance
Related MCP Connectors
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Hosted Web Crawler MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Free WhatsApp MCP server for ChatGPT and Claude: read and search chats, every send you approve.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA self-hosted MCP server that brings a Codex-style coding workflow to ChatGPT, allowing it to read, edit, search, and run code in your local projects.MIT
- FlicenseNot gradedqualityCmaintenanceAn unofficial self-hosted MCP server that enables ChatGPT to run commands on your computer through a secure tunnel, manage processes, and work within a specified project directory.1-
- AlicenseNot gradedqualityBmaintenanceAn MCP server that bridges ChatGPT Web Pro to local tools, enabling file read/write, shell command execution, git operations, and search within a specified project directory.31MIT
- AlicenseAqualityCmaintenanceMCP server that turns ChatGPT Web or any MCP client into a coding agent on your own repositories, enabling file editing, command execution, testing, and git workflow without an OpenAI API key.272,219 npm4MIT