@patchops/cli
v0.1.0
Published
Command-line client for PatchOps MCP instance URLs.
Maintainers
Readme
PatchOps CLI
PatchOps CLI supports both of the main PatchOps execution surfaces:
- direct invoke over
/api/v1/invokefor automation-friendlyconnector + method + args - MCP over
/api/mcpfor tool discovery, raw MCP inspection, and sandboxed code execution
The CLI still starts from a PatchOps MCP URL such as:
https://patchops.ai/api/mcp/<instanceId>It supports two auth modes:
- PatchOps OAuth login against the shared MCP endpoint,
https://patchops.ai/api/mcp - Personal access token auth against a direct instance URL such as
https://patchops.ai/api/mcp/<instanceId>
That gives agents and local tools a normal CLI path without forcing them to speak MCP directly, while still leaving the MCP transport available when you need it.
Install
From npm, once the package is published:
npm install -g @patchops/cli
patchops helpFrom the repo:
npm install
npm run cli:build
node cli/dist/index.js helpTo expose a global patchops command from a local checkout:
cd cli
npm link
patchops helpBuild
From the repo root:
npm run cli:buildThe compiled binary is written to cli/dist/index.js.
To produce the npm tarball locally:
npm run cli:packConfigure
Log in with your PatchOps account through OAuth:
node cli/dist/index.js loginThis stores a refreshable CLI session and points the CLI at the shared MCP endpoint.
Set both the direct MCP URL and a personal access token with environment variables:
export PATCHOPS_URL="https://patchops.ai/api/mcp/<instanceId>"
export PATCHOPS_TOKEN="po_pat_..."Or store them locally:
node cli/dist/index.js config set-url "https://patchops.ai/api/mcp/<instanceId>"
node cli/dist/index.js config set-token "po_pat_..."You can inspect the current config with:
node cli/dist/index.js config showSign out and remove the stored OAuth session:
node cli/dist/index.js logoutCommands
Direct invoke for automation:
node cli/dist/index.js invoke welldatabase getOperatorWells --input '{"county":"Loving","operator":"Mitsui"}'
node cli/dist/index.js invoke postgres query --input '{"sql":"select now() as ts"}' --jsonList tools:
node cli/dist/index.js tools list
node cli/dist/index.js tools list corvaCall a built-in PatchOps tool over MCP:
node cli/dist/index.js call patchops_listSkills
node cli/dist/index.js call patchops_orgViewUsage --input '{"month":3,"year":2026}'Agent-friendly JSON output:
node cli/dist/index.js tools list --json
node cli/dist/index.js call patchops_listSkills --jsonExecute sandboxed connector code over MCP:
node cli/dist/index.js exec welldatabase ./examples/welldatabase.ts --timeout 60Clear just the stored token:
node cli/dist/index.js config clear-tokenRun a JSON-RPC batch file:
node cli/dist/index.js batch ./requests.jsonBatch files can be either:
[
{
"tool": "patchops_listSkills",
"input": {}
},
{
"tool": "patchops_orgListMembers",
"input": {}
}
]or raw JSON-RPC:
[
{
"jsonrpc": "2.0",
"id": "members",
"method": "tools/call",
"params": {
"name": "patchops_orgListMembers",
"arguments": {}
}
}
]Publish
Local publish:
cd cli
npm publish --access publicGitHub Actions publish:
- add an
NPM_TOKENrepository secret with publish access to the@patchopsscope - run the
Publish CLIworkflow frommain
