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

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

  2. Open Setup.

  3. Search for MCP Servers in Quick Find.

  4. Open MCP Servers.

  5. Find the server you need, such as SObject All.

  6. Open the server and activate it.

  7. 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.

  1. In Salesforce Setup, search for External Client App Manager.

  2. Create a new External Client App.

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

  4. Enable OAuth.

  5. Add the OAuth scopes mcp_api and refresh_token.

  6. Enable PKCE for supported authorization flows.

  7. Enable JWT-based access tokens for named users.

  8. Create the app and wait for the Salesforce app configuration to become available.

  9. Copy the Consumer Key. This is the OAuth Client ID you may need in Hatz.

Add Salesforce in Hatz

  1. In Hatz, go to Workshop > Connections.

  2. Open the Custom MCP Servers tab.

  3. Click Add Server.

  4. Enter a name, such as Salesforce Production or Salesforce Sandbox.

  5. Paste the Salesforce MCP Server URL.

  6. Select OAuth as the authentication method.

  7. Try Auto-detect first. If that fails, choose I have credentials and enter the External Client App Consumer Key as the Client ID.

  8. Click Test next to the URL, then add the server.

  9. Complete OAuth in Salesforce and approve access.

  10. 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://api.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?