mcp-chatgpt
mcp-chatgpt
一个MCP(模型上下文协议)服务器,允许AI助手(如Google Antigravity、Claude Desktop、Cursor、VS Code Cline/Roo Code)通过浏览器自动化、Chrome配置文件和配套的Chrome扩展,直接向ChatGPT Web(https://chatgpt.com)提问、聊天和交互。
🌟 功能特性
💬 提问与聊天:无缝向ChatGPT Web提问并接收回复(格式化文本/ Markdown)。
🌐 网页搜索开关:启用ChatGPT的实时网页搜索(
web_search: true),实现实时网页浏览和引用。🧠 推理与模型选择:选择模型(
model: "o3-mini"、"gpt-4o"、"o1")并配置推理强度(reasoning_effort: "high" | "medium" | "low")。📎 文件与图片附件:附加图片(
image_paths)和文档/代码(file_paths)进行多模态分析。⏩ 自动继续输出:当长答案被截断时,自动点击“继续生成”/“สร้างต่อ”。
💻 代码提取:使用
extract_code_only: true仅提取并返回代码块。👤 Chrome配置文件选择器:自动检测计算机上的所有Google Chrome配置文件(Default、Profile 1、Work、Personal、邮箱),让您选择要与哪个账户聊天。
🧩 配套Chrome扩展:包含
extension/目录下的Manifest V3扩展,可加载到任何Chrome配置文件中,实时与ChatGPT标签页聊天,避免配置文件锁定问题。🔄 对话管理:使用对话ID/URL开始新聊天或继续现有线程。
💾 持久会话:在本地保存浏览器配置文件和登录Cookie,只需登录一次。
🖥️ 有头与无头模式:在后台静默运行(无头模式)或启动可见窗口(
--login/--headed)进行初始认证或验证码解决。🔌 Chrome CDP支持:通过
--remote-debugging-port连接到已运行的Google Chrome实例。🧰 工作区工具:使用跨平台的
shell_command和根目录限定的apply_patch工具搜索文件、运行构建/测试和编辑代码。🌐 远程MCP隧道:可选的Streamable HTTP端点,支持Bearer认证,用于Cloudflare Tunnel/ngrok或其他HTTPS隧道。
Related MCP server: agentify-desktop
🛠️ 提供的MCP工具
工具 | 参数 | 描述 |
|
| 在配置的根目录下使用工作目录运行命令。在Windows上自动选择PowerShell,在Linux/macOS上自动选择Bash。 |
|
| 使用结构化补丁在配置的shell根目录下添加、更新、删除或移动文件。 |
|
| 向ChatGPT Web发送提示/问题,支持高级控制并返回助手回复。 |
| 无 | 重新加载并刷新当前ChatGPT Web页面,以从卡死状态或连接故障中恢复。 |
| 无 | 列出该账户所有可用的AI模型(GPT-5.6 Sol、GPT-5.5、o3、GPT-4o、o1)和推理强度选项。 |
|
| 直接从ChatGPT侧边栏列出最近的对话主题和ID,用于搜索或恢复聊天。 |
| 无 | 列出此计算机上所有检测到的Google Chrome配置文件,包括配置文件ID、名称和邮箱。 |
|
| 选择并切换活动的Chrome配置文件(按ID如 |
| 无 | 在ChatGPT Web上开始新的聊天会话。 |
| 无 | 获取浏览器状态、活动配置文件、桥接状态、当前URL和活动模型。 |
|
| 在可见浏览器窗口中打开ChatGPT Web进行登录。 |
🚀 快速开始
[!WARNING]
shell_command可以以与MCP服务器相同的操作系统权限执行任意命令。--shell-root限制其可选的起始工作目录,但它不是操作系统沙箱。在连接不受信任的客户端时,请以受限用户身份或容器中运行服务器。apply_patch确实会强制所有更改的路径保持在--shell-root下。
远程MCP隧道
本地stdio仍然是默认方式。要暴露远程兼容的MCP端点,请使用令牌启动HTTP模式:
mcp-chatgpt --http --http-token "change-this-token"端点为http://127.0.0.1:8787/mcp。在其前面放置一个隧道,例如:
cloudflared tunnel --url http://127.0.0.1:8787使用以/mcp结尾的公共隧道URL和Authorization: Bearer change-this-token头配置远程MCP客户端。/healthz可用于隧道健康检查。如果此进程或隧道停止,远程MCP请求将不可用。
1. 安装与构建
# Clone the repository
git clone https://github.com/JonusNattapong/mcp-chatgpt.git
cd mcp-chatgpt
# Install dependencies and Chromium
npm install
npx playwright install chromium
# Build TypeScript
npm run build
# Install the MCP command globally
npm install -g .安装后,使用以下命令验证:
mcp-chatgpt --help该包在安装过程中会自动运行npm run build,因此从本地检出安装时,全局命令始终使用当前的TypeScript源代码。
👤 使用Chrome配置文件(2种方式)
选项 1:Chrome 配置文件自动检测(直接 / 无头模式)
您可以通过其文件夹名称(例如 Default、Profile 1)、显示名称或电子邮件选择系统中的任何 Chrome 配置文件:
# List all Chrome profiles in your system
node -e "import('./dist/profile-manager.js').then(m => console.table(m.ProfileManager.listProfiles()))"
# Login with a specific profile
node dist/index.js --login --profile "Profile 1"或者直接在 chatgpt_ask 工具中传递 profile 参数!
选项 2:配套 Chrome 扩展(推荐用于活跃使用)
如果您日常使用已登录的 Google Chrome 配合 ChatGPT 账户,请安装配套扩展:
使用您所需的配置文件打开 Google Chrome。
导航至
chrome://extensions。启用开发者模式(右上角)。
点击加载已解压的扩展程序,然后选择
d:\Projects\Github\mcp-chatgpt\extension文件夹。点击工具栏中的扩展图标,设置您的配置文件标签(例如“工作账户”),然后点击保存并连接。
当
mcp-chatgpt运行时,它将直接通过您的 Chrome 标签页路由提示!
⚙️ MCP 客户端配置
您可以将 mcp-chatgpt 连接到任何支持模型上下文协议(MCP)的 AI 客户端:
1. Antigravity IDE / Gemini CLI
文件位置:~/.gemini/config/mcp_config.json(Windows:C:\Users\<User>\.gemini\config\mcp_config.json)
{
"mcpServers": {
"chatgpt": {
"command": "node",
"args": [
"d:/Projects/Github/mcp-chatgpt/dist/index.js"
]
}
}
}2. Claude Desktop
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"chatgpt": {
"command": "node",
"args": [
"d:/Projects/Github/mcp-chatgpt/dist/index.js"
]
}
}
}3. Cursor IDE
添加到项目的 .cursor/mcp.json 或 Cursor 设置 > 功能 > MCP:
{
"mcpServers": {
"chatgpt": {
"command": "node",
"args": [
"d:/Projects/Github/mcp-chatgpt/dist/index.js"
]
}
}
}4. VS Code(Cline / Roo Code / Roo Clinic)
文件位置:
Cline:
%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.jsonRoo Code:
%APPDATA%\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\cline_mcp_settings.json
{
"mcpServers": {
"chatgpt": {
"command": "node",
"args": [
"d:/Projects/Github/mcp-chatgpt/dist/index.js"
],
"disabled": false,
"autoApprove": []
}
}
}5. Windsurf Editor(Codeium)
文件位置:~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"chatgpt": {
"command": "node",
"args": [
"d:/Projects/Github/mcp-chatgpt/dist/index.js"
]
}
}
}6. Zed Editor
添加到 ~/.config/zed/settings.json:
{
"context_servers": {
"chatgpt": {
"command": {
"path": "node",
"args": ["d:/Projects/Github/mcp-chatgpt/dist/index.js"]
}
}
}
}7. LibreChat(librechat.yaml)
添加到 librechat.yaml:
mcpServers:
chatgpt:
type: stdio
command: node
args:
- d:/Projects/Github/mcp-chatgpt/dist/index.js8. 通过 Cloudflare 隧道远程连接(远程 URL / SSE / mcp-remote)
如果您的 ChatGPT 浏览器或桥接服务器运行在家庭电脑或 VPS 上,并且您希望其他机器/笔记本电脑上的 AI 客户端通过互联网安全地连接到它,请使用 Cloudflare 隧道:
步骤 A:在主机上暴露桥接服务器
# Start Cloudflare Quick Tunnel (Free, no account required)
cloudflared tunnel --url http://127.0.0.1:18999这将生成一个公共 HTTPS URL,例如:
https://alpha-bravo-charlie.trycloudflare.com
步骤 B:在远程机器上配置客户端
1. Antigravity / Gemini CLI(远程 SSE / URL)
添加到 ~/.gemini/config/mcp_config.json:
{
"mcpServers": {
"chatgpt-remote": {
"serverUrl": "https://alpha-bravo-charlie.trycloudflare.com/sse"
}
}
}2. Cursor IDE(远程 SSE)
添加到 .cursor/mcp.json 或 Cursor 设置:
{
"mcpServers": {
"chatgpt-remote": {
"url": "https://alpha-bravo-charlie.trycloudflare.com/sse"
}
}
}3. VS Code Cline / Roo Code(远程 SSE)
添加到 cline_mcp_settings.json:
{
"mcpServers": {
"chatgpt-remote": {
"url": "https://alpha-bravo-charlie.trycloudflare.com/sse",
"type": "sse",
"disabled": false,
"autoApprove": []
}
}
}4. Claude Desktop / 任何仅接受 command(stdio)的客户端(通过 mcp-remote)
对于仅接受 command(stdio)的客户端,请使用 mcp-remote 桥接 Cloudflare 隧道 URL:
{
"mcpServers": {
"chatgpt-remote": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://alpha-bravo-charlie.trycloudflare.com/sse"
]
}
}
}5. LibreChat(librechat.yaml)
mcpServers:
chatgpt-remote:
type: sse
url: https://alpha-bravo-charlie.trycloudflare.com/sse6. 直接 HTTP REST API(cURL / Python / Node.js)
您还可以通过 Cloudflare 直接与桥接端点交互:
# Query status
curl -s https://alpha-bravo-charlie.trycloudflare.com/status
# Ask a question
curl -X POST https://alpha-bravo-charlie.trycloudflare.com/ask \
-H "Content-Type: application/json" \
-d '{"message": "Hello from Cloudflare Tunnel!"}'📖 CLI 选项
Usage: mcp-chatgpt [options]
Options:
--headed Run browser in headed (visible) mode (default: false)
--login Open browser in interactive mode to log in to ChatGPT
--profile <name_or_id> Select specific Chrome Profile (e.g. "Default", "Profile 1", or Name/Email)
--chrome Use installed Google Chrome browser (default: true)
--no-chrome Use Playwright bundled Chromium instead of Google Chrome
--user-data-dir <path> Custom browser profile directory
--cdp <endpoint> Connect to an existing Chrome browser via CDP endpoint
--bridge-port <port> Port for Chrome Extension bridge WebSocket (default: "18999")
--bridge-only Run only the Chrome Extension WebSocket bridge server
--shell-root <path> Restrict shell and patch tools to this directory (default: current directory)
--shell-max-timeout <ms> Maximum shell command timeout in milliseconds (default: "300000")
--http Expose an MCP Streamable HTTP endpoint for a tunnel/remote client
--http-host <host> HTTP bind host (default: "127.0.0.1")
--http-port <port> HTTP port for the MCP endpoint (default: "8787")
--http-token <token> Bearer token required by remote MCP clients (or MCP_HTTP_TOKEN)
--timeout <ms> Default timeout in milliseconds (default: "120000")
-h, --help Display help for command🌟 实时记忆与上下文保留演示
以下是通过 mcp-chatgpt 执行的真实、未经编辑的多轮交互会话:
第 1 轮:在新会话中设置上下文(new_chat: true)
请求:
{
"message": "สวัสดีครับ ผมชื่อ โจ๊กเกอร์ เป็น Software Architect ชอบเขียน Go และ TypeScript กำลังพัฒนาโปรเจกต์ชื่อ MCP-ChatGPT ฝากจำข้อมูลนี้ไว้หน่อยนะครับ ตอบสั้นๆ 1 ประโยคยืนยัน",
"new_chat": true
}ChatGPT 响应:
“จำไว้แล้วครับ: คุณชื่อโจ๊กเกอร์ เป็น Software Architect ชอบ Go และ TypeScript และกำลังพัฒนาโปรเจกต์ MCP-ChatGPT ครับ”
URL:
https://chatgpt.com/c/6a86843c-8f30-83ec-b064-d27f7f832244
第 2 轮:后续记忆回忆(conversation_id)
请求:
{
"message": "ไหนลองทบทวนดูซิว่า ผมชื่ออะไร ชอบเขียนภาษาอะไร และกำลังทำโปรเจกต์ชื่ออะไรอยู่?",
"conversation_id": "6a86843c-8f30-83ec-b064-d27f7f832244"
}ChatGPT 响应(6 秒内回忆):
“คุณชื่อ โจ๊กเกอร์ ชอบเขียน Go และ TypeScript และกำลังพัฒนาโปรเจกต์ชื่อ MCP-ChatGPT อยู่ครับ 🫡”
🤖 AI 助手系统提示词与集成指令
将以下指令直接复制粘贴到您的 AI 助手中(Cursor Rules、Claude 系统提示词、Antigravity 自定义指令、Cline、Roo Code),以便您的 AI 自动知道何时以及如何调用 mcp-chatgpt:
# 🛠️ Instruction: Setup and Integrate `mcp-chatgpt` MCP Server
You are integrated with the `mcp-chatgpt` MCP server, granting you direct access to ChatGPT Web capabilities (o3-mini, o1, GPT-4o, live Web Search, DALL-E, and multimodal file analysis).
### 🎯 When to Automatically Use `chatgpt_ask`:
1. **Deep Reasoning & Hard Coding Tasks**:
- For complex architecture designs, difficult debugging, or advanced algorithms, call `chatgpt_ask` with:
`{ "model": "o3-mini", "reasoning_effort": "high", "extract_code_only": true }`
2. **Live Web Information & Current News**:
- When the user asks for up-to-date news, today's market data, or the latest documentation of newly updated packages, call:
`{ "web_search": true }`
3. **Image Generation (DALL-E 3)**:
- When the user requests an image, logo, or icon design, request it via `chatgpt_ask` and present the returned `imageUrls` directly to the user.
4. **Heavy Document & File Analysis**:
- When analyzing CSV, Excel spreadsheets, PDFs, or large source code files, attach them via `file_paths` or `image_paths`.
5. **Continuous Conversations**:
- Always track and pass `conversation_id` to continue in the same thread, or pass `new_chat: true` when starting an unrelated topic.
6. **Finding Past Chats**:
- Call `chatgpt_list_conversations` to search for existing topic IDs before resuming a specific past conversation.📄 许可证
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceAn MCP Server that enables AI assistants to interact with your local browsers.2,67954MIT

agentify-desktopofficial
AlicenseNot gradedqualityBmaintenanceMCP server that enables AI tools to control local browser sessions for ChatGPT, Claude, and other AI services, supporting querying, navigation, file uploads, and artifact management.65529Mozilla Public 2.0- AlicenseAqualityDmaintenanceA MCP server that gives AI assistants full browser control, enabling navigation, clicking, form filling, and screenshots via any MCP client.8MIT
- AlicenseNot gradedqualityFmaintenanceMCP server that drives chatgpt.com via web UI automation using a session token, enabling long-running tasks, deep research, and image generation.212MIT
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server for AI dialogue using various LLM models via AceDataCloud
MCP server for Gainium — manage trading bots, deals, and balances via AI assistants
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/JonusNattapong/mcp-chatgpt'
If you have feedback or need assistance with the MCP directory API, please join our Discord server