Skip to main content
Glama

mcp-chatgpt

Ein MCP-Server (Model Context Protocol), der es KI-Assistenten (wie Google Antigravity, Claude Desktop, Cursor, VS Code Cline/Roo Code) ermöglicht, Fragen zu stellen, zu chatten und direkt mit ChatGPT Web (https://chatgpt.com) zu interagieren – über Browser-Automatisierung, Chrome-Profile und eine begleitende Chrome-Erweiterung.


🌟 Funktionen

  • 💬 Fragen & Chatten: Stellen Sie nahtlos Fragen an ChatGPT Web und erhalten Sie Antworten (formatierter Text / Markdown).

  • 🌐 Websuche umschalten: Aktivieren Sie die Live-Websuche von ChatGPT (web_search: true) für Echtzeit-Internetsuche und Zitate.

  • 🧠 Denken & Modellauswahl: Wählen Sie Modelle aus (model: "o3-mini", "gpt-4o", "o1") und konfigurieren Sie den Denkaufwand (reasoning_effort: "high" | "medium" | "low").

  • 📎 Datei- und Bildanhänge: Fügen Sie Bilder (image_paths) und Dokumente/Code (file_paths) für die multimodale Analyse hinzu.

  • ⏩ Automatisches Fortsetzen der Ausgabe: Klickt automatisch auf „Generieren fortsetzen" / „สร้างต่อ", falls lange Antworten abgeschnitten werden.

  • 💻 Code-Extraktion: Extrahiert und gibt nur Codeblöcke mit extract_code_only: true zurück.

  • 👤 Chrome-Profile-Auswahl: Erkennt automatisch alle Google-Chrome-Profile auf Ihrem Computer (Default, Profile 1, Work, Personal, E-Mails) und lässt Sie auswählen, mit welchem Konto Sie chatten möchten.

  • 🧩 Begleitende Chrome-Erweiterung: Enthält eine Manifest-V3-Erweiterung im Ordner extension/, die in jedes Chrome-Profil geladen werden kann, um in Echtzeit mit ChatGPT-Registerkarten zu chatten – ohne Probleme mit der Profilsperrung.

  • 🔄 Konversationsverwaltung: Starten Sie neue Chats oder setzen Sie vorhandene Threads mithilfe von Konversations-IDs / URLs fort.

  • 💾 Dauerhafte Sitzung: Speichert das Browserprofil und die Anmeldecookies lokal, sodass Sie sich nur einmal anmelden müssen.

  • 🖥️ Modi mit und ohne Fenster (Headed & Headless): Läuft still im Hintergrund (headless) oder öffnet ein sichtbares Fenster (--login / --headed) für die anfängliche Authentifizierung oder Captcha-Lösung.

  • 🔌 Chrome-CDP-Unterstützung: Stellen Sie über --remote-debugging-port eine Verbindung zu einer bereits ausgeführten Google-Chrome-Instanz her.

  • 🧰 Arbeitsbereich-Tools: Durchsuchen Sie Dateien, führen Sie Builds/Tests aus und bearbeiten Sie Code mit plattformübergreifenden shell_command- und auf das Stammverzeichnis beschränkten apply_patch-Tools.

  • 🌐 Remote-MCP-Tunnel: Optionaler Streamable-HTTP-Endpunkt mit Bearer-Authentifizierung für Cloudflare Tunnel/ngrok oder einen anderen HTTPS-Tunnel.


Related MCP server: agentify-desktop

🛠️ Bereitgestellte MCP-Tools

Tool

Parameter

Beschreibung

shell_command

command (string, erforderlich)workdir (string, optional)shell (auto|powershell|bash, optional)timeout_ms (number, optional)

Führt Befehle mit einem Arbeitsverzeichnis unter dem konfigurierten Stammverzeichnis aus. Wählt unter Windows automatisch PowerShell und unter Linux/macOS Bash aus.

apply_patch

patch (string, erforderlich)

Fügt Dateien unter dem konfigurierten Shell-Stammverzeichnis mithilfe strukturierter Patches hinzu, aktualisiert, löscht oder verschiebt sie.

chatgpt_ask

message (string, erforderlich)web_search (boolean, optional)model (string, optional)reasoning_effort ("low"|"medium"|"high", optional)image_paths (string[], optional)file_paths (string[], optional)extract_code_only (boolean, optional)auto_continue (boolean, optional)refresh_page (boolean, optional)profile (string, optional)new_chat (boolean, optional)conversation_id (string, optional)timeout_ms (number, optional)

Sendet eine Eingabe/Frage an ChatGPT Web mit erweiterten Steuerungsoptionen und gibt die Antwort des Assistenten zurück.

chatgpt_reload

Keine

Lädt die aktuelle ChatGPT-Webseite neu und aktualisiert sie, um sich von hängenden Zuständen oder Verbindungsproblemen zu erholen.

chatgpt_list_models

Keine

Listet alle verfügbaren KI-Modelle (GPT-5.6 Sol, GPT-5.5, o3, GPT-4o, o1) und Optionen für den Denkaufwand für dieses Konto auf.

chatgpt_list_conversations

limit (number, optional)

Listet aktuelle Gesprächsthemen und -IDs direkt aus der ChatGPT-Seitenleiste auf, um Chats zu durchsuchen oder fortzusetzen.

chatgpt_list_profiles

Keine

Listet alle erkannten Google-Chrome-Profile auf diesem Computer mit Profil-ID, Name und E-Mail auf.

chatgpt_select_profile

profile (string, erforderlich)

Wählt das aktive Chrome-Profil aus und wechselt es (per ID wie Profile 1, Name oder E-Mail).

chatgpt_new_chat

Keine

Startet eine neue Chat-Sitzung auf ChatGPT Web.

chatgpt_get_status

Keine

Ruft den Browserstatus, das aktive Profil, den Bridge-Status, die aktuelle URL und das aktive Modell ab.

chatgpt_login

profile (string, optional)

Öffnet ChatGPT Web in einem sichtbaren Browserfenster zur Anmeldung.


🚀 Schnellstart

[!WARNUNG] shell_command kann beliebige Befehle mit denselben Betriebssystemberechtigungen wie der MCP-Server ausführen. --shell-root begrenzt das auswählbare Startarbeitsverzeichnis, ist aber keine Betriebssystem-Sandbox. Führen Sie den Server als eingeschränkter Benutzer oder in einem Container aus, wenn Sie nicht vertrauenswürdige Clients verbinden. apply_patch stellt sicher, dass alle geänderten Pfade unter --shell-root bleiben.

Remote-MCP-Tunnel

Lokales stdio bleibt die Standardeinstellung. Um einen remote-kompatiblen MCP-Endpunkt bereitzustellen, starten Sie den HTTP-Modus mit einem Token:

mcp-chatgpt --http --http-token "change-this-token"

Der Endpunkt ist http://127.0.0.1:8787/mcp. Setzen Sie einen Tunnel davor, zum Beispiel:

cloudflared tunnel --url http://127.0.0.1:8787

Konfigurieren Sie den Remote-MCP-Client mit der öffentlichen Tunnel-URL, die auf /mcp endet, und dem Header Authorization: Bearer change-this-token. /healthz kann für einen Tunnel-Health-Check verwendet werden. Wenn entweder dieser Prozess oder der Tunnel stoppt, sind Remote-MCP-Anfragen nicht verfügbar.

1. Installieren und Erstellen

# 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 .

Nach der Installation überprüfen Sie es mit:

mcp-chatgpt --help

Das Paket führt npm run build während der Installation automatisch aus, sodass der globale Befehl bei der Installation aus einem lokalen Checkout immer den aktuellen TypeScript-Quellcode verwendet.


👤 Verwenden von Chrome-Profilen (2 Optionen)

Option 1: Automatische Chrome-Profil-Erkennung (Direkt / Headless)

Sie können jedes Chrome-Profil in Ihrem System über seinen Ordnernamen (z. B. Default, Profile 1), den Anzeigenamen oder die E-Mail-Adresse auswählen:

# 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"

Oder übergeben Sie den Parameter profile direkt an das Tool chatgpt_ask!


Option 2: Chrome-Begleiterweiterung (Empfohlen für aktiv genutztes Chrome)

Wenn Sie Google Chrome täglich mit Ihrem angemeldeten ChatGPT-Konto verwenden, installieren Sie die Begleiterweiterung:

  1. Öffnen Sie Google Chrome mit Ihrem gewünschten Profil.

  2. Navigieren Sie zu chrome://extensions.

  3. Aktivieren Sie den Entwicklermodus (oben rechts).

  4. Klicken Sie auf Entpackte Erweiterung laden und wählen Sie den Ordner d:\Projects\Github\mcp-chatgpt\extension aus.

  5. Klicken Sie in der Symbolleiste auf das Erweiterungssymbol, legen Sie Ihr Profil-Tag fest (z. B. „Work Account") und klicken Sie auf Speichern & Verbinden.

  6. Wenn mcp-chatgpt läuft, leitet es Prompts direkt über Ihren Chrome-Tab weiter!


⚙️ Konfiguration für MCP-Clients

Sie können mcp-chatgpt mit jedem KI-Client verbinden, der das Model Context Protocol (MCP) unterstützt:

1. Antigravity IDE / Gemini CLI

Dateispeicherort: ~/.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.json

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "chatgpt": {
      "command": "node",
      "args": [
        "d:/Projects/Github/mcp-chatgpt/dist/index.js"
      ]
    }
  }
}

3. Cursor IDE

Fügen Sie es in .cursor/mcp.json Ihres Projekts oder unter Cursor Settings > Features > MCP ein:

{
  "mcpServers": {
    "chatgpt": {
      "command": "node",
      "args": [
        "d:/Projects/Github/mcp-chatgpt/dist/index.js"
      ]
    }
  }
}

4. VS Code (Cline / Roo Code / Roo Clinic)

Dateispeicherort:

  • Cline: %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json

  • Roo 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)

Dateispeicherort: ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "chatgpt": {
      "command": "node",
      "args": [
        "d:/Projects/Github/mcp-chatgpt/dist/index.js"
      ]
    }
  }
}

6. Zed Editor

Fügen Sie es in ~/.config/zed/settings.json ein:

{
  "context_servers": {
    "chatgpt": {
      "command": {
        "path": "node",
        "args": ["d:/Projects/Github/mcp-chatgpt/dist/index.js"]
      }
    }
  }
}

7. LibreChat (librechat.yaml)

Fügen Sie es in librechat.yaml ein:

mcpServers:
  chatgpt:
    type: stdio
    command: node
    args:
      - d:/Projects/Github/mcp-chatgpt/dist/index.js

8. Remote-Verbindung über Cloudflare Tunnel (Remote URL / SSE / mcp-remote)

Wenn Ihr ChatGPT-Browser oder Bridge-Server auf einem Heimcomputer oder VPS läuft und Sie möchten, dass KI-Clients auf anderen Geräten/Laptops sich über das Internet sicher über Cloudflare Tunnel damit verbinden:

Schritt A: Bridge-Server auf dem Host-Rechner freigeben

# Start Cloudflare Quick Tunnel (Free, no account required)
cloudflared tunnel --url http://127.0.0.1:18999

Dadurch wird eine öffentliche HTTPS-URL generiert, zum Beispiel: https://alpha-bravo-charlie.trycloudflare.com


Schritt B: Client auf entfernten Rechnern konfigurieren

1. Antigravity / Gemini CLI (Remote-SSE / URL)

Fügen Sie es in ~/.gemini/config/mcp_config.json ein:

{
  "mcpServers": {
    "chatgpt-remote": {
      "serverUrl": "https://alpha-bravo-charlie.trycloudflare.com/sse"
    }
  }
}
2. Cursor IDE (Remote-SSE)

Fügen Sie es in .cursor/mcp.json oder den Cursor Settings ein:

{
  "mcpServers": {
    "chatgpt-remote": {
      "url": "https://alpha-bravo-charlie.trycloudflare.com/sse"
    }
  }
}
3. VS Code Cline / Roo Code (Remote-SSE)

Fügen Sie es in cline_mcp_settings.json ein:

{
  "mcpServers": {
    "chatgpt-remote": {
      "url": "https://alpha-bravo-charlie.trycloudflare.com/sse",
      "type": "sse",
      "disabled": false,
      "autoApprove": []
    }
  }
}
4. Claude Desktop / Jeder stdio-Client (über mcp-remote)

Für Clients, die nur command (stdio) akzeptieren, verwenden Sie mcp-remote, um die Cloudflare-Tunnel-URL zu überbrücken:

{
  "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/sse
6. Direkte HTTP-REST-API (cURL / Python / Node.js)

Sie können auch direkt über Cloudflare mit den Bridge-Endpunkten interagieren:

# 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-Optionen

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

🌟 Live-Demo: Interaktives Gedächtnis und Kontextbeibehaltung

Das Folgende ist eine echte, unbearbeitete interaktive Multi-Turn-Sitzung, die live über mcp-chatgpt ausgeführt wurde:

Runde 1: Kontext in einer neuen Sitzung festlegen (new_chat: true)

Anfrage:

{
  "message": "สวัสดีครับ ผมชื่อ โจ๊กเกอร์ เป็น Software Architect ชอบเขียน Go และ TypeScript กำลังพัฒนาโปรเจกต์ชื่อ MCP-ChatGPT ฝากจำข้อมูลนี้ไว้หน่อยนะครับ ตอบสั้นๆ 1 ประโยคยืนยัน",
  "new_chat": true
}

ChatGPT-Antwort:

"จำไว้แล้วครับ: คุณชื่อโจ๊กเกอร์ เป็น Software Architect ชอบ Go และ TypeScript และกำลังพัฒนาโปรเจกต์ MCP-ChatGPT ครับ"

URL: https://chatgpt.com/c/6a86843c-8f30-83ec-b064-d27f7f832244


Runde 2: Speicherabruf in der Folgesitzung (conversation_id)

Anfrage:

{
  "message": "ไหนลองทบทวนดูซิว่า ผมชื่ออะไร ชอบเขียนภาษาอะไร และกำลังทำโปรเจกต์ชื่ออะไรอยู่?",
  "conversation_id": "6a86843c-8f30-83ec-b064-d27f7f832244"
}

ChatGPT-Antwort (in 6s abgerufen):

"คุณชื่อ โจ๊กเกอร์ ชอบเขียน Go และ TypeScript และกำลังพัฒนาโปรเจกต์ชื่อ MCP-ChatGPT อยู่ครับ 🫡"


🤖 System-Prompt und Integrationsanweisung für den KI-Assistenten

Kopieren Sie die folgende Anweisung und fügen Sie sie direkt in Ihren KI-Assistenten ein (Cursor Rules, Claude System Prompt, Antigravity Custom Instructions, Cline, Roo Code), damit Ihre KI automatisch weiß, wann und wie sie mcp-chatgpt aufrufen soll:

# 🛠️ 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.

📄 Lizenz

MIT

Available Tools

12 tools
apply_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

    A3.8/5.0

    Scored across 12 tools

    Disambiguation4/5

    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.

    Naming Consistency4/5

    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.

    Tool Count4/5

    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.

    Completeness4/5

    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

    Related MCP Servers