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

Before the first PyPI release you can install straight from the repo: 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.

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.

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

Built distribution (wheel)

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

Total release size: 43.4 kB

Release files / merge_workforce-0.1.0.tar.gz

Download URL merge_workforce-0.1.0.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9c9849a6a677ff9497c00af49e9078532250dc6f80568f4b134d1d64f57b42b8
BLAKE2b-256 checksum
How to use checksums
e3064a61480743d2c1d199d8dc9e55467fcc79e9cba0cbe48c5d532352e2b9cf
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 9, 2026.

Transparency log

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

Download URL merge_workforce-0.1.0-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5fb2506bbb5dec330deca10d1429917d483a5bc3e9b2de3629116249a48634e3
BLAKE2b-256 checksum
How to use checksums
493056ce0ac85be74b427001d1bf628b3d7c71dd3fedd1c55bb9e566d06ac251
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 9, 2026.

Transparency log

Security for merge-workforce 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_workforce-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 9, 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