chatgpt-webui-mcp
Provides tools for interacting with ChatGPT via its web UI, enabling AI agents to send prompts, manage conversations, generate images, and perform long-running tasks like deep research using various GPT models.
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-webui-mcp deep research on quantum computing"
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.
quick start
install from npm:
npm i -g chatgpt-webui-mcpmanual run:
CHATGPT_SESSION_TOKEN="your_token_here" chatgpt-webui-mcpfrom source:
npm install
npm run build
CHATGPT_SESSION_TOKEN="your_token_here" node dist/index.jsimportant: this uses chatgpt's internal webui api with a session cookie. for personal/local tinkering only - not affiliated with openai.
overview
chatgpt-webui-mcp is a standalone MCP server that drives chatgpt.com via camofox (UI automation).
it is built for long-running tasks (gpt-5.2 pro runs that take 1h+), deep research, and image generation mode.
getting your session token
open https://chatgpt.com and log in
open devtools
application -> cookies ->
https://chatgpt.comcopy the value of
__Secure-next-auth.session-token
configuration
because this server uses stdio or sse, you configure it as a local command (or remote url) and pass the token via env.
mcp client config (claude desktop, opencode, etc)
{
"mcpServers": {
"chatgpt-webui": {
"command": "node",
"args": ["/absolute/path/to/chatgpt-webui-mcp/dist/index.js"],
"timeout": 7200000,
"env": {
"CHATGPT_SESSION_TOKEN_FILE": "/path/to/session-token.txt",
"CHATGPT_BROWSER_BASE_URL": "http://127.0.0.1:9377",
"CHATGPT_WAIT_TIMEOUT_MS": "7200000"
}
}
}
}legacy CHATGPT_CAMOFOX_* env vars are still supported for compatibility.
CHATGPT_TRANSPORT=httpcloak is intentionally unsupported (use camofox).
when model/thinking are omitted, requests default to gpt-5-2 (auto), not pro.
opencode workflow (the natural language style)
if you want to type commands like:
with chatgpt webui on gpt 5.2 pro extended thinking: <prompt>do deepresearch with chatgpt webui on <topic>
use this tool:
tool | what it does |
| parses your sentence into the right call and runs it |
example:
{
"name": "chatgpt_webui_command",
"arguments": {
"command": "with chatgpt webui on gpt 5.2 pro extended thinking: write a 1-page memo about X",
"mode": "auto"
}
}long runs (recommended)
use the unified tools:
tool | description |
| main tool. |
| check/wait for background runs ( |
why: deep research and gpt-5.2 pro can take a long time and may exceed a single client timeout. mode=auto returns a run_id for long jobs.
image generation
set create_image=true to switch chatgpt into image generation mode before sending the prompt.
notes:
image_urlsis best-effort (derived from page links + visited urls) and may be empty depending on how chatgpt renders images in the webui.fallback screenshot output is returned in
image_data_url(notimage_urls) when enabled and size-capped.enable fallback with
CHATGPT_IMAGE_SCREENSHOT_FALLBACK=1.cap fallback size with
CHATGPT_IMAGE_SCREENSHOT_MAX_BYTES(default2097152, 2 MiB).for reliable retrieval, you can also use the conversation_id and open the chatgpt UI.
self-test
# env
CHATGPT_SESSION_TOKEN="your_token_here" npm run self-test
# cli flag
npm run self-test -- --token "your_token_here"
# file
echo "your_token_here" > ~/.config/chatgpt-webui-mcp/session-token.txt
npm run self-test -- --token-file ~/.config/chatgpt-webui-mcp/session-token.txtremote deployment over tailscale (optional)
if you want background runs to survive for a long time, run this server as an always-on SSE service.
copy templates from this repo:
deploy/systemd/chatgpt-webui-mcp.env.exampledeploy/systemd/chatgpt-webui-mcp-sse.shdeploy/systemd/chatgpt-webui-mcp.service
install and enable service (user service):
mkdir -p ~/.config ~/.config/systemd/user ~/.local/bin ~/.local/share/chatgpt-webui-mcp
cp deploy/systemd/chatgpt-webui-mcp.env.example ~/.config/chatgpt-webui-mcp.env
cp deploy/systemd/chatgpt-webui-mcp-sse.sh ~/.local/bin/chatgpt-webui-mcp-sse.sh
cp deploy/systemd/chatgpt-webui-mcp.service ~/.config/systemd/user/chatgpt-webui-mcp.service
chmod 600 ~/.config/chatgpt-webui-mcp.env
chmod 755 ~/.local/bin/chatgpt-webui-mcp-sse.sh
systemctl --user daemon-reload
systemctl --user enable --now chatgpt-webui-mcp.servicepoint opencode (cloud host) to the endpoint:
{
"mcp": {
"chatgpt-webui": {
"type": "remote",
"url": "http://<tailscale-ip>:8791/sse",
"enabled": true,
"timeout": 7200000,
"oauth": false
}
}
}tools
tool | description |
| validate token and return session payload |
| list available models |
| natural-language command wrapper |
| unified prompt tool (wait/background) |
| check/wait for background runs |
| direct wait-style prompt tool (legacy/simple) |
project structure
chatgpt-webui-mcp/
├── deploy/
│ └── systemd/
│ ├── chatgpt-webui-mcp.env.example
│ ├── chatgpt-webui-mcp-sse.sh
│ └── chatgpt-webui-mcp.service
├── src/
│ ├── index.ts # MCP server
│ └── chatgpt-webui-client.ts # WebUI automation client
├── package.json
├── tsconfig.json
├── .env.example
├── .gitignore
├── LICENSE
├── INSTALL.md
└── README.mdlicense
mit
author
Available Tools
9 toolschatgpt_webui_askC
Send a prompt to ChatGPT WebUI using session token auth and return assistant text.
Inputs: prompt (required), model, workspace, model_mode, +7 more.
chatgpt_webui_ask_async_resultB
Get result for a background ask job. Optionally wait for completion by providing wait_timeout_ms.
Inputs: job_id (required), wait_timeout_ms, poll_interval_ms.
chatgpt_webui_ask_async_startA
Start a background ChatGPT ask job and return immediately with a job id. Use this for long-running tasks like Deep Research and Pro runs.
Inputs: prompt (required), model, workspace, model_mode, +7 more.
chatgpt_webui_ask_async_statusC
Get status for a background ask job.
Inputs: job_id (required).
chatgpt_webui_commandB
Natural-language command wrapper. Converts phrases like 'with chatgpt webui on gpt 5.2 pro extended thinking: ...' into a chatgpt_webui_prompt call.
Inputs: command (required), mode, wait_for_ms, poll_interval_ms.
chatgpt_webui_modelsA
List available ChatGPT WebUI models for the current account.
Inputs: no named parameters.
chatgpt_webui_promptB
Unified prompt entrypoint. mode=auto uses background runs for long tasks (Deep Research, Pro/Thinking, image generation) and direct wait for short tasks.
Inputs: prompt (required), mode, model, workspace, +10 more.
chatgpt_webui_runB
Unified run checker. Use run_id from chatgpt_webui_prompt background mode (or job_id from legacy async tools).
Inputs: job_id, run_id, wait_timeout_ms, poll_interval_ms.
chatgpt_webui_sessionA
Validate ChatGPT session token and return session details.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
There is significant functional overlap: chatgpt_webui_ask, chatgpt_webui_prompt, chatgpt_webui_command, and chatgpt_webui_ask_async_start all initiate ChatGPT prompts. The distinction between direct ask, unified prompt, and natural-language wrapper is not immediately clear, and the run checker overlaps with async status/result tools.
Tools consistently share the chatgpt_webui_ prefix and use snake_case, but the action style is mixed: ask/start are verbs, while session/models/command/prompt/run are nouns. The async subfamily is internally consistent, but the overall naming pattern is not uniform.
Nine tools is within a reasonable range for a ChatGPT WebUI integration. However, several tools appear redundant due to the coexistence of legacy async functions, a unified prompt entrypoint, and a command wrapper, making the set slightly larger than needed.
The core workflow of sending prompts and retrieving results is covered, including background execution for long-running tasks. Notable gaps include no explicit cancellation/abort for background jobs and no conversation-history or context management, which limits full lifecycle coverage.
Maintenance
Related MCP Connectors
Hosted Web Crawler MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Related MCP Servers
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.25 npm574Mozilla Public 2.0- AlicenseNot gradedqualityCmaintenanceLocal MCP server bridging ChatGPT Web to local tools for file, shell, git, test, and process management with secure policy controls.MIT
- AlicenseAqualityCmaintenanceMCP server that drives chat.sakana.ai via headless Chrome with persistent sessions. Enables AI assistants to interact with Sakana AI chat through tools like session management, with ToS gate and browser automation.524 npmMIT
- AlicenseNot gradedqualityBmaintenanceMCP server that turns one authenticated ChatGPT browser page into a bounded MCP server, exposing tools for creating, listing, searching, exporting, sending, editing chats and downloading media via a CDP driver.MIT