Web application / Gusto

Gusto: Single-company OAuth mutexes, $0.00 GL clearing and Remote MCP

Public OpenAPI 3.1 (454 operations), SDK, and OAuth RFC 9728/8414 teardown of Gusto: single-company OAuth2 and refresh-token rotation locks, $0.00 Payroll Clearing GL math, receipt-vs-ACH divergences, contractor cutoff cancellations, and non-PII MCP scopes.

Contract model · conceptual sequence, not a claim about internal deployment
  1. Single-company OAuth + mutexed single-use refresh
  2. Prepare / Calculate / Submit -> $0.00 GL clearing
  3. Receipt vs ACH split + 72-tool scoped Remote MCP
01 / EMPIRICAL RECORD

Investigation question

How does Gusto enforce strict single-company OAuth2 with single-use refresh tokens, clear payroll General Ledger accounts against split ACH bank debits, expose discrepancy-prone Payroll Receipts, and scope its 72-tool Remote MCP server?

02 / EMPIRICAL RECORD

Observed

Inspecting Gusto’s App Integrations (138 operations) and Embedded Payroll (316 operations) OpenAPI 3.1.0 specifications, docs.gusto.com Markdown documentation, RFC 9728/8414 OAuth metadata on api.gusto.com and mcp.api.gusto.com, and 162 ESM modules in @gusto/embedded-api@0.16.3 maps strict auth, accounting, and agent constraints. First, since API v2023-05-01, every OAuth access token (7,200s TTL) is locked to one company (strict access), and refresh tokens are strictly single-use: exchanging a refresh_token immediately invalidates the prior token. Second, Gusto Remote MCP (https://mcp.api.gusto.com) advertises 39 OAuth scopes—including company_reports:read:excludes_sensitive_columns to strip tax IDs and bank details—and 72 documented tools (with list_payrolls filtering by pay period dates rather than check dates by default). Third, General Ledger reports (POST /v1/payrolls/{uuid}/reports/general_ledger) enforce the clearing identity DebitNetPay + DebitTax == RegularWages + EmployerTax, matching two separate bank-statement ACH pulls (GUSTO NET and GUSTO TAX) so Payroll Clearing nets to $0.00. However, MTL-mandated Payroll Receipts (/receipt) include company-paid taxes outside Gusto debits and check-paid employees excluded from ACH totals, causing naive receipt totals to diverge from bank withdrawals.

03 / EMPIRICAL RECORD

Inferred

Four engineering practices prevent production payroll bugs: (1) serialize all OAuth token refreshes per company behind a mutex/lock so concurrent 401 retries never burn a single-use refresh_token; (2) request company_reports:read:excludes_sensitive_columns for accounting or copilot MCP agents; (3) reconcile bank ACH lines against General Ledger report DebitNetPay and DebitTax accounts rather than Payroll Receipt sum(taxes[]) or gross employee_compensations[]; and (4) treat contractor payment group cancellation as atomic before the 4:00 PM PST cutoff because a single payment flipping to may_cancel=false rejects group-wide cancel.

04 / METHODOLOGICAL BOUNDARY

Unknown & limitations

This analysis covers public OpenAPI specifications, official docs.gusto.com guides, OAuth metadata endpoints, and the published @gusto/embedded-api@0.16.3 package; no live employer payroll run, ACH bank debit, Form 1099-NEC filing, or authenticated developer portal flow was executed.

05 / EMPIRICAL RECORD

Architecture

Gusto divides its surface into App Integrations (138 ops for company reads, payroll GL reports, contractors, and webhooks), Embedded Payroll (316 ops adding prepare/calculate/submit, reversals, receipts, ACH transactions, and US_1099 PDFs), Remote MCP (mcp.api.gusto.com with OAuth2 + PKCE S256 + DCR), and an unauthenticated docs assistant MCP (embedded-payroll.readme.io/mcp).

06 / EMPIRICAL RECORD

Domain & data models

General Ledger models EmployerTax, RegularWages, DebitNetPay, and DebitTax; NACHA exceptions classify Return Codes R01-R85 (re-opening clearing liabilities) versus Notification of Change C01-C13; ContractorPaymentGroup pairs preview creation_token with per-item may_cancel flags; and Form US_1099 renders annual PDFs.

07 / EMPIRICAL RECORD

Workflows & state machines

Payroll advances PUT /prepare -> /calculate -> /submit -> async GL report poll (POST -> GET /v1/reports/{request_uuid}) -> dual ACH pulls; contractor groups execute /preview -> create -> pre-4:00 PM PST all-or-nothing cancel; and webhooks complete a pending verification challenge before receiving up to 16 retries over 3 days (10s HTTP 2xx deadline).

08 / EMPIRICAL RECORD

API & protocol surfaces

454 OpenAPI 3.1.0 operations pinned via X-Gusto-API-Version (verified across @gusto/embedded-api@0.16.3 Speakeasy retry middleware), RFC 8414/9728 OAuth2 + PKCE + DCR at https://mcp.api.gusto.com (72 tools, 39 scopes), and signed webhook subscriptions.