Skip to main content

Merge for Workforce CLI (mfw)

A command-line tool for Merge for Workforce employees: log in with your IdP, get a Gateway credential, and use your provisioned models and tools from the terminal.

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 login --gateway-url https://ah-api.merge.dev   # opens your browser to sign in
mfw setup                                          # provision this device's Gateway credential
mfw models                                         # list the models you can use
mfw ask  -m openai/gpt-4o-mini "hello"             # one prompt to a chosen model
mfw chat -m openai/gpt-4o-mini "use my tools to …" # an agent that can call your provisioned tools

Set MFW_GATEWAY_URL once and you can drop --gateway-url from every command.

You must be a provisioned employee. mfw setup mints your key only once your admin has activated Merge for Workforce and your group has a Gateway project. If setup 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 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 ask -m <id> "…" Send one prompt to a chosen model through the Gateway.
mfw chat -m <id> "…" Run an agent that can call your provisioned tools (MCP tool loop).
mfw mcp [--write .mcp.json] Emit an MCP config so an external client (Claude Code, Cursor) can use your tools.
mfw run -- <cmd> … Run a command with the Gateway credential injected as env (OpenAI-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 chat is a built-in agent — it drives a model through the Gateway and calls your provisioned tools over MCP, no other client needed.

  • 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.

For OpenAI-SDK tools, mfw run -- <command> injects OPENAI_API_KEY / OPENAI_BASE_URL pointed at the Gateway, so the tool routes through it unchanged.

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.
  • Models are the maintained /v1/responses surface; chat connects your provisioned tools over the backend's OAuth-authed /mcp/ endpoint and runs the function-calling loop for you.

Metadata

Release files for merge-workforce 0.1.1

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.1.1
File Size Uploaded Provenance
merge_workforce-0.1.1.tar.gz 22.3 kB With provenance Details

Built distribution (wheel)

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

Total release size: 45.9 kB

Release files / merge_workforce-0.1.1.tar.gz

Download URL merge_workforce-0.1.1.tar.gz
Size 22.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f33de40c97e98e05b93f93f0c0abd6c7ea9b336eb3624395245c56777a818c56
BLAKE2b-256 checksum
How to use checksums
45e3c73471f3f71f4577ba2e90b40c5452ba2671f670707e3eaf148944614ffd
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 10, 2026.

Transparency log

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

Download URL merge_workforce-0.1.1-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbcafb3248d95c4ae91d1c06c246cce81b7c26951b7ed2552c95386f057cf9f3
BLAKE2b-256 checksum
How to use checksums
213aef3aa09103714cfee517bca408c6c9f57bc1edfd77fec0b7c63fee301389
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 10, 2026.

Transparency log

Security for merge-workforce 0.1.1

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.1.1.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 10, 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