chatgpt-mcp

chatgpt-mcp

Bridges Cursor IDE Agent with ChatGPT Web for external reasoning, research, and review.

Category
访问服务器

README

chatgpt-mcp

Status: macOS developer preview (not production). Unofficial — not affiliated with OpenAI or Cursor.

Bridge Cursor IDE Agent with ChatGPT Web for external reasoning, research, and review — without scraping ChatGPT output.

Cursor create_task → SQLite → Browser worker (CDP attach) types TASK_ID →
ChatGPT get_task / submit_result via MCP → Cursor stop hook resumes → get_result

See docs/spec.md for the full specification. See docs/architecture.md for how MCP and this handoff flow work.

Prerequisites

  • macOS + Node.js 22.5+ (uses the built-in node:sqlite module)
  • Python 3 (for Cursor hooks in this repo)
  • Google Chrome with CDP on a dedicated user-data-dir (see below). Chrome 136+ will not honor --remote-debugging-port on your daily Default profile.
  • ChatGPT account with Developer Mode + MCP write where your plan/workspace allows it (Plus may be read-only — check current OpenAI docs)

Quick Start

npm install
npm run build
npm run setup          # creates ~/.chatgpt-mcp + prints Cursor MCP JSON
# edit .env → set CHATGPT_WORKER_URL

./scripts/start-chrome-cdp.sh   # login ChatGPT in THAT window
npm run remote-mcp              # + HTTPS tunnel for ChatGPT connector
npm run worker
npm run check                   # preflight

Paste the JSON from npm run setup into ~/.cursor/mcp.json, then reload Cursor MCP.

Limitations (read before opening issues)

  • macOS-only preview; Windows/Linux not supported yet
  • One user, one dedicated Chrome profile, one worker chat, one concurrent handoff
  • No login/CAPTCHA/approval automation; UI selectors can break when ChatGPT changes
  • Do not send sensitive code over an unauthenticated public tunnel — prefer Secure MCP Tunnel; ngrok is a fallback for non-sensitive evaluation only
  • Transport canary (local): 10/10 consecutive PASS observed; full ≥18/20 gate optional for release claims

Use from other Cursor conversations

  • MCP: ~/.cursor/mcp.json → server chatgpt-mcp (paths from npm run setup)
  • Skill: ~/.cursor/skills/chatgpt-mcp/SKILL.md (/chatgpt-mcp)
  • Rule: ~/.cursor/rules/chatgpt-mcp.mdc

Reload Cursor MCP once after changing ~/.cursor/mcp.json. Worker must still be running (npm run worker).

Say: handoff sang ChatGPT: <câu hỏi> or chạy task ChatGPT: <prompt>. The agent calls handoff_create_task, polls status, then handoff_get_result.

First-Time ChatGPT Setup

  1. Run ./scripts/start-chrome-cdp.sh (dedicated $HOME/chrome-chatgpt-debug). Do not point --user-data-dir at ~/Library/Application Support/Google/Chrome.
  2. Log into ChatGPT manually in that window (no automation). Daily Chrome stays untouched and cannot be attached.
  3. Enable Developer Mode in ChatGPT settings.
  4. Connect the remote MCP server (Secure MCP Tunnel or HTTPS tunnel → npm run remote-mcp on :8790/mcp).
  5. Open/create the worker conversation and copy its URL into CHATGPT_WORKER_URL.
  6. Paste the worker instructions from docs/spec.md §17.
  7. Run npm run worker — it attaches via CDP and navigates to that URL.
  8. Test handoff_get_task / handoff_submit_result; approve MCP write for the conversation.

The worker never launches a dedicated Playwright profile and never automates login. If the attached Chrome is logged out, it fails with SESSION_NOT_READY.

MCP Tools

Tool Caller Purpose
handoff_create_task Cursor Create a handoff task
handoff_get_result Cursor Fetch completed result
handoff_get_task_status Both Poll task status
handoff_get_task ChatGPT Fetch task context
handoff_submit_result ChatGPT Submit reasoning result

Processes

Command Description
npm run setup Create ~/.chatgpt-mcp + print Cursor MCP JSON
npm run check Preflight (Node, build, CDP, worker, remote MCP)
npm run mcp MCP stdio server (Cursor spawns this)
npm run worker HTTP API (:8787) + CDP dispatcher
npm run http HTTP status API only
npm run remote-mcp HTTP MCP for ChatGPT (:8790/mcp)
npm run e2e:reliability Transport canary (--runs=N)
make handoff-zip Zip source for ChatGPT review

Cursor Integration

  • Project rule: .cursor/rules/chatgpt-mcp.mdc
  • User rule / skill (every workspace): ~/.cursor/rules/chatgpt-mcp.mdc, ~/.cursor/skills/chatgpt-mcp/
  • Hooks (this repo only): .cursor/hooks.json
    • preToolUse: injects cursorConversationId
    • stop: polls up to 8 minutes, returns followup_message on completion
  • Other workspaces have MCP tools but no stop hook — the agent must poll handoff_get_task_status itself.

Environment Variables

See .env.example.

Key settings:

  • CHATGPT_MCP_HOME=~/.chatgpt-mcp — default DB/log root when paths unset
  • CHATGPT_CDP_ENDPOINT=http://127.0.0.1:9222 — attach to existing Chrome
  • CHATGPT_WORKER_URL=https://chatgpt.com/c/... — direct worker chat URL (required)
  • HANDOFF_HTTP_PORT=8787 — status API for stop hook / npm run check
  • HANDOFF_WAIT_TIMEOUT=480 — stop hook timeout (seconds)

Architecture Notes

  • Browser layer attaches via CDP to the Chrome listening on CHATGPT_CDP_ENDPOINT (dedicated user-data-dir). It does not use daily Chrome cookies (Chrome 136+ blocks that).
  • Playwright sends only TASK_ID=ho_... into the configured worker URL — no large context via UI.
  • ChatGPT reads full context via handoff_get_task MCP call.
  • Results flow back via handoff_submit_result → SQLite → Cursor.
  • Concurrency = 1: while a task is PROCESSING, the worker stays BUSY.
  • No CAPTCHA/approval auto-clicking; no login automation; no bundled-Chromium fallback.
  • Tasks exceeding 8 minutes may end up as READY_BUT_CURSOR_IDLE.

Logs

Structured JSON logs under $CHATGPT_MCP_HOME/logs (or LOG_DIR).

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选