Skip to main content

Merge for Workforce CLI (mfw)

A command-line tool for Merge for Workforce employees: chat with your provisioned models and tools from the terminal, or point Claude Code, Codex and other AI tools at them.

Install

pipx install merge-workforce   # recommended (isolated env, puts `mfw` on PATH)
pip install merge-workforce    # alternative

pipx keeps the tool in its own environment and avoids the "externally-managed-environment" error a plain pip install hits on modern Python. One-time setup: brew install pipx && pipx ensurepath (macOS) or python3 -m pip install --user pipx && pipx ensurepath (Linux). Update later with pipx upgrade merge-workforce. Requires Python 3.10+.

To install an unreleased/dev build straight from the repo instead: pipx install git+ssh://git@github.com/merge-api/merge-workforce-cli.git.

Quickstart

mfw

That's it. The first run opens your browser to sign in, provisions this device's Gateway credential, and drops you into a chat. Every message goes to a model through the Gateway (your routing policy picks it unless you choose one with /model), and when the model needs one of your tools it calls it through Agent Handler, all in one conversation.

Inside the chat: /help lists commands, /model shows or switches the model (Tab completes ids, /model auto returns to your routing policy), /tools shows what the model can call, /new starts over, /exit quits. The Merge Manta lives in the bottom-right corner: /pet makes it flap and blush, /pet color <name|#hex> recolors it. /color <name|#hex> recolors the frame around the input and /rename <name> puts a name on it; both colors are remembered. End a line with \ for a new line; Ctrl-C cancels a reply.

For a one-off answer, pass the prompt (or pipe it in):

mfw chat "summarize my open Linear issues"
echo "draft a standup update" | mfw chat

To sign in to a non-production backend, set MFW_GATEWAY_URL (or run mfw login --gateway-url <url> once); later commands reuse it.

You must be a provisioned employee. Setup mints your key only once your admin has activated Merge for Workforce for your group. If it returns "your admin has not finished setting up Merge Gateway for your group yet", that setup isn't complete; it's not a CLI error.

Commands

Run mfw --help, or mfw <command> --help for details on any one.

Command What it does
mfw Open a chat with your models and tools (signs you in and sets up first if needed).
mfw chat ["…"] [-m <id>] The same chat; with a prompt or piped stdin, answer once and exit.
mfw login Browser IdP login; stores a short-lived access token.
mfw setup Provision this device's Gateway credential (per-device, revocable).
mfw models List the models served for you. The id is what you pass as --model.
mfw mcp [--connectors a,b] [--write .mcp.json] Emit an MCP config so an external client (Claude Code, Cursor) can use your tools.
mfw env [--no-trace] Print export lines that route an AI tool through the Gateway (eval "$(mfw env)").
mfw run [--no-trace] -- <cmd> … Run a command with the Gateway credential injected as env (OpenAI- and Anthropic-compatible).
mfw creds [--export] Show (or export) the provisioned Gateway credential.
mfw whoami / mfw logout Show login state / clear the stored token.
mfw admin <cmd> Workforce-admin operations (requires the manage_workforce role). See Admin operations.

The Gateway routes and bills every call and enforces your allowlist, so a model or tool you aren't provisioned for comes back as a request error, never a silent fallback.

Admin operations (mfw admin)

For workforce admins — these provision and manage the org from the terminal. They require the manage_workforce role and run against your mfw login token, so no mfw setup is needed (admin commands don't use the Gateway credential). Without the role they return a permission error.

mfw admin groups                                    # list the org's groups (id + name)
mfw admin employees                                 # list employees (id, name, origin id)

# add an employee to a group, then remove one (removal revokes their Gateway keys)
mfw admin add-employee --group <group-id> --name "Jane Doe" --origin-id "jane@corp.com"
mfw admin remove-employee <employee-id>

# a group's model allowlist — a full replace (repeat -m), or clear it
mfw admin set-models <group-id> -m anthropic/claude-haiku-4-5-20251001 -m amazon/nova-micro
mfw admin set-models <group-id> --unrestricted      # allow every model

Run mfw admin --help, or mfw admin <command> --help, for details on any one.

Usage with AI agents

Two ways to give an AI agent your provisioned models and tools, both governed by your org:

  • mfw / mfw chat is the built-in agent: it drives a model through the Gateway and calls your provisioned tools over MCP, no other client needed. A large tool set is searched as needed (search_tools) instead of sent whole. Every request in a conversation carries one session id (X-Merge-Thread-Id, logged by the Gateway as thread_id; also sent to Agent Handler as X-Chat-Id) and every prompt one X-Merge-Turn-Id, so the Gateway request log and the Agent Handler tool call log join on turn_id.

  • mfw mcp hands your tools to an external MCP client (Claude Code, Cursor, any SDK agent). Write the config where the client reads it:

    mfw mcp --write .mcp.json     # Claude Code picks this up from the project root
    

    The config points the client at the backend's MCP endpoint with a short-lived token, so the agent calls tools as you, exactly as the console governs them. Re-run when the token lapses. --connectors notion,github limits the tools to those connectors; without it every tool you are provisioned is exposed, which can run to thousands. mfw env / mfw run also set ENABLE_TOOL_SEARCH=true so Claude Code loads MCP tools on demand instead of all at once (Claude Code turns that off by itself under a custom base URL).

  • mfw env and mfw run point an AI tool at the Gateway. Both set the credential under its Merge, OpenAI-SDK (OPENAI_API_KEY / OPENAI_BASE_URL, set to the Gateway's /v1/openai surface) and Anthropic-SDK (ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN) spellings, so Claude Code, Codex, or any SDK tool routes through the Gateway unchanged:

    eval "$(mfw env)" && claude        # this shell
    mfw run -- claude                  # one process
    

    By default both also turn on Claude Code's trace propagation (CLAUDE_CODE_ENABLE_TELEMETRY, CLAUDE_CODE_ENHANCED_TELEMETRY_BETA, CLAUDE_CODE_PROPAGATE_TRACEPARENT, OTEL_TRACES_EXPORTER=otlp with the Gateway's /v1/traces as the OTLP endpoint). With those set, every model request and every MCP tool call in one prompt carries the same trace id, which Gateway logs as client_trace_id and Agent Handler logs on the tool call, so one prompt joins across both logs. Variables you already export win; pass --no-trace to skip that block entirely.

How it works

  • Login is OAuth 2.0 Authorization Code + PKCE with a loopback redirect (RFC 8252): the public client merge-workforce-cli (no secret on the laptop), your browser → <gateway>/o/authorize/ → IdP login + consent → code returns to http://localhost:{9410-9419}/callback → exchanged at <gateway>/o/token/. The access token is stored in ~/.mfw/credentials.json (0600).
  • Setup exchanges that token for a per-device Gateway API key (~/.mfw/gateway_credential.json), the same per-device path the desktop client uses — independently revocable, with spend attributed to you.
  • Chat uses the maintained /v1/responses surface, continuing the conversation by previous_response_id (or re-sending it, if your org has no response store), and connects your provisioned tools over the backend's OAuth-authed /mcp/ endpoint, running the function-calling loop for you.

Metadata

Release files for merge-workforce 0.2.2

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-workforce 0.2.2
File Size Uploaded Provenance
merge_workforce-0.2.2.tar.gz 40.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for merge-workforce 0.2.2
File Interpreter ABI Platform
merge_workforce-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 79.0 kB

Release files / merge_workforce-0.2.2.tar.gz

Download URL merge_workforce-0.2.2.tar.gz
Size 40.6 kB
Tags Source
SHA-256 checksum
How to use checksums
55d2013a77d30735540bcd06aa4c68b63375732d7bcf11261794af50ba4af892
BLAKE2b-256 checksum
How to use checksums
d162454a9c72cdef31713fa29857150041546912804ec4c5470ff2d41536dcc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 20, 2026.

Transparency log

Release files / merge_workforce-0.2.2-py3-none-any.whl

Download URL merge_workforce-0.2.2-py3-none-any.whl
Size 38.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
69ca233cac1a963aa29ee9df80f1fd666eb436b3542fba61633dabcbdde7ec77
BLAKE2b-256 checksum
How to use checksums
2e00176259d8ce4e895d1dd842b3d925b6f2973fff4c72a0f3db1072c50faa74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 20, 2026.

Transparency log

Security for merge-workforce 0.2.2

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_workforce-0.2.2.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 Oct 20, 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.

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