Skip to main content

Adding Salesforce as a Custom MCP

Adding Salesforce as a Custom MCP

Use this guide to connect Salesforce Hosted MCP to Hatz through Workshop > Connections > Custom MCP Servers. This uses Salesforce's native hosted MCP server and OAuth. It does not use the deprecated Composio Salesforce integration.

For general Custom MCP behavior in Hatz, see Custom MCP Servers.

How Salesforce Hosted MCP works

Salesforce Hosted MCP Servers let MCP clients work with your Salesforce org through Salesforce-managed MCP endpoints. Hatz connects as the MCP client. Each user signs in with their own Salesforce account, and Salesforce still enforces that user's object permissions, field-level security, and sharing rules.

You will:

  1. Activate the Salesforce MCP server you want to use.

  2. Create an External Client App for OAuth.

  3. Add the server in Hatz as a Custom MCP Server.

  4. Complete OAuth and discover tools.

Prerequisites

  • In Hatz: Custom MCP Servers must not be disabled by your workspace administrator, and you need access to Workshop > Connections.

  • In Salesforce: You need an org that supports Salesforce Hosted MCP Servers and a Salesforce administrator, or equivalent admin, to activate the MCP server and create the External Client App.

  • For each user: Each Hatz user connecting Salesforce needs their own Salesforce account and must authorize with that account.

Choose your Salesforce MCP server URL

Choose the Salesforce MCP server that matches what you want Hatz to do. Start with SObject All only if you want the connected user to be able to use the full CRM object tool set allowed by their Salesforce permissions.

Copy the exact URL. You will paste it into Hatz as the Server URL.

Activate the MCP server in Salesforce

  • Log in to Salesforce as an administrator for the production org or sandbox you want to connect

  • Open Setup

  • Search for MCP Servers in Quick Find

  • Select MCP Servers under API Catalog

  • Find the server you need, such as SObject All

  • Open the server and activate it

  • Copy the URL of the server to be used for the connection in Hatz

  • Confirm the server status is Active

If this step is skipped, OAuth can succeed but Hatz may show zero tools or connection errors.

Create an External Client App in Salesforce

Salesforce Hosted MCP uses an External Client App for OAuth. Do not use a legacy Connected App or a third-party broker app for this flow.

  • In Salesforce Setup, search for External Client App Manager

  • Create a new External Client App

  • Enter a name, such as Hatz AI MCP, and a contact email

  • Enable OAuth

  • Add the OAuth scopes "Perform requests at any time (refresh_token, offline_access)" and "Access Salesforce hosted MCP servers (mcp_api)"

  • Under the Security section only have "Require Proof Key for Code Exchange (PKCE) extension for Supported Authorization Flows" and "Issue JSON Web Token (JWT)-based access tokens for named users" checked off

  • Once the app is created, select the Settings tab at the top, expand the "OAuth Settings" section and select the "Consumer Key and Secret" button

  • Copy the Consumer Key and Secret to be used for the connection in Hatz

Add Salesforce in Hatz

  • In Hatz, go to Workshop > Connections

  • Open the Custom MCP Servers tab

  • Click Add Server

  • Enter a name, such as Salesforce Production or Salesforce Sandbox

  • Paste the Salesforce MCP Server URL

  • Select OAuth as the authentication method

  • Choose I have credentials and enter the External Client App Consumer Key and Secret

  • Click Test next to the URL, then add the server

  • Complete OAuth in Salesforce and approve access

  • Run Discover Tools if the tool count does not appear automatically

Use Salesforce in Chat or Workflows

After the server is connected and tools are discovered, open Chat or a Workflow and select the Salesforce Custom MCP server from the tool picker.

Example prompts:

  • List my open opportunities closing this month.

  • Find contacts at Acme Corp in Salesforce.

  • Create a follow-up task on this opportunity for Friday.

The available actions depend on the Salesforce MCP server you selected and the permissions of the Salesforce user who authorized the connection.

Troubleshooting

  • Custom MCP Servers tab is missing: Ask your Hatz administrator whether Custom MCP Servers are disabled for your workspace.

  • Server is unreachable: Confirm the production or sandbox URL is correct and the Salesforce MCP server is active.

  • Auth fails: Confirm the callback URL is exactly https://ai.hatz.ai/v1/connections/oauth-callback, the scopes include mcp_api and refresh_token, and PKCE is enabled.

  • Wrong Salesforce org opens: Log out of other Salesforce orgs in your browser, log in to the target org, and retry OAuth from Hatz.

  • Zero tools appear: Confirm the MCP server is active in Salesforce Setup, then run Discover Tools again.

Did this answer your question?