← All guides
Admin Setup Guide · MCP · Custom Servers

Custom MCP Servers
expose your own Apex, Flows & REST to Claude

The standard hosted MCP servers only give Claude generic CRUD. This guide covers building your own MCP server — bundling your Apex actions, Flows, and REST endpoints (plus any standard tools you want alongside them) under a single URL Claude can call.
Companion to the Salesforce MCP Server → Claude guide — do that one first if you haven't, since custom servers reuse the same permission set and External Client App.

⚠ Before you start Do this in a Developer Edition org or a Sandbox — never your production org. A custom server can expose whatever Apex or Flow logic you point it at, so treat every tool you add the same way you'd treat any other integration user.

You'll need Salesforce Hosted MCP Servers enabled (Setup → User Interface → Enable MCP Service (Beta), same switch as the companion guide) and the MCP Client User permission set from Phase 2 of that guide.
1Create the
Server Shell
2Add Your
Own Tools
3Bundle in
Standard Tools
4Activate
& Grant Access
5Test It
1
Create the Custom Server Shell
An empty container you'll fill with tools in the next phase. ~2 min
Custom vs. standard servers Standard servers (sobject-reads, sobject-all, etc.) are Salesforce's pre-built generic CRUD tools. A custom server is one you assemble — your own Apex actions, your own Flows, your own REST endpoints, optionally mixed with tools borrowed from the standard servers. Same OAuth model, same activation flow, just a different set of tools under the URL.
1
Open MCP Servers and start a new one

In Setup Quick Find, search MCP Servers and open it — the same "MCP Servers" area (under API Catalog) that lists the standard Salesforce Servers also has the option to build your own. Click Create Salesforce MCP Server.

2
Name it and write a real description

Label: something specific, e.g. Custom Sales Tools (the API Name auto-populates, e.g. CustomSalesTools). Description: "A custom MCP server with sales tools." — or whatever actually describes what's inside.

Click Create. You now have an empty server ready for tools.

2
Add Your Own Tools
Turn Apex you've already written — or Flows you've already built — into tools Claude can call. ~10 min
Asset typeWhat it isBest for
Apex Invocable ActionAn Apex method with @InvocableMethodMulti-step or complex business logic
Autolaunched FlowDeclarative automation you've already builtReusing existing automation, no code
@AuraEnabled methodAn existing Lightning component controller methodLogic already wired into a component
Apex REST endpointA class with @RestResourceIntegrations with an existing REST contract
API Catalog endpointAny REST API registered in your API CatalogThird-party or platform APIs already catalogued
1
Add a tool from the server page

On your new server, click Add Server Assets → Add Tools. Use the type dropdown to switch between Apex actions and Flows (and the other asset types above), then pick the specific action, Flow, or endpoint you want to expose.

Click Add Tool for each one, then Save. Repeat for every tool you want on this server — e.g. an Apex action like Create Account Sync Meeting Task alongside a Flow like Account Health Check Calculator.

2
Write descriptions like Claude is reading them — because it is

Whatever description sits on the underlying Apex method, Flow, or REST endpoint is what Claude sees when it's deciding which tool to call. Vague names and blank descriptions mean Claude either picks the wrong tool or ignores it entirely.

Why this matters Clear, specific descriptions help AI clients select the right tool at the right time. Write them the way you'd explain the tool to a new hire, not the way you'd name a variable.
3
Bundle in Standard Tools (Optional)
Mix generic CRUD from the standard servers in alongside your custom logic, all under one URL. ~3 min
Why bother? Without this, Claude needs two separate MCP connections — one for your custom tools, one for basic record lookups. Bundling a few standard tools in means one connection covers both, which is one less connector to configure on the Claude side.
1
Borrow tools from a standard server

Click Add Server Assets → Add from Server, pick a standard server (e.g. sobject-reads), and add the specific tools you want — for example Query Records (SOQL) and Search Across Objects (SOSL). Click Save.

These sit alongside your Apex- and Flow-backed tools from Phase 2 — Claude sees one server, one URL, one set of tools.

4
Activate and Grant Access
Flip it on, grab the URL, and make sure the authenticating user can actually run what you built. ~5 min
1
Activate and copy the Server URL

Click Activate. The Server URL for a custom server looks like:

Server URL — copy this https://api.salesforce.com/platform/mcp/v1/custom/CustomSalesTools

For a sandbox or scratch org, this likely follows the same sandbox/ prefix pattern used by the standard servers — check the Details tab on your activated server for the exact URL rather than assuming.

2
Give the running user access to what's inside

Activating the server and having API Enabled isn't enough on its own — whoever authenticates also needs ordinary access to the Apex classes and Flows you added: Apex Class Access for each Invocable Action or @AuraEnabled controller, and Flow access for each Autolaunched Flow.

⚠ Add this to the same permission set Go back to the MCP Client User permission set from the companion guide and add Apex Class Access / Flow Access for everything you exposed in Phase 2. Skip this and the tool will show up in the list but fail — or silently return nothing — when Claude actually calls it.
5
Test It
Check the tools work before you point a real Claude session at them. ~5 min
1
Try it in the Headless 360 Playground first

Open the Headless 360 Playground, go to the Servers tab, paste your Server URL into the URL field, and click Add, then Test. You should see every tool you added in Phases 2 and 3 listed out — that confirms the server itself is wired up correctly, before Claude is even involved.

2
Connect it to Claude

Same process as the companion guide's Phase 5 — just swap in this server's URL instead of a standard one. Open your existing connector (or add a new one) in Claude's Connectors screen, paste this Server URL in, and use your existing Consumer Key from Phase 4 as the OAuth Client ID.

✓ How to know it's working Ask Claude to use one of your custom tools by describing what it does — e.g. "Check the account health for Arroyo Medical Group" or "Create a sync meeting for that account." Then go verify it in your org: the health score or the new Task under Open Activities should actually be there, not just described back to you.
?
Common problems
Issues specific to custom servers, not covered in the companion guide's troubleshooting.
My Apex action or Flow doesn't show up in the "Add Tools" dropdown
For Apex, the method needs the @InvocableMethod annotation — plain public methods won't appear. For Flow, it needs to be an Autolaunched Flow that's Active — Screen Flows and inactive versions won't show up either.
The tool is listed and the server shows Connected, but calling it fails or returns nothing
Almost always missing access, not a broken tool. Check that the MCP Client User permission set actually grants Apex Class Access to the class behind the action (or Flow access for a Flow) — being able to see the tool in the server config and being able to run it as the authenticated user are two different permissions.
An Apex REST tool returns data the logged-in user shouldn't be able to see
Check whether the @RestResource class is declared with sharing. Apex REST classes default to without sharing unless you say otherwise, which means the tool can quietly bypass the record-level access you're relying on elsewhere in this setup.
Standard tools I added in Phase 3 aren't appearing next to my custom ones
Confirm you used Add from Server (not Add Tools, which is for your own Apex/Flow assets) and that you clicked Save after adding them — each asset type saves independently on this page.

Your custom server is live and Claude can use your own logic.

Your Apex actions and Flows are exposed as real tools, the running user has access to what's behind them, and Claude can call your business logic — not just generic CRUD.
Start with read-only or low-risk tools, then add anything that writes once you trust the flow.

Where this came from Based on the "Create a Custom MCP Server" exercise from Salesforce's Headless 360 Workshop — I ran this as part of a session for Sydney last week, alongside the companion Claude setup guide.
Found this useful?