mcp-chatgpt
mcp-chatgpt
An MCP (Model Context Protocol) server that allows AI assistants (such as Google Antigravity, Claude Desktop, Cursor, VS Code Cline/Roo Code) to ask questions, chat, and interact with ChatGPT Web (https://chatgpt.com) directly through browser automation, Chrome Profiles, and a companion Chrome Extension.
🌟 特徴
💬 質問とチャット: ChatGPT Web にシームレスに質問し、応答(フォーマット済みテキスト / Markdown)を受け取ります。
🌐 Web検索トグル: ChatGPTのライブWeb検索(
web_search: true)を有効にして、リアルタイムのWeb閲覧と引用を可能にします。🧠 推論とモデル選択: モデル(
model: "o3-mini"、"gpt-4o"、"o1")を選択し、推論努力(reasoning_effort: "high" | "medium" | "low")を設定します。📎 ファイルと画像の添付: マルチモーダル分析のために画像(
image_paths)やドキュメント/コード(file_paths)を添付します。⏩ 自動継続出力: 長い回答が途中で切れた場合に「Continue generating」/「สร้างต่อ」を自動的にクリックします。
💻 コード抽出:
extract_code_only: trueでコードブロックのみを抽出して返します。👤 Chromeプロファイルセレクター: コンピューター上のすべてのGoogle Chromeプロファイル(Default、Profile 1、Work、Personal、メールアドレス)を自動検出し、どのアカウントでチャットするかを選択できます。
🧩 付属のChrome拡張機能:
extension/にManifest V3拡張機能が含まれており、任意のChromeプロファイルに読み込んで、プロファイルロックの問題なしにChatGPTタブとリアルタイムでチャットできます。🔄 会話管理: 会話ID / URLを使用して、新しいチャットを開始したり、既存のスレッドを続行したりできます。
💾 永続セッション: ブラウザプロファイルとログインCookieをローカルに保存するため、ログインは一度だけです。
🖥️ ヘッド付き&ヘッドレスモード: バックグラウンドで静かに実行(ヘッドレス)するか、初期認証やCAPTCHA解決のために可視ウィンドウ(
--login/--headed)を起動します。🔌 Chrome CDPサポート:
--remote-debugging-portを介して、すでに実行中のGoogle Chromeインスタンスに接続します。🧰 ワークスペースツール: クロスプラットフォームの
shell_commandとルート制限付きapply_patchツールを使用して、ファイルの検索、ビルド/テストの実行、コードの編集ができます。🌐 リモートMCPトンネル: Cloudflare Tunnel/ngrokまたは別のHTTPSトンネル向けに、Bearer認証付きのオプションのStreamable HTTPエンドポイント。
Related MCP server: agentify-desktop
🛠️ 提供されるMCPツール
ツール | パラメーター | 説明 |
|
| 設定されたルートの下の作業ディレクトリでコマンドを実行します。WindowsではPowerShell、Linux/macOSではBashを自動選択します。 |
|
| 構造化パッチを使用して、設定されたシェルルートの下でファイルを追加、更新、削除、または移動します。 |
|
| 高度なコントロールを使用してChatGPT Webにプロンプト/質問を送信し、アシスタントの応答を返します。 |
| なし | 現在のChatGPT Webページをリロードして更新し、スタック状態や接続の不具合から回復します。 |
| なし | このアカウントで利用可能なすべてのAIモデル(GPT-5.6 Sol、GPT-5.5、o3、GPT-4o、o1)と推論努力オプションを一覧表示します。 |
|
| ChatGPTサイドバーから最近の会話トピックとIDを直接一覧表示して、チャットを検索または再開します。 |
| なし | このコンピューター上で検出されたすべてのGoogle Chromeプロファイルを、プロファイルID、名前、メールアドレスとともに一覧表示します。 |
|
| アクティブなChromeプロファイルを選択して切り替えます( |
| なし | ChatGPT Webで新しいチャットセッションを開始します。 |
| なし | ブラウザのステータス、アクティブなプロファイル、ブリッジのステータス、現在のURL、アクティブなモデルを取得します。 |
|
| ログインするために、ChatGPT Webを可視のブラウザウィンドウで開きます。 |
🚀 クイックスタート
[!WARNING]
shell_commandは、MCPサーバーと同じオペレーティングシステム権限で任意のコマンドを実行できます。--shell-rootは選択可能な開始作業ディレクトリを制限しますが、OSサンドボックスではありません。信頼できないクライアントを接続する場合は、制限されたユーザーまたはコンテナー内でサーバーを実行してください。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クライアントを、/mcp で終わる公開トンネルURLとヘッダー Authorization: Bearer change-this-token で構成します。/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拡張機能(アクティブなChromeに推奨)
すでにログイン済みのChatGPTアカウントでGoogle Chromeを日常的に使用している場合は、コンパニオン拡張機能をインストールしてください:
目的のプロファイルでGoogle Chromeを開きます。
chrome://extensionsに移動します。デベロッパーモード(右上)を有効にします。
パッケージ化されていない拡張機能を読み込むをクリックし、
d:\Projects\Github\mcp-chatgpt\extensionフォルダを選択します。ツールバーの拡張機能アイコンをクリックし、プロファイルタグ(例:「勤務先アカウント」)を設定して、保存して接続をクリックします。
mcp-chatgptが実行されると、プロンプトがChromeタブを介して直接ルーティングされます!
⚙️ MCPクライアントの設定
mcp-chatgptは、Model Context Protocol(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 Tunnelによるリモート接続(リモートURL / SSE / mcp-remote)
ChatGPTブラウザまたはブリッジサーバーが自宅のコンピューターやVPSで実行されており、他のマシン/ラップトップ上のAIクライアントがCloudflare Tunnelを介してインターネット経由で安全に接続したい場合は、次の手順に従います:
ステップ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 / 任意のstdioクライアント(mcp-remote経由)
command(stdio)のみを受け付けるクライアントの場合は、mcp-remoteを使用してCloudflare Tunnel 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 System Prompt、Antigravity Custom Instructions、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
Available Tools
12 toolsapply_patchA
Safely add, update, delete, or move files inside the configured shell root using an *** Begin Patch / *** End Patch patch. Prefer this over shell redirection for code edits.
Inputs: patch (required).
chatgpt_askB
Send a question or prompt to ChatGPT Web (chatgpt.com) and get the assistant response. Supports Web Search, o1/o3-mini reasoning, model selection, code extraction, image/file attachments, and Chrome profiles.
Inputs: message (required), model, profile, new_chat, +9 more.
chatgpt_get_latest_responseA
Fetch and recover the latest assistant response (including text, code blocks, and images) from the current or specified conversation without asking a new question. Useful after recovering from a timeout or reload.
Inputs: refresh_first, conversation_id.
chatgpt_get_statusA
Get the current status of ChatGPT Web automation (initialized, logged in, active profile, extension bridge status, current conversation URL, title, model).
Inputs: no named parameters.
chatgpt_list_conversationsA
List recent conversation history topics and IDs from the ChatGPT sidebar so you can select and resume any previous chat.
Inputs: limit.
chatgpt_list_modelsA
List all available AI models (e.g. GPT-5.6 Sol, GPT-5.5, o3, gpt-4o, o1) and reasoning effort options for this ChatGPT account.
Inputs: no named parameters.
chatgpt_list_profilesA
List all detected Google Chrome profiles available on this machine (including Profile Folder ID, Display Name, Email).
Inputs: no named parameters.
chatgpt_loginA
Open ChatGPT Web in a visible (headed) browser window so the user can log in or solve Captcha challenges.
Inputs: profile.
chatgpt_new_chatA
Start a clean/new conversation on ChatGPT Web.
Inputs: no named parameters.
chatgpt_reloadA
Reload and refresh the current ChatGPT Web page to fix stuck conversations or connection glitches.
Inputs: no named parameters.
chatgpt_select_profileA
Select which Chrome profile to use for ChatGPT Web automation (by Profile Folder ID, Display Name, or Email).
Inputs: profile (required).
shell_commandA
Run a command with a working directory inside the configured shell root. Uses PowerShell on Windows and Bash on Linux/macOS by default. The command has the same OS permissions as this MCP server.
Inputs: command (required), shell, workdir, timeout_ms.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
The ChatGPT tools mostly map to distinct lifecycle stages, such as selecting a profile, asking a question, reloading the page, and fetching status. The main potential confusions are shell_command vs apply_patch for file operations and chatgpt_ask vs chatgpt_get_latest_response for retrieving assistant output, though the descriptions provide reasonable separation.
The 10 chatgpt_* tools consistently use a readable, mostly verb-first style with a common prefix. Two tools, shell_command and apply_patch, break away from the chatgpt_ prefix and use different naming conventions, which makes the overall set slightly inconsistent.
With 12 tools, the count is reasonable, and most tools are clearly relevant to ChatGPT Web automation. The shell_command and apply_patch pair broadens the server beyond ChatGPT-specific tasks, feeling slightly like an additional generic toolkit rather than a core part of the same domain.
The core ChatGPT Web workflow is covered well: profile selection, login/status, starting a chat, asking questions, recovering responses, listing conversations, listing models, and reloading. Obvious gaps are conversation management actions such as delete or rename, and there is no explicit tool name for select/resume a previous conversation, though this may be handled through parameters in ask or get_latest_response.
Related MCP Connectors
MCP server that lets your AI assistant build and deploy apps, hosting each one at a live URL.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
MCP server for AI dialogue using various LLM models via AceDataCloud
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceAn MCP Server that enables AI assistants to interact with your local browsers.56MIT

agentify-desktopofficial
AlicenseNot gradedqualityDmaintenanceMCP 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.572Mozilla 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
- AlicenseBqualityFmaintenanceMCP server that drives chatgpt.com via web UI automation using a session token, enabling long-running tasks, deep research, and image generation.9113 npm2MIT