When a rep asks Claude to create an opportunity, Claude should call a governed Create Opportunity tool, not guess how your Opportunity object works. Click through the full build, from the Apex action to the approved write, then take the playbook.
Walkthrough screens are an illustrative JayOh recreation with fictional data, not the live products. Setup steps follow Salesforce’s Hosted MCP Servers documentation.
The right pattern for any Salesforce org where Claude writes to the CRM.
Why freeform writes break data: what happens when Claude creates records with generic SObject tools.
Apex to MCP tool: turn an @InvocableMethod into a tool on a custom Salesforce MCP server.
Approval by design: how tool annotations and Claude permissions keep every write reviewed.
The rollout: what JayOh builds, the action library we start with and what we measure.
Start in Salesforce with what freeform writes leave behind, build the Apex-backed server, connect it to Claude, then follow one request from plain English to a clean record. Click Next or use your arrow keys.
Illustrative recreation of Salesforce Setup, Lightning Experience and the Claude app with fictional data (Brightline Software). Not the actual products; labels can change between releases.
What an admin, a developer and a rep each see.
Six opportunities Claude created with generic SObject tools; only one is clean.
An @InvocableMethod with a plain-language description and only the inputs Claude may send.
Standard servers are off by default and can't be edited. Custom ones can.
Label, permanent name and a description that scopes what the server is for.
Add Server Assets, Add Tools, Apex actions: four in, two left out on purpose.
Read-only and Idempotent hints, then activate and copy the server URL.
External Client App with Claude's callback URL, two scopes and PKCE.
Customize, Connectors, Add custom connector, then sign in to Salesforce.
Claude groups tools by annotation: read-only always allowed, writes need approval.
Claude picks Create Opportunity and shows the five inputs before it runs.
Your Apex answers: CREATED, the record Id and the duplicate check.
Discovery stage, a price book line, an audit stamp and the rep as owner.
Pilot defaults JayOh starts with. Your action count depends on which tasks reps ask Claude to do most.
Salesforce’s standard MCP servers give Claude general tools: query records, create records, update records. They respect field-level security and sharing, so they’re safe in the access sense. But they don’t know your process. Claude fills in stage, close date, amount and record type from context, and a guess that passes validation still becomes bad pipeline.
Salesforce now documents a better pattern. A custom MCP server can expose Apex invocable actions, flows and Apex REST methods as tools. Claude calls Create Opportunity, and your code decides how an opportunity gets created.
global class with an @InvocableMethod, a plain-language description and only the inputs Claude may send.https://claude.ai/api/mcp/auth_callback, scopes refresh_token and mcp_api, PKCE required.No freeform write tools on any server reps use. Standard SObject servers stay read-only; every write goes through an action you can test, version and audit.
Both run as the signed-in user. Only one knows your process.
| Standard SObject tools (create_records, update_records) | Custom server with Apex actions | |
|---|---|---|
| What Claude can write | Any field on any object the user can edit | Only the inputs each action defines |
| Business rules | Validation rules and flows only; everything else is Claude’s guess | Coded once in Apex: stage, price book, owner, defaults |
| Duplicates | Whatever your duplicate rules catch | The action checks first and returns the existing record |
| Permissions | The user’s profile, field-level security and sharing | The same, when the class runs with sharing and user-mode DML |
| Approval in Claude | Grouped with every other write | Per tool, with annotations Claude reads |
| Best for | Questions, lookups and reporting | Every write a rep asks for |
The actions JayOh usually ships first. Each one does a single task.
Sets stage, price book, close date and primary contact; returns the open opportunity if one exists.
Logs the meeting, next step and next-step date in one call, so activity history stays complete.
Moves one stage forward only when that stage’s exit criteria are filled in.
Lists missing fields and exit criteria for the next stage. Safe to always allow.
Submits a discount into your approval process instead of editing the price.
Builds the renewal from the contract with the right term, products and owner.
Four patterns we fix most often.
The broadest server gets turned on first and reps start creating records through it.
Standard servers answer questions. Every write goes through a custom server.
“Inserts Opp via service layer” tells Claude nothing about when to use it.
Say what the tool does, when to use it and what it returns, in plain language.
A generic “update opportunity” action with 40 optional inputs is freeform editing with extra steps.
Small actions with required inputs. Claude picks better and you test less.
Writes run silently before anyone has checked what Claude sends.
Loosen one tool at a time once the MCP-created records report stays clean.
It is a tool on a custom Salesforce MCP server that is backed by Apex, most often a global method annotated with @InvocableMethod. Salesforce builds the tool schema from the method's inputs and outputs, and an AI client like Claude calls it by name. The Apex decides how records are created or changed, so Claude never edits objects freeform.
Salesforce runs the action as the user who signed in through OAuth, so governor limits and sharing apply. Build the class with sharing and use user-mode queries and DML so field-level security is enforced too. Each rep connects with their own Salesforce login, so Claude can only do what that rep can do.
Not necessarily. Standard servers such as SObject Reads are useful for questions and lookups. The pattern JayOh recommends is to read with standard tools and write only through a custom server of Apex actions, so every write follows your process.
Custom servers can expose Apex invocable actions, AuraEnabled Apex methods, Apex REST methods, autolaunched flows, APIs from API Catalog, Agentforce agents and prompt templates. Use Apex or flows for anything with business rules or more than one step.
Create an External Client App with the callback URL https://claude.ai/api/mcp/auth_callback, the refresh_token and mcp_api scopes and PKCE required. In Claude, add a custom connector with the server URL from Setup, choose your own OAuth client and enter the app's consumer key as the OAuth Client ID, then connect and sign in to Salesforce.
We build the action library, the custom MCP server and the Claude setup, then run a two-week pilot with one team.
We engineer growth systems. JayOh builds the RevOps architecture, GTM execution and data infrastructure that turn messy revenue operations into predictable pipeline for B2B SaaS and PE-backed teams.