Set up the operator CLI and MCP server
Install the operator command, sign in to your organization, verify the credential, connect an agent through the MCP server, and use API tokens for headless runs.
This guide installs the operator command, signs it in to your organization, and connects an agent to Operator through the MCP server. At the end, you and your agent can list, follow, steer, continue, and rerun Operator jobs, and, with a full login, run plans. The CLI acts with the same authority as the app: it runs as you, with your current role and your organization's Operator settings and budgets. Approving what Operator proposes always stays in the app: the CLI prints the approval link instead.
Starting a new job from the terminal or an agent is coming in a later release. Today a job starts in the app, from a released plan, or by rerunning a saved procedure.
Before you begin
You need:
- Node.js 20 or later;
- an admin or member role in your organization, with Operator switched on there. Guests cannot use Operator or sign in for it;
- to create and release plans or tick gates from the CLI, staff standing in your organization's tracker as well. Organization administrators have it by default; other members need a staff grant from a tracker administrator;
- for an agent, an MCP client such as Claude Code.
The infraone operator command is part of @allocator-one/infraone, which also provides infraone harness, the issue-tracker client. Both share one login. If you installed the retired @allocator-one/operator or @allocator-one/harness-cli package, remove it first with npm rm -g @allocator-one/operator @allocator-one/harness-cli: it installs the same operator and harness commands as the new package.
Install the CLI
-
Install the package globally:
npm i -g @allocator-one/infraone infraone operator --helpThe help lists the Operator commands first, then the issue-tracker commands under "Issues:", then sign-in and housekeeping under "General:".
To run it without installing, use
npx -y @allocator-one/infraone operator --help. A global install upgrades itself when the server refuses an outdated version; annpxrun never upgrades itself.
Sign in
-
In a terminal, run:
infraone operator loginYour browser opens Authorize the harness CLI on
harness.infra.one. If you are not signed in to Infra One, sign in first. -
Under Organization this login can reach, select your organization, then select Authorize. The credential is bound to that organization for its whole life.
The terminal confirms the login and where it stored it. A login acts as you and lasts about 30 days. What it reaches depends on your standing in that organization's tracker:
- Full login. With staff standing, the login carries every scope the commands need, including
operator:readandoperator:write, and reaches Operator, plans, and the issue tracker. - Operator only. Members without staff standing get an Operator-only login, and the page tags their organization Operator only: "the login runs Operator for you in that organization and reaches nothing else in Harness." It carries
operator:readandoperator:write. The job, control, procedure, and catalog commands work; the plan and gate commands are refused.
Leaving the organization ends both kinds of login.
Signing in with an Operator-only login needs a newer CLI than 1.15.0, which is coming in a later release. Version 1.15.0 checks every new login against the tracker, which an Operator-only login cannot reach, so the sign-in stops with "the received token failed verification (This token may not access the Harness API, HTTP 403) — nothing was stored". A full login works with 1.15.0.
On a machine without a browser, run
infraone operator login --no-browser, open the printed URL elsewhere, select Authorize, and paste the token the page shows once. - Full login. With staff standing, the login carries every scope the commands need, including
-
Check the credential:
infraone operator jobs --mine infraone operator whoamijobslists your Operator jobs, or says there are none. With a full login,whoamishows the host, where the credential came from, andVerified: ok.
In an interactive terminal, a command that needs a credential and finds none starts this login itself and then carries on; whoami only says how to sign in. Outside a terminal, in an agent, a pipe, or whenever CI is set, the CLI never opens a browser: it prints how to sign in and exits 2.
Connect an agent
-
Register the MCP server with your agent. For Claude Code:
claude mcp add --scope user operator -- npx -y @allocator-one/infraone operator mcpWith a global install,
infraone operator mcpworks as the command instead of thenpxform. Any other MCP client takes the same command:{ "mcpServers": { "operator": { "command": "npx", "args": ["-y", "@allocator-one/infraone", "operator", "mcp"] } } }Register
infraone operator mcporinfraone harness mcp, not both. They serve the same tools, so registering both shows every tool twice. -
Restart the agent and ask it to list your Operator jobs. It calls the
jobs_listtool and gets the same jobs asinfraone operator jobs.
The MCP server uses your terminal login and checks it on every call, so signing in while the agent runs takes effect without a restart. It never opens a browser. Without a credential, its tools return an error that asks for a terminal login or an API token.
Give the agent one rule up front: it can follow, steer, continue, and rerun jobs, but approving a change set happens in the app. When a job waits for approval, the agent hands a person the approval_url. The tools act with your login: the plan and gate tools need a full login, as their commands do. There is no tool that starts a new job yet; one is coming in a later release.
Run headless with an API token
When no person is at a terminal, such as in CI or a server-side agent, use an aone_ API token instead of a login.
- Who needs one. People don't: every admin and member signs in with
infraone operator login. A token is for runs without a person at a terminal. - Who creates it. API tokens are not self-service: Infra One's platform administration creates them. A token with Operator scopes is bound to one organization. Every token has an expiration (never, 7, 30, or 90 days) and is shown once.
- Scopes.
operator:readlists and follows jobs and browses Operator's capabilities and skills.operator:writesteers, pauses, cancels, continues, saves, and reruns jobs; approving a change set stays in the app. Addharness:readforplan show, andharness:writeto create, edit, release, or hold plans and tick gates. - Whose rights. A token acts as the person who created it. For the Operator commands, that person needs an admin or member role in the token's organization.
Export it in the environment of the headless run only:
export HARNESS_API_TOKEN=aone_…
Never set HARNESS_API_TOKEN or HARNESS_ACTOR in an interactive session. The browser login attributes every write to you; overriding it falsifies the audit trail.
Success check
infraone operator jobs --mineexits0.- With a full login,
infraone operator whoamishowsVerified: okfor the organization you chose. - Your agent lists the
operatorserver's tools once, and itsjobs_listcall returns the same jobs as the CLI.
Troubleshooting
- The sign-in page says "No organization to authorize". You are neither tracker staff nor an Operator member in any organization: you are a guest, or Operator is switched off where you are a member. Ask an organization administrator for access, then run
infraone operator loginagain. - The sign-in stops with "the received token failed verification (This token may not access the Harness API, HTTP 403)". You chose an organization tagged Operator only, and CLI 1.15.0 cannot store an Operator-only login. Nothing was stored. A CLI release that accepts it is coming.
- The sign-in page says "Your access to this organization changed, so nothing was authorized." Your role changed while the page was open. Reload it to see what you can authorize now.
- A hint says to run
infraone harness login, but you useinfraone operator. Runinfraone operator login. Both commands are the same program, and some messages still nameharness. - A plan or gate command answers
403with "This token may not access the Harness API". The login is Operator-only. Plans and gates need a full login, which needs staff standing in the organization's tracker. - A command exits
2with "Not signed in" inside an agent or CI. Sign in from a terminal withinfraone operator login, or setHARNESS_API_TOKENfor the headless run. - An Operator command answers
403 operator_not_permitted. You have no admin or member role in the organization the credential is bound to.403 operator_disabledmeans Operator is switched off for the organization.403 forbiddenmeans the credential lacks the scope; an API token must be created with it. whoamifails verification with an API token that works for Operator commands.whoamichecks the credential against the tracker, which needsharness:read. A token with only Operator scopes fails that check.- Every tool appears twice in the agent. Remove either the
harnessor theoperatorMCP registration. - The CLI asks "This repo's config … targets … log in there?" A committed
.harness-cli/config.jsonnames another host. Answeryonly if you trust that host, or setHARNESS_API_URL.
For every refusal and exit code, see Troubleshoot Operator from the CLI and agents.