Skip to content
Last updated

Salesforce integration

Salesforce is a customer relationship management (CRM) platform that lets sales, service, and marketing teams manage accounts, contacts, leads, opportunities, cases, tasks, and events in a single system of record.

It can be connected to Agen.co two ways, matching the Official / In-house filter in the connector picker:

  • Official — Agen.co connects to a Salesforce Hosted MCP Server, so your AI agents use the tools Salesforce exposes to MCP clients, including custom tools your admins build from Apex and Flows.
  • In-house — Agen.co wraps the Salesforce REST API through its own integration layer, with tools for Accounts, Contacts, Leads, Opportunities, Cases, Tasks, Events, SOQL, and SOSL.

Connect via the official MCP server

Prerequisites

  • A Salesforce administrator (System Administrator or equivalent) who can create an External Client App and turn on MCP servers in Setup.
  • Salesforce Hosted MCP Servers available in your org: MCP Servers appears under API Catalog in Setup. If it doesn't, ask your Salesforce account team to enable Hosted MCP Servers for your org.
  • An org edition with API access, for example Developer, Enterprise, or Unlimited.

Copy the callback URLs from Agen.co

  1. In the Agen.co portal, go to Connectors → My connectors and click Add connector.
  2. Search for Salesforce and select it. At the top of the Add Salesforce panel, keep Official selected.
  3. Copy both read-only URLs at the bottom of the panel:
    • Callback URL: completes the initial OAuth handshake between Agen.co and your External Client App.
    • Gateway callback URL: used by the Agen.co MCP gateway for per-user authorization at runtime.

Leave this panel open. You return to it after creating the External Client App. See How to get your Redirect URL for what these URLs are.

Turn on the MCP server in Salesforce

Salesforce MCP servers are off by default, and a client can't connect to one that is off, even with a valid sign-in.

  1. In Salesforce, open Setup. In the Quick Find box, enter MCP Servers, then select MCP Servers under API Catalog.
  2. Turn on the server your agents need, for example SObject Reads. It can take up to 2 minutes to become active.

Create the External Client App

Salesforce Hosted MCP Servers accept only an External Client App. Connected Apps aren't supported.

  1. In Setup, enter external client in the Quick Find box, select External Client App Manager, and click New External Client App.

  2. Fill in Basic Information: a name (for example, Agen.co MCP) and a contact email. Leave Distribution State as Local.

  3. Expand API (Enable OAuth Settings) and select Enable OAuth. In Callback URL, paste both URLs you copied from Agen.co, one per line.

  4. Under OAuth Scopes, move these two scopes to Selected OAuth Scopes:

    ScopeWhat it allows
    Access MCP servers (mcp_api)Calling the Salesforce Hosted MCP Servers you turned on
    Perform requests at any time (refresh_token)Issuing a refresh token, so users stay connected without signing in again
  5. Under Security, select Issue JSON Web Token (JWT)-based access tokens for named users. Keep Require secret for Web Server Flow, Require secret for Refresh Token Flow, and Require Proof Key for Code Exchange (PKCE) selected, because Agen.co signs in with the client secret and PKCE. Clear the other options. Without JWT-based access tokens, sign-in can succeed while every tool call fails.

  6. Click Create. A new External Client App can take up to 30 minutes before Salesforce accepts it.

  7. Open the app's Settings tab, expand OAuth Settings, and click Consumer Key and Secret. Salesforce may ask for a verification code sent to your email. Copy the Consumer Key and Consumer Secret.

Connect Salesforce in Agen.co

  1. Return to the Add Salesforce panel you left open and fill in the fields:
FieldRequiredDescription
Instance SlugYesNamespaces this instance. It prefixes each imported tool as slug__tool, so a second instance of the same connector needs its own slug. Prefilled with salesforce. Use lowercase kebab-case. You can change it later from the connector's settings.
Hosted MCP serverYesThe part of the server URL after https://api.salesforce.com/platform/mcp/v1/, for example platform/sobject-reads or platform/sobject-all. For a custom server, use custom/<server name>. For a sandbox or scratch org, add sandbox/ in front, for example sandbox/platform/sobject-reads. Pasting the full server URL also works.
Client IDYesThe Consumer Key of your External Client App.
Client SecretYesThe Consumer Secret of your External Client App.
  1. Click Connect. Salesforce opens in a new tab. Sign in and click Allow.
  2. Back in Agen.co, the panel shows Select the tools to import from Salesforce. with a toggle for each tool, all on by default. Turn off any tool you don't want, then click Add. The connector is created and its tools imported only when you click Add, even if the Salesforce tab reported success.
  3. After you create a policy for the tools, the first tool call a user makes returns a one-time authorization link instead of data. The user opens it and signs in with their own Salesforce account. This per-user step uses the Gateway callback URL you registered, and each user does it once.

One instance connects to one hosted MCP server. To give agents a second server, such as SObject Mutations next to SObject Reads, add another Salesforce instance with its own slug.

What it covers

The tools depend on the server you connect. Every tool call runs as the signed-in user, so field-level security, object permissions, and sharing rules apply.

ServerWhat it covers
SObject ReadsReading, querying, and searching records, with no changes
SObject AllCreating, reading, updating, and deleting records, plus query and search
SObject Mutations / SObject DeletesCreating and updating records, or deleting them
Custom serversApex actions, Flows, and Named Queries your admins expose as MCP tools
Other standard serversData 360, Tableau Next, CRM Analytics, Salesforce CMS content, and more. See the Salesforce servers reference for the full list

Enabling the Salesforce connector isn't enough on its own. Tool calls remain denied until you create a policy that grants access to the specific tools you want to expose.

Connect via the Salesforce REST API

Integrating Salesforce with Frontegg lets your application read and write CRM records (Accounts, Contacts, Leads, Opportunities, Cases, Tasks, Events), run SOQL queries and SOSL searches, upsert records by external ID, and execute composite multi-step requests against the Salesforce REST API on behalf of an authenticated user.

The integration uses the OAuth 2.0 Web Server flow against login.salesforce.com, with offline access for refresh tokens. You provide a Client ID, Client Secret, and your Salesforce MyDomain in the Frontegg portal — the MyDomain is used to address the org-specific REST API host (https://{your-mydomain}.my.salesforce.com).

Prerequisites

  • A Salesforce org with admin permissions to create External Client Apps (Developer Edition, Enterprise, Unlimited, or Performance Edition).
  • The user creating the app must have the Customize Application and Manage Connected Apps permissions.

Connect Salesforce

Step 1: Find your Salesforce MyDomain

Sign in to Salesforce, open Setup, and in the left sidebar navigate to Company Settings → My Domain. Copy the value shown under My Domain Name — this is the subdomain prefix of your org URL (for example, acme from https://acme.my.salesforce.com).

You will paste this value into the Salesforce MyDomain field in the Frontegg portal.

Salesforce My Domain settings

Developer Edition orgs

If you are using a free Developer Edition org, your MyDomain typically includes .develop — for example, acme.develop from https://acme.develop.my.salesforce.com. Use the full subdomain prefix shown under My Domain Name, including .develop if present.

Step 2: Open the External Client App Manager

In Setup, open Apps → App Manager. In the top-right corner, click New External Client App.

Salesforce App Manager with New External Client App button

Step 3: Fill in the basic information

In the Basic Information section, enter:

  • External Client App Name — a descriptive name, for example Frontegg Integration. The API Name is generated automatically.
  • Contact Email — an email address that Salesforce will associate with this app.
  • Leave Distribution State as Local.

Basic information form for the new External Client App

Step 4: Enable OAuth and set the callback URL

Expand the API (Enable OAuth Settings) section and check Enable OAuth. Then enter your Frontegg Redirect URL in the Callback URL field:

  • https://YOUR_MCP_GATEWAY_URL/integration-callback

Enable OAuth and Callback URL field

Step 5: Select OAuth scopes

In the OAuth Scopes dual list, move the following three scopes from Available OAuth Scopes to Selected OAuth Scopes (select each scope and click the right-arrow button):

ScopeDescription
Access the identity URL service (id, profile, email, address, phone)Identifies the authenticated user and exposes the id claim used by Frontegg.
Manage user data via APIs (api)Grants read/write access to the Salesforce REST API for all integration tools (Accounts, Contacts, Leads, Opportunities, Cases, Tasks, Events, queries, composite).
Perform requests at any time (refresh_token, offline_access)Issues a refresh token so Frontegg can keep the integration connected without re-prompting the user.

Selected OAuth scopes

Web Server flow with PKCE

Salesforce enables Require secret for Web Server Flow, Require secret for Refresh Token Flow, and Require Proof Key for Code Exchange (PKCE) by default. Leave these settings as-is — the Frontegg integration uses the standard OAuth 2.0 Web Server flow with PKCE.

Step 6: Create the app and copy credentials

Click Create at the bottom of the form. Salesforce takes you to the app detail page.

Open the Settings tab, expand OAuth Settings, and click Consumer Key and Secret. Salesforce may ask you to verify your identity by entering a code emailed to your account address.

After verification, the Consumer Details page displays:

  • Consumer Key — paste this into the Client ID field in the Frontegg portal.
  • Consumer Secret — paste this into the Client Secret field in the Frontegg portal.

Salesforce Consumer Key and Consumer Secret

Keep your credentials secure

Treat the Consumer Secret as a password. Never share it or commit it to version control.

Configure the Frontegg portal

Open the Frontegg portal and navigate to [ENVIRONMENT] → Integrations → Salesforce, then enter:

  1. Client ID — the Consumer Key value from the previous step.
  2. Client Secret — the Consumer Secret value from the previous step.
  3. Salesforce MyDomain — the subdomain you copied earlier (for example, acme).
  4. Select the required scopes.
  5. Click Save.

Additional resources