Skip to main content

merge-gateway-cli

mgw — the Merge Gateway CLI. Route your existing coding agents (Claude Code, Codex) through Merge Gateway without editing config files by hand.

Install

pipx install merge-gateway   # recommended (isolated env)
pip install merge-gateway     # alternative

What it does

  1. mgw login — sign in through your browser (loopback + PKCE), storing a short-lived credential under ~/.mgw.
  2. mgw setup <harness> — mint a gateway API key and write the harness config (claude-code → ~/.claude/settings.json, codex → ~/.codex/config.toml).
  3. mgw doctor — confirm the harness routes through the gateway.
  4. mgw keys list|rm — manage the keys mgw minted; mgw logout clears local state.

No human at the keyboard? mgw agent signup

An AI agent can set itself up without anyone opening a browser:

mgw agent signup            # creates an organization, saves a key, writes the harness config
mgw doctor                  # confirms the gateway routes
mgw agent whoami            # what the saved credential is for (validates it with the server)
mgw agent claim-url         # a fresh claim link for your user (revokes the previous one)
mgw agent forget            # drop the local credentials (nothing is revoked server-side)

signup prints a claim URL. The organization it created has nobody in it and runs as a sandbox (a small lifetime budget, a daily request cap and a cheap-model allowlist) until a person opens that link, signs up or logs in, and becomes its admin — at which point the ordinary account flow (phone verification, payment method) lifts the limits. The API key is written to ~/.mgw/agent.json with 0600 permissions and is never printed; pass --json for machine-readable output (the key is excluded there too).

Signup is rate limited per address and fleet-wide; if it is refused, the message says why. Re-running signup on a machine that already has agent credentials is refused — use whoami to reuse them.

Set MGW_CONTROL_PLANE_URL / MGW_GATEWAY_URL to target a non-production environment (e.g. https://api-gateway-develop.merge.dev for both).

Development

We use uv.

uv sync --locked          # create .venv from the lockfile
make run ARGS="--version" # run the CLI
make tests                # run tests
make lint                 # ruff check + format check

See AGENTS.md for repository conventions.

Metadata

Release files for merge-gateway 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for merge-gateway 0.1.0
File Size Uploaded Provenance
merge_gateway-0.1.0.tar.gz 46.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for merge-gateway 0.1.0
File Interpreter ABI Platform
merge_gateway-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 73.8 kB

Release files / merge_gateway-0.1.0.tar.gz

Download URL merge_gateway-0.1.0.tar.gz
Size 46.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c55e4470ca7c4fd378fa425b83abfe8b6039fc79c0ca23a93a5711d2df449fa0
BLAKE2b-256 checksum
How to use checksums
bc4622a6f90cbf67ff1011212aa6d9010deed2937884fa9939f58b3e8525fd5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release files / merge_gateway-0.1.0-py3-none-any.whl

Download URL merge_gateway-0.1.0-py3-none-any.whl
Size 27.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6201be4a56ab3734060cd0bda1d9e19b143e3d2573a91b151460cbea04279b0
BLAKE2b-256 checksum
How to use checksums
15f8c6bd1c0d5a02ea1ae4a40e8104e4f2622bedc42b2f175517564799437461
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Security for merge-gateway 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for merge_gateway-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page