Skip to content

Latest commit

 

History

History
229 lines (154 loc) · 12.2 KB

http-mcp.md

File metadata and controls

229 lines (154 loc) · 12.2 KB

ChatGPT Project HTTP MCP Setup

Use this path when you want a ChatGPT Project to hand tasks back to this local repo through MCP.

This is not the ChatGPT Pro browser adapter. It does not open ChatGPT, read cookies, or automate a web session. It starts a local HTTP MCP server that exposes the same bridge/repo tools as the Claude stdio server.

Generic task, session and result responses redact personal ChatGPT thread metadata, including nested blockers and recovery URLs in diagnostic text. Local CLI records retain that context for recovery. Legacy result artifacts without a recorded hash are readable with a legacy_artifact_unverified warning; a signed completion receipt does not verify unhashed artifact bytes.

What It Is

prodex start runs a local Streamable HTTP MCP server.

Typical use:

  • ChatGPT creates a structured task in .bridge/tasks/.
  • Codex claims and executes that task locally.
  • Codex writes the result to .bridge/results/.
  • ChatGPT fetches the result through MCP.

The server is personal and local-first. Do not expose it as a shared service. HTTP MCP requests are bounded: malformed JSON returns 400, and request bodies over 1 MiB are rejected with 413. Sessions are bounded too. A session with no request for 30 minutes and no stream open is closed, and at most 100 sessions are kept: initializing one more closes the least recently used. A request carrying a closed session's Mcp-Session-Id gets 404, as an unknown id does, and MCP clients answer that by initializing a new session.

Build And Prepare

Requires Node.js 20 or newer, git, and ripgrep (rg) on PATH.

For an installed package:

prodex setup --token-ttl-hours 24

The installed npm package is CLI-only. Use the prodex command and MCP server surfaces; JavaScript imports from prodex or prodex/dist/* are unsupported until a library API is designed and documented. Run the local bridge commands from the repo root, or pass --cwd /absolute/path/to/your/repo to setup, start, status, doctor, and tunnel url.

For a source checkout:

cd /absolute/path/to/prodex
npm install
npm run build
node dist/cli.js setup --cwd /absolute/path/to/your/repo --token-ttl-hours 24

The examples below use the installed prodex binary. In a source checkout, replace prodex with node dist/cli.js after building, keep --cwd /absolute/path/to/your/repo when you are not already in the target repo, and pass --source-cli /absolute/path/to/prodex/dist/cli.js to local MCP troubleshooting commands so their recovery hints stay in source-checkout form.

setup writes a local server profile to .bridge/config.local.json. The file is ignored by git. It also ensures .bridge/.gitignore covers local task, result, session, receipt, artifact, and config files.

By default, command output redacts the URL token:

prodex_token=***

--token-ttl-hours is optional for strictly local use. If you omit it, status reports token_status: "non_expiring" and the token does not expire. status --show-token refuses to reveal non-expiring tokens by default; pass --unsafe-show-non-expiring-token only for local-only debugging. Before pasting the URL into ChatGPT or exposing this server through any tunnel, rerun setup with a short TTL:

prodex setup --token-ttl-hours 24

Equivalent from outside the repo:

prodex setup --cwd /absolute/path/to/your/repo --token-ttl-hours 24

Token-bearing MCP URLs are secrets. Keep the renewed URL in your own trusted private MCP client configuration.

Expired tokens are rejected by prodex start and by the HTTP MCP server. Run prodex setup --token-ttl-hours <hours> to rotate the URL, restart prodex start, then reconnect clients using prodex status --show-token --url-only. Plain setup preserves the existing token and expiry; changing the TTL preserves the listener unless --host or --port is supplied.

Start The Local Server

Run this in a terminal and keep it running while ChatGPT is using the bridge:

prodex start

The HTTP MCP listener is loopback-only. setup --host accepts local loopback hosts such as 127.0.0.1 or localhost; it rejects public interfaces like 0.0.0.0. start reads the saved setup profile when the server process starts. If you rerun setup to change the listener or rotate the token, restart prodex start so the running server uses the new profile. status --show-token --url-only prints the saved local MCP URL, while tunnel url formats your supplied public tunnel URL with the saved token; it does not create or inspect the tunnel. If you need ChatGPT to reach it from outside the machine, keep prodex start local and put your own explicit tunnel in front of it.

From outside the repo:

prodex start --cwd /absolute/path/to/your/repo

Token-bearing MCP URLs are secrets. They authorize all enabled bridge tools, including repo read, search, write dry-run/apply, and stage-reviewed-paths tools. Use the next command only when you are ready to paste the URL into your own trusted private MCP client configuration:

prodex status --show-token --url-only

From outside the repo:

prodex status --cwd /absolute/path/to/your/repo --show-token --url-only

--show-token requires a token created with setup --token-ttl-hours <hours> unless you explicitly pass the local-debug --unsafe-show-non-expiring-token override.

Add It To ChatGPT

In your ChatGPT Project MCP or Developer Mode setup, add the token-bearing URL generated in the previous step. Use it as a remote Streamable HTTP MCP server URL. Keep prodex start running and rotate the URL with setup when you no longer need it.

If your ChatGPT MCP client cannot reach localhost, keep prodex start loopback-only and put your own explicit tunnel in front of it. Public tunnel MCP URLs are also secrets and authorize all enabled bridge tools, including repo read, search, write dry-run/apply, and stage-reviewed-paths tools; use the next command only when you are ready to paste the URL into your own trusted private MCP client configuration:

prodex tunnel url --public-url "https://your-tunnel.example" --show-token --url-only

Verify In ChatGPT

After adding the MCP URL, generate a prompt that tells ChatGPT exactly which read/task tools to call:

prodex project prompt

From outside the repo:

prodex project prompt --cwd /absolute/path/to/your/repo

For a source checkout, include the built CLI path so the generated local follow-up commands also use node dist/cli.js:

node dist/cli.js project prompt --cwd /absolute/path/to/your/repo --source-cli /absolute/path/to/prodex/dist/cli.js

Paste the generated prompt into the ChatGPT Project. It asks ChatGPT to call bridge_create_task, bridge_list_tasks, and bridge_get_task, then wait while you complete the verification task locally. It deliberately does not ask for any repo write or staging tools. It also includes local status --cwd ... and doctor --cwd ... troubleshooting commands in case the Project cannot see or call the MCP tools. Source-checkout prompts keep --source-cli on those troubleshooting commands too.

After ChatGPT replies with the created task id, confirm and complete the task locally:

prodex tasks list --status new --cwd /absolute/path/to/your/repo
prodex tasks show <task-id> --cwd /absolute/path/to/your/repo
prodex tasks complete <task-id> --cwd /absolute/path/to/your/repo --summary "prodex MCP verification result" --artifact .bridge/artifacts/results/mcp-verification.md="prodex MCP verification artifact"

Then reply to ChatGPT with local completion done. The generated prompt asks ChatGPT to call bridge_fetch_result for the same task id, call bridge_fetch_result_artifact for every listed result artifact path, and report whether it can read both the verification result summary and artifact content.

If the ChatGPT app runtime cannot reach 127.0.0.1, this project intentionally does not create a tunnel automatically. Put your own explicit tunnel in front of the local server only after you understand the token exposure risk, and create a short-lived replacement URL first:

prodex setup --token-ttl-hours 24

After you create your own tunnel, ask prodex to format the public MCP URL. This command only rewrites the URL; it does not start or manage any tunnel process.

Public tunnel MCP URLs are also secrets. They authorize all enabled bridge tools, including repo read, search, write dry-run/apply, and stage-reviewed-paths tools. Use the next command only when you are ready to paste the public URL into your own trusted private MCP client configuration:

prodex tunnel url --public-url "https://your-tunnel.example" --show-token --url-only

From outside the repo, include the same target:

prodex tunnel url --cwd /absolute/path/to/your/repo --public-url "https://your-tunnel.example" --show-token --url-only

tunnel url refuses non-expiring or expired tokens. By default it redacts the token.

Available Tools

The HTTP server exposes the same tool catalog as stdio MCP:

  • bridge_create_task
  • bridge_list_tasks
  • bridge_get_task
  • bridge_claim_task
  • bridge_complete_task
  • bridge_block_task
  • bridge_list_results
  • bridge_fetch_result
  • bridge_fetch_result_artifact
  • bridge_list_receipts
  • bridge_get_receipt
  • bridge_list_sessions
  • bridge_get_session
  • repo_read_file
  • repo_search
  • repo_write_file_dry_run
  • repo_write_file_apply
  • repo_stage_reviewed_paths

bridge_complete_task and bridge_block_task close tasks by writing durable .bridge/results records; they do not modify repo files. bridge_fetch_result_artifact only returns text artifacts that are listed on a result record and stored under .bridge/artifacts/pro-consults/ or .bridge/artifacts/results/; it does not expose arbitrary .bridge/artifacts files. Newly finalized result artifacts record a sha256, and fetch rejects the artifact if its content changed afterward. The bridge rejects oversized result artifacts before task finalization; if a Pro browser answer is too large for bridge_fetch_result_artifact, it stays in the result summary with answer_artifact_warning instead of listing an unfetchable artifact.

Write Flow

Writes are deliberately gated and require a git worktree with a committed HEAD:

  1. repo_write_file_dry_run previews replacing an existing repo-relative text file. It records the diff, git HEAD, preimage hash, and a replacement-text artifact under .bridge/artifacts/repo-writes/. The file keeps its CRLF line endings, UTF-8 BOM and final newline when the new content leaves them out, and apply keeps its file mode, so an edited script stays executable. A file that is not UTF-8 text (EUC-KR, Latin-1, UTF-16) is refused rather than re-encoded.
  2. repo_write_file_apply applies that exact receipt only if git HEAD, file path, preimage hash, and artifact content still match.
  3. repo_stage_reviewed_paths stages only files backed by matching applied write receipts. Their paths reach git literally, so a name such as pages/[id].tsx stages that file and nothing it would match as a pattern.

There is no direct ungated write tool and no shell execution tool.

Safety Boundaries

  • No hidden ChatGPT API client.
  • No browser cookie, token, localStorage, or sessionStorage extraction.
  • No captcha, Cloudflare, rate-limit, or permission bypass.
  • No recurring prompt loops.
  • No public account-sharing service.
  • No shell execution over MCP.
  • No access to .bridge, .git, .env*, node_modules, dist, or oversized files through repo read/search tools.

Troubleshooting

Run the local health check:

prodex doctor

doctor stays local. It verifies .bridge, redacted config loading, receipt-gated write/apply/stage behavior in a temporary git repo, and the real HTTP MCP tool catalog plus task create/list/get/claim/complete/block/fetch/list-results calls.

If ChatGPT cannot connect:

  • Confirm prodex start is still running.
  • Confirm you pasted the full status --show-token --url-only URL.
  • Confirm the client can reach the host in that URL.
  • If status --show-token says a token with expiry is required, run prodex setup --token-ttl-hours 24 and update the URL.
  • Run prodex status; if the token is expired, run prodex setup --token-ttl-hours 24 again and update the URL.