{"slug": "show-hn-subagents-mcp-gemini-and-codex-subscriptions-in-claude-ai-0-api", "title": "Show HN: Subagents-MCP – Gemini and Codex subscriptions in claude.ai ($0 API)", "summary": "Developer aattaran released subagents-mcp, an open-source Model Context Protocol (MCP) server that exposes locally signed-in subscription CLIs — Google's Antigravity CLI (agy) for Gemini, OpenAI's Codex CLI, and Anthropic's Claude Code CLI — as selectable agents inside Claude Code and claude.ai with $0 API billing. The tool strips every *_API_KEY environment variable and GOOGLE_APPLICATION_CREDENTIALS before spawning any CLI, runs each runner in an isolated empty 0700 directory, and locks tools down (agy denies all 7 wildcard permission categories, codex runs --sandbox read-only, claude runs --permission-mode plan). It supports multi-turn session resume via conversation_id and registers through `claude mcp add`, with a single-owner OAuth 2.1 MCP Custom Connector for claude.ai web and mobile.", "body_md": "**Use your existing Google (Gemini), ChatGPT (Codex), and Claude subscriptions as selectable agents inside Claude Code and `claude.ai` — with $0 API billing and zero API proxying.**\n\nPay-per-token API proxies get expensive fast when you already pay for monthly AI subscriptions. From the author of [deepclaude](https://github.com/aattaran/deepclaude) (★2,200+), `subagents-mcp` exposes your locally signed-in subscription CLIs (`agy`, `codex`, `claude`) over the standard **Model Context Protocol (MCP)** so you can select and message Gemini, Codex, and Claude side by side with multi-turn session resume.\n\n|  | [deepclaude](https://github.com/aattaran/deepclaude) | **subagents-mcp** | \n|---|---|---|\n| **Billing** | Pay-per-token API keys (DeepSeek / OpenRouter) | **$0 API billing** — uses your existing Google, ChatGPT, and Claude subscriptions | \n| **Models** | Anthropic-compatible API backends | **Gemini (`agy`)** ,**Codex (` codex`)** , and**Claude (` claude`)** side by side | \n| **Works in `claude.ai` web & mobile?** | No (CLI proxy) | **Yes** — built-in single-owner OAuth 2.1 MCP Custom Connector | \n| **Works in Claude Code?** | Yes ( `ANTHROPIC_BASE_URL` ) | **Yes** — stdio MCP +`/agents` presets + local CLI`--proxy` | \n| **API key leak protection** | Needs API key | Hard-strips every `*_API_KEY` &`GOOGLE_APPLICATION_CREDENTIALS` before spawn | \n\n```\nClaude Code / Cursor / Antigravity / claude.ai (MCP client)\n        │  MCP (stdio or Streamable HTTP)\n        ▼\n  subagents-mcp  (list_agents / send_to_agent / get_reply)\n        │  strips EVERY *_API_KEY & GOOGLE_APPLICATION_CREDENTIALS\n        │  runs inside an isolated empty 0700 directory\n        ├──► agy    (Google AI subscription — Gemini models, all tool actions denied)\n        ├──► codex  (ChatGPT subscription — read-only sandbox)\n        └──► claude (Claude subscription — read-only plan mode)\n```\n\n- **$0 API billing by construction:** every`*_API_KEY` environment variable (`GEMINI_API_KEY` ,`GOOGLE_API_KEY` ,`OPENAI_API_KEY` ,`ANTHROPIC_API_KEY` ,`OPENROUTER_API_KEY` , etc.) and`GOOGLE_APPLICATION_CREDENTIALS` are stripped before spawning any CLI. If you aren't signed in to a subscription, the CLI reports it instead of silently billing an API key.\n- **No workspace mutation:** all runners execute in an isolated empty`0700` directory (`~/.local/state/subagents-mcp/sandbox-cwd` ) and fail loudly on startup if it is non-empty.\n- **Hard tool lockout:**  - `agy` runs with session-only`--settings` pinning`toolPermission: \"request-review\"` and denying all 7 wildcard permission categories (`command(*)` ,`write_file(*)` ,`read_file(*)` ,`mcp(*)` ,`execute_url(*)` ,`download_url(*)` ,`read_url(*)` ).\n  - `codex` runs with`--sandbox read-only` (and`-c sandbox_mode=\"read-only\"` on resume).\n  - `claude` runs with`--permission-mode plan` .\n- **Multi-turn context:** passing`conversation_id` back to`send_to_agent` resumes the underlying CLI conversation (`--conversation` ,`codex exec resume` ,`--resume` ).\n\nInstall and sign in (via subscription login, **no API keys**) to whichever CLIs you want available — any missing CLI is skipped cleanly at startup:\n\n- **Gemini (Google AI subscription):**[Antigravity CLI (`agy`)](https://antigravity.google) — run` agy` once to sign in, verify with`agy models` .\n- **Codex (ChatGPT subscription):**[OpenAI Codex CLI (`codex`)](https://github.com/openai/codex) — run` codex login` .\n- **Claude (Claude subscription):**[Claude Code CLI (`claude`)](https://docs.anthropic.com/en/docs/claude-code) — run` claude auth login` .\n\n```\ngit clone https://github.com/aattaran/subagents-mcp.git\ncd subagents-mcp\nnpm install\n\n# Check which subscription agents are detected on this machine\nnode src/cli.js --list\n```\n\nRegister the MCP server once:\n\n```\nclaude mcp add subagents -- node /absolute/path/to/subagents-mcp/src/cli.js\n```\n\nOptional — copy the bundled subagent presets so `gemini` and `codex` show up directly in Claude Code's `/agents` picker:\n\n```\nmkdir -p ~/.claude/agents\ncp claude-agents/*.md ~/.claude/agents/\n```\n\n`claude.ai` Custom Connectors require OAuth 2.1 over HTTPS. `subagents-mcp` includes a built-in single-owner OAuth 2.1 server (Dynamic Client Registration, PKCE, scrypt owner passphrase consent, refresh token rotation, and brute-force lockout).\n\n**Step 1 — Set your owner passphrase once:**\n\n```\nnode src/cli.js --set-passphrase\n```\n\n**Step 2 — Expose localhost over HTTPS (e.g. Cloudflare Tunnel):**\n\n```\ncloudflared tunnel --url http://127.0.0.1:3456\n# Copy the https://<your-tunnel-url> printed by cloudflared\n```\n\n*(For a permanent hostname, use a named Cloudflare Tunnel pointing to `http://127.0.0.1:3456`.)*\n\n**Step 3 — Start `subagents-mcp` in OAuth 2.1 mode:**\n\n```\nnode src/cli.js --http --port 3456 --public-url https://<your-tunnel-url>\n```\n\n**Step 4 — Add the Custom Connector in `claude.ai`:**\n\n1. In `claude.ai` , go to**Settings → Connectors → Add custom connector** .\n2. Enter your MCP URL: `https://<your-tunnel-url>/mcp` .\n3. Click **Connect** → enter your owner passphrase on the consent page → click**Allow** .\n4. In any `claude.ai` chat (web, desktop, or mobile), enable the connector and say*\"List my agents\"* or*\"Ask `gemini-4-neon-high` to ...\"* .\n\nWant to route unused legacy slots (`Opus 5`, `Sonnet 5`, `Haiku 4.5`) in **local Claude Code CLI** (`/model` or `--model`) to subscription-backed **Gemini 4 Neon**, **Gemini 4 Carbon**, or **Codex** at **$0 API billing** while keeping `Opus 5.5` / `Sonnet 5.5` / `Haiku 5.5` untouched on Anthropic?\n\n**Step 1 — Start the local subscription-CLI proxy:**\n\n``` php\nnpm run proxy\n# Listening on http://127.0.0.1:3457:\n#   Opus 5 / Opus 4.7 -> gemini:gemini-4-neon-high (Gemini 4 Neon)\n#   Sonnet 5          -> gemini:gemini-4-carbon-high (Gemini 4 Carbon)\n#   Haiku 4.5         -> codex:codex (Codex)\n#   All other models  -> https://api.anthropic.com (pass-through)\n```\n\n**Step 2 — Launch local Claude Code pointed at the proxy:**\n\n```\nANTHROPIC_BASE_URL=http://127.0.0.1:3457 claude --model claude-opus-5\n```\n\n**Measured limitation on `claude.ai/code` (`claude remote-control`):** Claude Code `2.1.331+` explicitly refuses `claude remote-control` whenever `ANTHROPIC_BASE_URL` does not point at `api.anthropic.com` (*\"Remote Control is only available when using Claude via api.anthropic.com\"*). So the `--proxy` path works for **local Claude Code CLI / terminal sessions**, while **`claude.ai` web/mobile** should use **Section 2 (built-in OAuth 2.1 MCP Custom Connector)**.\n\n*Note:* Mapped slots stream text/reasoning replies live from `agy` / `codex` (read-only/tool-locked, $0 API cost); switch back to `Opus 5.5` / `Sonnet 5.5` whenever you want native Claude Code file/shell tool execution. An optional companion userscript ([`browser/claude-ai-relabel.user.js`](https://github.com/aattaran/subagents-mcp/blob/main/browser/claude-ai-relabel.user.js)) is included for reference.\n\n```\nexport SUBAGENTS_TOKEN=\"$(openssl rand -hex 32)\"\nnode src/cli.js --http --port 3456\n```\n\nBinds to `127.0.0.1:3456` by default and requires `Authorization: Bearer <token>` on `/mcp` (constant-time verified).\n\n| Tool | Description | \n|---|---|\n| `list_agents` | Lists every discovered subscription agent ( `id` ,`provider` ,`label` ,`busy` ). | \n| `send_to_agent` | Starts or continues a conversation ( `agent` ,`message` , optional`conversation_id` ). Returns`conversation_id` immediately so long turns never time out MCP calls. | \n| `get_reply` | Long-polls (up to 25s per call) for replies newer than `after` and returns`{ status, replies }` . | \n\n```\n# Fast host test suite (fake CLIs, no network)\nnpm test\n\n# Full isolated Docker test run (--network=none, non-root user, live proxy/OAuth CLI smoke)\nnpm run test:isolated\n```\n\nRuns Node's built-in test runner (`node --test`) across environment sanitization, subprocess runners (verifying env stripping, argv lockouts, split multibyte UTF-8 streaming, denied tools, and multi-turn resume), single-owner OAuth 2.1 + PKCE, local `/v1/messages` proxy streaming + pass-through, and end-to-end stdio + Streamable HTTP MCP flows.\n\n**Subscription terms note:** Before driving any subscription CLI from a custom setup or UI, verify that your usage complies with the provider's current subscription Terms of Service. Never put a paid API key into this tool's environment.\n\nMIT", "url": "https://wpnews.pro/news/show-hn-subagents-mcp-gemini-and-codex-subscriptions-in-claude-ai-0-api", "canonical_source": "https://github.com/aattaran/subagents-mcp", "published_at": "2026-12-02 00:52:10+00:00", "updated_at": "2026-12-02 01:15:13.615546+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "ai-tools", "developer-tools", "ai-products"], "entities": ["subagents-mcp", "aattaran", "deepclaude", "Model Context Protocol", "Claude Code", "claude.ai", "Google Gemini", "OpenAI Codex CLI"], "also_reported_by": [], "takeaway": "subagents-mcp lets Claude Code and claude.ai call Gemini, Codex and Claude subscription CLIs over MCP with $0 API billing by stripping all *_API_KEY variables and running each CLI in an empty 0700 sandbox with read-only or plan-mode permissions.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/show-hn-subagents-mcp-gemini-and-codex-subscriptions-in-claude-ai-0-api", "markdown": "https://wpnews.pro/news/show-hn-subagents-mcp-gemini-and-codex-subscriptions-in-claude-ai-0-api.md", "text": "https://wpnews.pro/news/show-hn-subagents-mcp-gemini-and-codex-subscriptions-in-claude-ai-0-api.txt", "jsonld": "https://wpnews.pro/news/show-hn-subagents-mcp-gemini-and-codex-subscriptions-in-claude-ai-0-api.jsonld"}}