Chat2Agent
Integrates with OpenAI's ChatGPT web client via the official MCP connector, enabling ChatGPT (including free accounts) to access a local workspace for code retrieval, file editing, test execution, and code review.
Click on "Install 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., "@Chat2Agentread the code in my workspace and fix the failing tests"
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.
๐ Chat2Agent
An open-source bridge suite that gives the ChatGPT web app local workspace capabilities through the official MCP
๐ก Core positioning The main goal of this project is to let the web-based ChatGPT (including both free and paid tiers) connect directly to your local workspace through OpenAI's official MCP (Model Context Protocol) developer connector, gaining code search, file modification, test execution, and review capabilities similar to Codex Agent.
For the complete design boundary, see ๐ ADR 0001: Web Agent Boundary and ๐บ๏ธ Product Roadmap.
๐ก๏ธ Zero Cost and Absolute Account Safety
1. ๐ฐ 100% Free โ a Regular Free Account Is All You Need
Works with the free ChatGPT tier: OpenAI has officially enabled Developer Mode / MCP Connector on the web app, so a regular free account can add a custom MCP connector directly โ no Plus/Team/Pro subscription required!
Free public tunnel: Whether you use the built-in ngrok free tier or the Pinggy free tunnel, you can establish stable communication between your local machine and the web app at zero cost.
2. ๐ Official, Standards-Compliant Protocol โ Absolutely Zero Ban Risk
Official open standard: Built entirely on OpenAI's official Model Context Protocol (MCP) specification and the standard OAuth 2.0 flow.
No reverse engineering or black-hat tactics: We never inject web cookies, never scrape non-public web APIs, never reverse-engineer tokens, and never use any unauthorized automation scripts. To OpenAI, this is simply a legitimate third-party standard connector that fully complies with the official Terms of Service (TOS) โ guaranteeing zero ban risk at the technical level.
Related MCP server: codex-web-bridge
๐ Why Choose Chat2Agent? (Major Upgrades Over the Original)
This project is a deep refactor and evolution of the excellent concept from Embracecactus/devspace-mcp-tunnel.
The original was a simple Linux Bash launcher demo (11 files total). Chat2Agent has grown to 66 files, added 6400+ lines of code, and includes 40 automated unit tests, achieving an industrial-grade transformation:
Dimension | Original version (devspace-mcp-tunnel) | Chat2Agent Enhanced Refactor (this project) |
Cross-platform architecture | Linux/WSL only, basic Bash | Native Windows enterprise-grade managed daemon ( |
Process lifecycle |
| Dual validation via PID tree and Linux |
Long-running async polling | No process session persistence; short commands easily hang | Long-task Process Session persistence implemented, fixing the ChatGPT "0 serialization" bug ( |
Startup health gate | No post-start probe; no way to know if the service is actually usable | Built-in |
Web Diff rendering | Uses DevSpace's native output, causing frequent freezes and white screens in the web app | Custom versioned inline Diff cards that bypass ngrok interception; UI is only bound to |
Codex resource reuse | Reads global config crudely or lacks isolation | Read-only safe mirror and isolation of Codex resources (ADR 0001), carefully selecting 3 Skills without ever polluting or modifying the local global Codex |
Security sandbox hooks | No tool interception, audit, or security protection | New |
Security & allowlist | Crudely inherits the global | Actively removes global wildcards, dynamically derives the allowlist from public domains and loopback; credentials are tightly protected by |
OAuth session governance | No way to manage authorized clients and tokens | Built-in OAuth database management tool with automatic token expiry pruning, per-client revocation, and one-click global revocation |
Diagnostic probe toolbox | No companion troubleshooting or test scripts | 6 new CLI probes ( |
Protocol metadata monitoring | No way to detect tool updates or cache pollution | Custom versioned URI cache-busting strategy ( |
Privacy protection | No execution state audit | Fail-closed, privacy-minimized execution evidence collection, recording only exit codes, never collecting user source code or instruction content |
Dual real-world acceptance | No acceptance criteria | Dual acceptance via automated probes and real web rendering ( |
Engineering & automated testing | No test cases | 16 test suites, 40 unit and integration tests, with Windows / Ubuntu dual-system GitHub Actions CI |
โจ Core Features & Hardcore Engineering
๐๏ธ How It Works
โโโโโโโโโโโโโโโโโโโ HTTPS / OAuth โโโโโโโโโโโโโโโโ loopback โโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ็ฝ้กต็ ChatGPT โ โโโโโโโโโโโโโโโโโโโโโโโโถ โ ๅ
ฌ็ฝ้ง้ โ โโโโโโโโโโโโโโโโโโโโโถ โ DevSpace (127.0.0.1) โ
โโโโโโโโโโโโโโโโโโโ (ngrok / Pinggy) โโโโโโโโโโโโโโโโ (Port: 7676) โโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโ
โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๅ
่ฎธ็ๆฌๅฐ็ฎๅฝ / Shell โ โ ้ๅฎ็ AGENTS.md / Skillsโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโIsolated listening: DevSpace only listens on the local loopback address
127.0.0.1:7676, with strict authorization via OAuth (Owner password).Reverse proxy: The tunnel tool proxies public HTTPS traffic to the local port 7676.
Endpoint rules: The MCP client connects to
https://<tunnel-domain>/mcp, and the OAuthissuercomes frompublicBaseUrl(i.e., the bare domain root, without/mcp).Zero global pollution:
Windows launcher: Only updates
.mcp.jsonin the project directory, never modifies the machine's global Codex config.Linux refresh script: Does not modify
~/.codex/config.tomlby default; only syncs as a legacy compatibility step when explicitly invoked with--sync-codex.
๐ Free ngrok Setup Guide (Step-by-Step, Zero Cost)
We recommend the free ngrok for stable public tunnel support (completely free):
Create an account: Visit ngrok's official site (ngrok.com) and register for free.
Get your Authtoken:
After logging in, go to ngrok Dashboard -> Your Authtoken.
Copy the generated token.
(Highly recommended) Claim 1 free static domain:
In the left menu, click Cloud Edge -> Domains.
Click Claim a domain to claim a free dedicated static domain (e.g.,
your-name.ngrok-free.app).Benefit: With a fixed domain, you never need to update the URL in the ChatGPT web app after restarting the service!
Fill in the project config:
In the project root, copy the config file:
Copy-Item .env.example .env.localEdit
.env.localand fill in the information:NGROK_AUTHTOKEN=ไฝ ็ngrok_authtoken NGROK_DOMAIN=your-name.ngrok-free.app # ๅฆๆๆฒกๆ็ณ่ฏทๅบๅฎๅๅๅ็็ฉบ
๐ Windows Quick Start (Recommended)
1. Install Dependencies and Initialize DevSpace
Requirements: Node.js
>=22.19 <27
# 1. ๅ
จๅฑๅฎ่ฃ
DevSpace CLI ๅนถๅฎ่ฃ
้กน็ฎไพ่ต
npm install --global @waishnav/devspace
npm ci
# 2. ๅๅงๅ DevSpace ้
็ฝฎ
devspace initdevspace init will guide you through entering the allowed directories, port (enter 7676), and public base URL (you can enter https://placeholder.invalid for now; the launcher will rewrite it automatically).
# ็ฎๅฝๆๆ็คบไพ๏ผๆ้ๅผๆพ๏ผ๏ผ
D:/AI/project-one,D:/AI/project-two
# ๆ็กฎๆฅๅ้ฃ้ฉๅ๏ผไนๅฏไปฅๅ
จ็ๅผๆพ๏ผ
C:/,D:/2. One-Click Start, Check Status, and Stop
# ่ฟ่กๅฏๅจๅ้ขๆฃ
npm run preflight
# ๅฏๅจๅๅฐๅ็ฎกๆๅก๏ผ้่ฟ /healthz ้จๆงๅ่ฟๅๆๅ๏ผ
./start.bat
# ๆฅ็่ฟ่ก็ถๆไธ่ฏๆญ
npm run status
# ็ฒพๅๅๆญขๅ็ฎก่ฟ็จๆ
./stop.bat๐ง Linux / WSL Quick Start
1. Install and Initialize
git clone https://github.com/xiaoxiao341/Chat2Agent.git
cd Chat2Agent
chmod +x setup.sh refresh-devspace-mcp.sh
# ๅฝๅ
็ฝ็ปๅปบ่ฎฎ่ฟฝๅ --mirror ๅ ้ npm ๅฎ่ฃ
./setup.sh --mirror2. Start the Tunnel and Auto-Sync
# ๆนๅผ A๏ผไฝฟ็จ Pinggy ้ง้๏ผ้ป่ฎคๆ ้้
็ฝฎไปปไฝ่ดฆๅท๏ผ
./refresh-devspace-mcp.sh --tunnel-cmd "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 443 -R0:localhost:7676 a.pinggy.io"
# ๆนๅผ B๏ผไฝฟ็จ ngrok
./refresh-devspace-mcp.sh --tunnel-cmd "ngrok http 7676" --url-regex 'https://[a-z0-9-]+\.ngrok-free\.app'
# ๆนๅผ C๏ผไฝฟ็จๅทฒๆ็ๅ
ฌ็ฝ้ง้ๅฐๅ
./refresh-devspace-mcp.sh --known-url "https://abc-123.ngrok-free.app/mcp"๐ฑ Client Configuration & Authorization
Web-based ChatGPT Configuration (Supports Free Accounts)
Open the ChatGPT web app, click the avatar in the bottom-left corner, and go to Settings โ Apps & Connectors โ Advanced โ Developer Mode.
Click Create connector and enter your public MCP address:
https://<your-tunnel-domain>/mcp.In the OAuth window that appears, enter the DevSpace Owner password (stored in
~/.devspace/auth.json) to complete authorization.Start a new conversation, click the connector icon in the toolbar, and ChatGPT can read, write, and run your local code!
๐ ๏ธ Diagnostic Toolbox & CLI Commands
This repository includes a complete set of diagnostic and operational commands:
# ๐ ็ปผๅ่ฏๆญไธ่ฝๅๆข้
npm run probe # ๅฎๆด OAuth + tools/list ่ฏๆญ
node mcp-probe.mjs --workspace D:/AI/x --json # ่พๅบ SkillsใSubagents ไธๆไปคๆธ
ๅ
node mcp-probe.mjs --test-delete --test-dir D:/AI/tmp # ๅฎๅ
จๆฒ็ฎฑๅ ้คๆต่ฏ
npm run probe:accept # ้็ฆปๅผ็ผ่พใๆต่ฏใ้ฟ่ฟ็จไธ diff ่ชๅจ้ชๆถ
npm run doctor:web # ChatGPT ็ฝ้กต Connector ไธ็จๆทฑๅบฆๆ้
# ๐ฆ ่ตๆบไธ Hook ๅฎก่ฎก
npm run resources # ๆฅ็ๅทฒๅ็ฐ/ๆพๅผ้ๆฉ็ Codex Skills
npm run hooks # ๆฃๆฅ็ฝ้กตๅ
ผๅฎน Hook๏ผๆ็กฎๆ ๆณจไธๆฏๆ before_tool๏ผ
# ๐ OAuth ๅฎก่ฎกไธไปค็็ฎกๆง
npm run oauth:list # ๅๅบๆๆๅทฒๆณจๅ็ๅฎขๆท็ซฏ
node oauth-admin.mjs prune # ๆธ
็่ฟๆ็่ฎฟ้ฎไปค็
node oauth-admin.mjs revoke-client <client-id> --yes # ๆค้ๆๅฎๅฎขๆท็ซฏ
node oauth-admin.mjs revoke-all --yes # ๅ
จๅฑๅ้ๆๆๆๆไปค็๐ Project Structure & File Descriptions
โโโ ๐ช Windows ๅ็ฎกๆ ธๅฟ
โ โโโ start.bat / stop.bat # Windows ๅฟซๆทๅฏๅๅ
ฅๅฃ
โ โโโ start-ngrok.mjs # ngrok ้ง้ๅฎๆคไธ DevSpace ่ฟ็จ็ๅฝๅจๆ็ฎก็
โ โโโ stop-service.mjs # ๅบไบ PID ๆ ไธ่ฟ็จ็ญพๅ็็ฒพๅๅฎๅ
จๅๆญข
โ โโโ service-status.mjs # ่ฟ็จ็ถๆ่ฏๆญไธๅฅๅบทๆขๆต
โโโ ๐ง Linux / WSL ๅทฅๅ
ท
โ โโโ setup.sh # ไพ่ตๅฎ่ฃ
ไธไบคไบๅๅงๅ
โ โโโ refresh-devspace-mcp.sh # ้ง้ๅทๆฐไธ้
็ฝฎๅๅญ้่ฝฝ
โ โโโ linux-process-utils.sh # Linux /proc ๆ ่ฏๅฎๅ
จ้ช่ฏไธ่ฟ็จ็ฎก็
โโโ ๐ ่ฏๆญไธ้ชๆถไฝ็ณป
โ โโโ web-doctor.mjs # ็ฝ้กต Connector ่ฏๆญๅฅไปถ
โ โโโ mcp-probe.mjs # MCP ๅ่ฎฎไธ่ฝๅ่พน็ๆข้
โ โโโ execution-evidence.mjs # ้็งๆๅฐๅๆง่ก่ฏๆฎๆถๅฝ
โ โโโ web-acceptance.mjs # ็ๅฎ ChatGPT ็ฝ้กตไบคไบ้ชๆถๅทฅๅ
ท
โโโ ๐ ๆ้ไธ่ตๆบ้
็ฝฎ
โ โโโ oauth-admin.mjs / oauth-db.mjs # OAuth ๆฐๆฎๅบ็ฎก็ไธ Token ๆค้
โ โโโ resource-admin.mjs # Codex Skills ไธ AGENTS.md ่ตๆบ้ๅ
โ โโโ hook-admin.mjs # after_tool / tool_failure Hook ้้
ๅจ
โโโ ๐ ๆจกๆฟไธ่ง่
โโโ .env.example # ็ฏๅขๅ้ๆจกๆฟ
โโโ .mcp.json.example # MCP ๅฎขๆท็ซฏ้
็ฝฎ็คบไพ
โโโ review.sh / templates/ # ้ๆๅฎกๆฅ่ๆๆถไธๆฅๅๆจกๆฟ
โโโ docs/ # ADR ๅณ็ญ่ฎฐๅฝใ่ทฏ็บฟๅพไธ้ชๆถๆฅๅ๐ก Troubleshooting
Error: The client reports
expected .../ , received .../mcp.Root cause: The
publicBaseUrlinconfig.jsonwas set to a URL with/mcp. DevSpace derives the OAuth issuer frompublicBaseUrland then appends/mcpas the MCP endpoint.Solution: Make sure
publicBaseUrlis the bare domain root (no suffix), and only include/mcpin the connection URL you enter in the client. This project's scripts already handle this automatically.
Error message: The command is not found in a non-interactive environment, or the npm symlink lacks execute permission.
Solution: This project's launcher scripts automatically complete the PATH environment variable and include a built-in
chmod +xself-healing logic. To fix manually, run:chmod +x $(readlink -f $(which devspace))
Root cause: The traditional
pkill -fpattern matches the current script's own command-line arguments, causing collateral damage.Solution: This project records the PID and combines Linux
/procstartup markers / Windows process ownership chains for precise termination.
Root cause:
setsidcannot directly invoke the shell built-in commandeval.Solution: Unified wrapper as
setsid bash -c "$CMD".
Root cause: The upstream DevSpace mounts the full MCP App on tool calls like
open_workspace, creating frequent iframes; and the original component loads resources from ngrok, which the free tunnel's security interception page blocks.Solution: This project adapts the module in memory for compatibility:
Only mounts the UI resource on the final
show_changes;Uses a fully self-contained, versioned inline Diff component (
ui://devspace/diff-card-inline-v3.html);After the change, click Refresh in the ChatGPT Connector settings and start a new conversation to test.
Note: If you don't configure a fixed domain, the free tunnel's domain may change on every restart. We recommend claiming 1 free static domain in the ngrok Dashboard to avoid having to update the ChatGPT endpoint repeatedly.
๐ก๏ธ Security Policy & Disclaimer
Credential isolation: Never commit
.env.local,~/.devspace/auth.json, runtime logs, or real.mcp.jsonto any public repository.Risk control: The public tunnel is accessible; only enable it when needed. If you suspect credential leakage, immediately run
node oauth-admin.mjs revoke-all --yesand rotate your tokens.Usage limit notice:
You've hit your usage limitis a model usage limit on the OpenAI / ChatGPT side and is unrelated to the local tunnel or this project.For a detailed threat model and security response guidance, see ๐ SECURITY.md.
๐ค Credits & License
This project is a continued refactor and evolution of the excellent concept from Embracecactus/devspace-mcp-tunnel.
Original author's repository: Embracecactus/devspace-mcp-tunnel (thanks to the original author for the Linux automation script foundation and practical approach)
Underlying foundation: DevSpace (@waishnav/devspace)
License: This project is fully open source under the MIT License. In accordance with the MIT License, the project retains the original author's copyright notice (Copyright (c) 2026 Embracecactus). You are free to learn from, modify, and redistribute it within legal and compliant boundaries.
This server cannot be installed
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 gradedqualityBmaintenanceA local MCP bridge that lets ChatGPT control opencode sessions for code modification, file reading, and repository management on your own computer.1MIT
- AlicenseNot gradedqualityCmaintenanceLocal MCP server bridging ChatGPT Web to local tools for file, shell, git, test, and process management with secure policy controls.MIT
- AlicenseNot gradedqualityBmaintenanceLocal MCP bridge enabling ChatGPT web to access approved local files and execute tasks via local Codex.1MIT
- AlicenseNot gradedqualityBmaintenanceRemote MCP coding bridge that gives ChatGPT/Codex secure local workspace access, including file retrieval, semantic code intelligence, Git, diagnostics, and guarded shell execution.21MIT
Related MCP Connectors
Real-time chat hub for AI agents โ Claude Code, Cursor, Cline, Codex over MCP or REST.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yoโฆ
MCP connector that lets ChatGPT list, search, and run your Apple Shortcuts via a local Mac agent
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/xiaoxiao341/Chat2Agent'
If you have feedback or need assistance with the MCP directory API, please join our Discord server