Salesforce. Agent-Native.
Accounts. Contacts. Leads. Opportunities. SOQL. Bulk API. Apex. Full Salesforce CRM control from the terminal.
The official Salesforce CLI (sf/sfdx) is a developer toolchain for deploying Apex and running CI/CD — not for agents that need to query pipeline, create leads, or run bulk imports.
So we built salesforce-crm-cli — 102 commands across 20 groups, every one also registered as an MCP tool, wired for autonomous CRM access from day one.

Why salesforce-crm-cli Exists
Not to be confused with the official @salesforce/cli. That tool ships Apex, manages scratch orgs, and powers CI/CD pipelines — built for Salesforce developers. This is built for the rest of us: agents that need to read and write CRM data.
Without salesforce-crm-cli
- Hand-rolled REST calls — auth, retries, rate-limit, pagination, all bespoke
- SOQL response parsing is verbose — nested records, attributes envelopes, null fields
- Bulk imports require multi-step job orchestration agents constantly get wrong
- Custom objects need code changes — no generic CRUD layer for
Custom__c - No MCP wrapper — every agent integration starts from scratch
With salesforce-crm-cli
- 102 commands with flat, JSON-first output — no envelopes, no nested parsing
- SOQL, SOSL, Bulk API 2.0, Composite, and Apex all live behind the same interface
- Generic
sobjectscommands handle any custom object out of the box - 102 MCP tools — plug directly into Claude Code, Claude Desktop, or Cursor
- Zod-validated inputs on every command — agent calls fail loudly, not silently
What Your Agent Can Do
102 commands across 20 groups — every Salesforce CRM operation your agent needs.
Core CRM Object CRUD
Accounts, contacts, leads, opportunities, cases, tasks, events, campaigns, users — each with list/get/create/update/delete/search/describe. Every record type your agent needs to read or write, behind one consistent JSON-first interface.
SOQL Queries with Aggregates
Run any SOQL — GROUP BY, HAVING, subqueries, date literals like THIS_QUARTER, dot-notation relationships. Agents pull pipeline totals, win rates, contact rollups, and analytic reports in one shot. Cursor-paginate huge result sets with `query more`.
SOSL Full-Text Search
Search across every searchable Salesforce object in a single query — find a name across accounts, contacts, leads, and opportunities at once. Get auto-complete suggestions for a partial string. Agents resolve "find Acme" without knowing which object holds it.
Generic & Custom SObject Ops
Work with any SObject type — including custom objects like MyObject__c. List, describe, get, create, update, delete, upsert by external ID. No code changes to support every custom field your org has bolted onto Salesforce over the years.
Bulk API 2.0 — Mass Operations
Upload thousands of records per job, monitor progress, fetch successful/failed results. Insert, update, upsert, or delete via CSV. Run bulk SOQL exports for entire object tables. The right tool for any agent task that crosses the 200-record threshold.
Composite API — Chained Calls
Multiple Salesforce API calls in a single HTTP request — with cross-request references. Create an account and a child contact that references its ID in one round trip. Submit up to 200 records as a collection. Build atomic, multi-object workflows your agent runs in milliseconds.
Apex Execution + Test Runs
Execute anonymous Apex from the terminal. Call custom Apex REST endpoints. Trigger test classes and fetch results by run ID. Your agent debugs production logic, fires custom server-side workflows, or runs the test suite as part of a CI check — without leaving the CLI.
MCP Server Mode
102 MCP tools registered for direct AI agent connectivity. Run salesforce-crm-cli as an MCP server and give Claude, Cursor, or any MCP-compatible agent full Salesforce CRM access with one config entry. Zod-validated inputs on every tool — no malformed payloads slipping through.
Agent Workflows
Real use cases — what your agent can run autonomously today.
Lead-to-Opportunity — Full Pipeline Creation
“Jane Doe at Acme just booked a discovery call. Create her as a lead, spin up an opportunity, and set me a follow-up task.”
Agent creates the lead, finds (or creates) the parent account, opens the opportunity at Prospecting, and schedules a follow-up task. Three Salesforce objects, one prompt, zero clicks.
salesforce leads create --first-name "Jane" --last-name "Doe" --company "Acme" --email "jane@acme.com" --source "Web"Create the lead with attribution source
salesforce opportunities create --name "Acme Corp — Enterprise" --stage "Prospecting" --close-date "2026-06-30" --amount "75000" --account-id "001xx000003GYQIAA4"Open the opportunity at $75K Prospecting
salesforce tasks create --subject "Discovery call with Jane" --due-date "2026-05-28" --priority "High" --what-id "006xx000001TNEAAA4"Schedule follow-up task on the opp
SOQL Analytics — Pipeline by Stage
“Show me total pipeline by stage this quarter, sorted by amount.”
Agent runs an aggregate SOQL query with GROUP BY, SUM, and a date literal — returns the full pipeline breakdown as structured JSON. No report builder, no exported CSV, no dashboard refresh.
salesforce query run --soql "SELECT StageName, COUNT(Id) Total, SUM(Amount) TotalAmount FROM Opportunity WHERE CloseDate = THIS_QUARTER GROUP BY StageName ORDER BY SUM(Amount) DESC" --prettyAggregate pipeline by stage with totals
salesforce query run --soql "SELECT Owner.Name, COUNT(Id) Deals, SUM(Amount) Total FROM Opportunity WHERE CloseDate = THIS_QUARTER GROUP BY Owner.Name" --prettySame view rolled up by sales rep
salesforce query explain --soql "SELECT Id FROM Opportunity WHERE CloseDate = THIS_QUARTER"Inspect query plan and notes before running heavy reports
Bulk CSV Import — Mass Contact Load
“Here's a CSV of 5,000 new contacts from the trade show. Load them all into Salesforce and link them to existing accounts.”
Bulk API 2.0 handles record loads above the 200-row REST limit. Agent creates an ingest job, uploads the CSV, closes the job, monitors status, and fetches the success/failure breakdown when finished — all without leaving the terminal.
salesforce bulk ingest-create --sobject Contact --operation insertOpen a Bulk API 2.0 insert job
salesforce bulk ingest-upload --job-id 7500x000000xxxxAAA --csv "FirstName,LastName,Email,AccountId\nJane,Doe,jane@acme.com,001xx000003GYQ\n..."Upload the 5K-row CSV payload
salesforce bulk ingest-close --job-id 7500x000000xxxxAAAMark job ready for processing
salesforce bulk ingest-status --job-id 7500x000000xxxxAAAPoll until status = JobComplete
salesforce bulk ingest-results --job-id 7500x000000xxxxAAA --type failedPull the rows that failed so the agent can retry
Account Discovery — Find a Company + All Contacts
“Find every account with "Acme" in the name and pull all their contacts.”
Agent searches accounts by partial name, then queries contacts filtered by account ID — returns the full org chart for every matching company. No exports, no manual joins, no copy-paste between tabs.
salesforce accounts search --where "Name LIKE '%Acme%'" --prettyFind every matching account
salesforce contacts list --where "AccountId = '001xx000003GYQIAA4'" --prettyPull every contact under the matched account
salesforce query run --soql "SELECT Name, (SELECT FirstName, LastName, Email, Title FROM Contacts) FROM Account WHERE Name LIKE '%Acme%'" --prettyOr do it in one nested SOQL query with a subquery
Composite Workflow — Atomic Multi-Object Create
“Create a new account, then a contact under it, in a single API call so neither orphans if the other fails.”
Composite API lets agents chain calls with cross-request references — @{newAccount.id} in the second call resolves from the first. One HTTP round trip, all-or-nothing semantics, no rollback logic in your agent code.
salesforce composite run --requests '[{"method":"POST","url":"/services/data/v62.0/sobjects/Account","referenceId":"newAccount","body":{"Name":"Acme Corp"}},{"method":"POST","url":"/services/data/v62.0/sobjects/Contact","referenceId":"newContact","body":{"LastName":"Smith","AccountId":"@{newAccount.id}"}}]'Account + Contact in one atomic request
salesforce composite tree --sobject Account --records '[{"attributes":{"type":"Account"},"Name":"Parent Corp","Contacts":{"records":[{"attributes":{"type":"Contact"},"LastName":"Smith"}]}}]'Or use the tree endpoint for parent + nested children
salesforce composite collection --method create --records '[{"attributes":{"type":"Lead"},"LastName":"Jones","Company":"ACME"},{"attributes":{"type":"Lead"},"LastName":"Brown","Company":"Globex"}]'Or batch up to 200 records in one collections call
Quick Start
1Install
npm install -g salesforce-crm-cli
# Or run without installing
npx salesforce-crm-cli accounts list --pretty2Authenticate
Three ways to authenticate — CLI flags, environment variables, or stored config. Token + instance URL is the fastest path.
# Option A — environment variables (recommended)
export SALESFORCE_ACCESS_TOKEN="your_token"
export SALESFORCE_INSTANCE_URL="https://yourorg.salesforce.com"
salesforce status
# Option B — store config locally
salesforce login \
--access-token your_token \
--instance-url https://yourorg.salesforce.com
# Option C — OAuth username/password flow
salesforce login \
--client-id <connected_app_consumer_key> \
--username <you@yourorg.com> \
--password <password+security_token>3First commands
# Verify auth and check API limits
salesforce status
salesforce limits get --pretty
# Pull 10 most recent accounts
salesforce accounts list --limit 10 --pretty
# Run a SOQL query
salesforce query run --soql "SELECT Id, Name, Amount FROM Opportunity WHERE StageName = 'Prospecting'"
# Create a lead
salesforce leads create --first-name "Jane" --last-name "Doe" --company "Acme" --email "jane@acme.com"Commands Reference
102 commands across 20 groups. The 9 core CRM objects share the same 7-command shape (list, get, create, update, delete, search, describe).
CRM objects (9 groups · 63 commands)63 commandsaccounts *Account — Name, Type, Industry, Phone, Website, AnnualRevenuecontacts *Contact — FirstName, LastName, Email, Phone, Title, AccountIdleads *Lead — FirstName, LastName, Company, Email, Status, LeadSourceopportunities *Opportunity — Name, StageName, Amount, CloseDate, AccountIdcases *Case — Subject, Status, Priority, Origin, ContactId, AccountIdtasks *Task — Subject, Status, Priority, ActivityDate, WhoId, WhatIdevents *Event — Subject, StartDateTime, EndDateTime, Location, WhoIdcampaigns *Campaign — Name, Type, Status, StartDate, EndDate, BudgetedCostusers *User — Username, Name, Email, IsActive, ProfileIdquery3 commandsquery runExecute any SOQL query — aggregates, joins, subqueries, date literalsquery explainGet query plan and feedback notes before running heavy reportsquery morePaginate large SOQL result sets via cursor URLsearch2 commandssearch runExecute SOSL across multiple objects in one querysearch suggestAuto-complete suggestions for partial stringssobjects7 commandssobjects listList every SObject type in the orgsobjects describeFull metadata — fields, types, picklist values, relationshipssobjects getGet any record by SObject type + ID (including custom objects)sobjects createCreate any record — raw JSON bodysobjects updateUpdate any record — raw JSON bodysobjects deleteDelete any recordsobjects upsertUpsert by external ID — ideal for idempotent agent writesbulk8 commandsbulk ingest-createOpen a Bulk API 2.0 ingest job (insert/update/upsert/delete)bulk ingest-uploadUpload CSV payload to an open jobbulk ingest-closeMark job ready for processingbulk ingest-statusPoll job status until JobCompletebulk ingest-resultsFetch successful/failed/unprocessed result rowsbulk query-createStart a bulk SOQL query job for huge result setsbulk query-statusCheck query job progressbulk query-resultsDownload query results once completecomposite4 commandscomposite runMultiple API calls in one request, with cross-request referencescomposite batchRun up to 25 independent subrequests in parallelcomposite treeCreate a parent + nested children in one atomic callcomposite collectionCreate/update/delete up to 200 records in one callreports5 commandsreports listList all reports in the orgreports getGet report metadatareports runExecute a report and return resultsreports dashboards-listList all dashboardsreports dashboards-getGet dashboard metadata + component valuesapex4 commandsapex executeRun anonymous Apex code in the orgapex restCall a custom Apex REST endpointapex test-runKick off Apex test classes by IDapex test-resultsFetch test results by run IDlimits3 commandslimits getAPI limits and current usage for the orglimits versionsAll supported Salesforce API versionslimits resourcesAll available REST resources* Each CRM object group has 7 commands: list, get, create, update, delete, search, describe.
MCP Server Setup
Add salesforce-crm-cli as an MCP server to give Claude or Cursor full Salesforce access — all 102 commands available as native, zod-validated tools.
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"salesforce": {
"command": "npx",
"args": ["salesforce-crm-cli", "mcp"],
"env": {
"SALESFORCE_ACCESS_TOKEN": "your-token-here",
"SALESFORCE_INSTANCE_URL": "https://yourorg.salesforce.com"
}
}
}
}Claude Code (CLI)
claude mcp add salesforce -- npx salesforce-crm-cli mcpMake sure SALESFORCE_ACCESS_TOKEN and SALESFORCE_INSTANCE_URL are set in your environment before running Claude Code.
Cursor / VS Code
Add to .cursor/mcp.json or .vscode/mcp.json in your project:
{
"mcpServers": {
"salesforce": {
"command": "npx",
"args": ["salesforce-crm-cli", "mcp"],
"env": {
"SALESFORCE_ACCESS_TOKEN": "your-token-here",
"SALESFORCE_INSTANCE_URL": "https://yourorg.salesforce.com"
}
}
}
}Want us to build this into your stack?
We set up salesforce-crm-cli as part of your OpenClaw agent infrastructure — wired to your pipeline, lead routing, and GTM motion. Your Salesforce becomes a live, agent-readable system of record.