Firmary

v1.0.1
app.firmary/mcp Checked 4 days ago Published 22 days ago

Work with an accounting firm's clients, engagements, tasks, documents, messages and billing.

Secure local stdio bridge for hosted Firmary MCP. It lets a local MCP client (Codex or Claude Code) talk to Firmary over the Model Context Protocol without ever handling a Firmary credential yourself. The bridge is remote-only: it forwards newline-delimited JSON-RPC from your client to the single hosted Firmary MCP endpoint and returns the responses unchanged. It implements no tools of its own. Firmary is its own OAuth 2.1 authorization server, so there is one server URL per environment and one sign-in. The Firm is chosen when you approve the connection, not typed into a URL:

Summary extracted from the README.

@firmary/mcp

Secure local stdio bridge for hosted Firmary MCP. It lets a local MCP client (Codex or Claude Code) talk to Firmary over the Model Context Protocol without ever handling a Firmary credential yourself.

The bridge is remote-only: it forwards newline-delimited JSON-RPC from your client to the single hosted Firmary MCP endpoint and returns the responses unchanged. It implements no tools of its own.

Firmary is its own OAuth 2.1 authorization server, so there is one server URL per environment and one sign-in. The Firm is chosen when you approve the connection, not typed into a URL:

Environment MCP server URL
production https://os.firmary.app/api/mcp
preview https://pre-os.firmary.app/api/mcp
development https://dev-os.firmary.app/api/mcp

Hosted MCP clients (Claude, ChatGPT, Codex web) do not need this package at all -- paste the server URL above into the client's "add MCP server" field and sign in there. The bridge exists for local stdio clients that cannot do remote OAuth themselves.

Requirements

  • Node.js 20.11 or newer (npx is used to run the published package).
  • A working operating-system credential store (macOS Keychain, Windows Credential Manager, or a Linux Secret Service such as GNOME Keyring / KWallet). The bridge stores its sign-in only there. Headless machines without an unlocked keychain cannot use the bridge; see KEYCHAIN_UNAVAILABLE below.
  • A default browser for the one-time sign-in.

Guided setup

Run the guided connect command with the client you use:

npx @firmary/mcp connect --client codex
# or
npx @firmary/mcp connect --client claude-code

What happens:

  1. The bridge resolves the single hosted Firmary MCP endpoint for the chosen environment from its built-in map. There is no server URL to type and no way to point the bridge at another host.
  2. It starts a loopback callback listener on an ephemeral 127.0.0.1 port and opens your system browser to Firmary's sign-in page (Authorization Code with PKCE S256, resource-bound to that endpoint, scope firmary.mcp offline_access). Sign in, choose the Firm, and approve the connection there; multi-factor authentication is enforced by Firmary.
  3. The browser returns to the loopback listener. The bridge verifies the state and issuer (RFC 9207), exchanges the code, and stores the resulting tokens as one record in your OS keychain. Nothing is written to disk in plaintext.
  4. With --client, the bridge registers itself with your MCP client using that client's own fixed command (codex mcp add ... or claude mcp add ...). Omit --client to skip this step and see the connection ID for manual configuration.

Optional flags: --environment production|preview|development (default production). Only these hosted environments exist; each maps to a code-owned Firmary origin, which is also the only authorization server the bridge will accept for that environment.

Afterwards your client runs the bridge as:

npx -y @firmary/mcp serve --connection <environment>

The older per-firm address (https://<origin>/api/mcp/tenants/<tenant-id>) is deprecated and connect no longer accepts --tenant. A connection stored as tenant:<environment>:<tenant-id> keeps serving until Firmary retires that address on its announced date; serve, status, and disconnect print a one-line notice on stderr naming the replacement. Reconnect once with npx @firmary/mcp connect --environment <environment> to move to the single URL.

Access tokens are refreshed automatically with rotating refresh tokens; you do not need to sign in again until the connection is revoked or disconnected.

Commands

Command What it does
connect [--environment ...] [--client ...] Browser sign-in for the single hosted endpoint, keychain storage, optional client registration.
serve --connection <connection-id> Stdio bridge used by the MCP client. Only JSON-RPC bytes go to stdout; diagnostics go to stderr.
status --connection <connection-id> Prints whether the connection is signed in and when the access token expires (JSON on stdout).
doctor Prints the package version and whether the OS credential store is usable (JSON on stdout).
version Prints the package version and the hosted environment origins the bridge can talk to (JSON on stdout).
update Alias of version that also prints how to refresh: re-run connect; npx always runs the published release.
disconnect --connection <connection-id> Revokes the tokens at Firmary and deletes the keychain record.

Every command accepts only the options listed above. Unknown options, including anything that looks like a server URL, token, or executable, are rejected with INVALID_ARGUMENT.

Errors

Errors are short, fixed messages with a code and an action. They never include provider responses or tokens.

  • KEYCHAIN_UNAVAILABLE -- the OS credential store could not be opened. The bridge does not fall back to a file or environment variable; connect and serve fail closed. Unlock or enable your keychain (on Linux, ensure a Secret Service provider is running in your session), then run npx @firmary/mcp doctor to confirm and retry.
  • NOT_CONNECTED -- no keychain record for this connection; run connect.
  • OAUTH_FAILED -- the sign-in could not be completed or validated (wrong state/issuer, timeout, unsafe URL, or browser could not be opened). Run connect again.
  • UNSUPPORTED_CLIENT -- the requested client is not codex or claude-code, or its executable is not installed. Install the client, then run connect again.
  • REMOTE_UNAVAILABLE -- the hosted endpoint returned an error or could not be reached.

During serve, a failed request is answered on stdout with a JSON-RPC 2.0 error object carrying the original request id (-32600 for invalid input, -32000 for bridge or remote failures) and the session keeps running, so one bad request does not disconnect your client.

What the bridge deliberately does not do

  • There is no personal access token, API key, password, or environment-variable credential path. The only way to authenticate is the browser sign-in above.
  • There is no plaintext credential file. The keychain is the single store; if it is unavailable the bridge stops.
  • There is no arbitrary server or process. Endpoints come from the built-in environment map, the only accepted authorization server is that environment's own origin, the client registration commands are fixed, and the bridge exposes no local tools.

Supported clients

  • Codex (--client codex, registers via codex mcp add)
  • Claude Code (--client claude-code, registers via claude mcp add --transport stdio)

Other MCP clients can run the serve command directly as a stdio server after connect has succeeded. Clients that speak remote MCP with OAuth should use the server URL directly instead.

License

Proprietary; see LICENSE. You may install and run the package to connect MCP clients to Firmary.