---
title: "COUNT CLI · COUNT Partner API"
description: "The COUNT CLI bundles OAuth login and a local MCP server so Claude Code, Cursor, and other agent runtimes can read and write workspace data."
canonical: "https://developers.getcount.com/tools/count-cli"
source: "https://developers.getcount.com/tools/count-cli"
---
Tools

# COUNT CLI

The COUNT CLI (@countfinancial/cli) is the supported path for Claude Code, Cursor, and other agent runtimes. It bundles OAuth login and a local MCP server so agents can read and write workspace data without embedding secrets in MCP config files.

Agents vs web clients

Use the CLI for Claude Code, Cursor, and custom agents. For Claude.ai connectors or ChatGPT plugins, use the [remote MCP server](https://developers.getcount.com/tools/mcp) instead.

## Install

Install globally with npm. The binary is `count`.

Terminal

```bash
npm install -g @countfinancial/cli
```

## Prerequisites

- Node.js 18+ (Node 20+ recommended per the published package).
- A COUNT user account with access to the workspaces your agent needs.
- A partner app created in [COUNT Partners](https://app.getcount.com/count-partners).
- Redirect URI registered on that app: `http://127.0.0.1:17845/callback`. You can change the port with `count login --port`; the registered URI must match exactly.

See [API access credentials](https://developers.getcount.com/getting-started/credentials) for how to create a partner app and obtain your clientId and clientSecret.

### CLI setup flow

Terminal + browser

1. Install @countfinancial/cli with npm. Create a partner app in COUNT Partners and register the loopback redirect URI. Run count init with your clientId and clientSecret. npm install -g @countfinancial/cli count init \ --client-id "<client-id>" \ --client-secret "<client-secret>" [API access credentials →](https://developers.getcount.com/getting-started/credentials)
2. count login opens partner-signin in your browser. Pick the workspace the agent should access. Tokens are written to ~/.count/credentials.json with file mode 600. The redirect URI must match exactly: http://127.0.0.1:17845/callback count login [OAuth consent experience →](https://developers.getcount.com/getting-started/oauth-consent)
3. Run count mcp print-config after login succeeds. Paste the JSON into your agent MCP settings — no secrets are embedded in the config. The config points at count mcp, which loads credentials from ~/.count/credentials.json at runtime. count mcp print-config [MCP Server guide →](https://developers.getcount.com/tools/mcp)

## Commands

| Command | Description |
| --- | --- |
| count init | Save client_id and client_secret from COUNT Partners |
| count login | Browser OAuth login and token storage |
| count logout | Delete ~/.count/credentials.json |
| count status | Show whether credentials and tokens are present |
| count mcp | Start the local COUNT Partner MCP stdio server |
| count mcp print-config | Emit MCP JSON for Claude Code or Cursor |

## Credentials file

After `count init` and `count login`, credentials live at `~/.count/credentials.json` with file mode `600`. Refreshed access tokens are written back automatically during MCP sessions.

~/.count/credentials.json

```json
{
  "apiBaseUrl": "https://api.getcount.com",
  "clientId": "your-client-id",
  "clientSecret": "your-client-secret",
  "accessToken": "workspace-access-token",
  "refreshToken": "workspace-refresh-token",
  "workspaceId": "workspace-uuid",
  "workspaceName": "Acme Corp",
  "requestTimeoutMs": 30000
}
```

Examples use the production API base URL (api.getcount.com).

## Init and login examples

Pass `--api-url` during init to target the production API:

Terminal

```bash
count init \
  --client-id "<your-client-id>" \
  --client-secret "<your-client-secret>" \
  --api-url "https://api.getcount.com"
```

Sign in through the browser to store workspace tokens:

Terminal

```bash
count login
# Optional: custom callback port (must match a registered redirect URI)
count login --port 17845
# Optional: print the sign-in URL instead of opening a browser
count login --no-open
```

Run `count status` to verify credentials and tokens are present before configuring MCP.

## Next steps

- [MCP Server](https://developers.getcount.com/tools/mcp) — configure Claude Code or Cursor with `count mcp print-config`.
- [API access credentials](https://developers.getcount.com/getting-started/credentials) — create a partner app and register redirect URIs.
- [Quickstart](https://developers.getcount.com/getting-started/quickstart) — make your first signed API call.

## Troubleshooting

| Symptom | Fix |
| --- | --- |
| Invalid redirect uri during login | Add http://127.0.0.1:17845/callback to the partner app redirect URIs in COUNT Partners. |
| Partner credentials are not configured | Run `count init` with your clientId and clientSecret. |
| You are not logged in | Run `count login` to complete OAuth and store workspace tokens. |
| MCP tools return 401 | Run `count login` again to refresh stored tokens. |
| Windows: 'clientName' is not recognized during login | Upgrade to @countfinancial/cli@0.1.6 or later — older versions broke OAuth URLs containing &. |
| Windows: browser opens but login page shows an error | Upgrade to @countfinancial/cli@0.1.6 or later, or run `count login --no-open` and paste the full URL manually. |

See also [Errors & troubleshooting](https://developers.getcount.com/getting-started/errors) for REST API error codes.
