> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spojit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Salesforce Hosted MCP Servers

> Connect Salesforce Hosted MCP Servers to Spojit: create an External Client App with the mcp_api scope and JWT access tokens, copy the server URL, and sign in.

**Salesforce Hosted MCP Servers** give AI agents governed access to Salesforce data and automation, such as querying and updating records. Connect one to Spojit to create leads from inbound email, update opportunities as deals move, or pull account context into an agent.

<Note>
  Spojit connects to these servers through a [custom MCP server](/connectors/remote-mcp-servers/custom) connection, so you add them with **Add custom server** rather than from the connector catalog. Salesforce maintains them and decides which tools they offer; see [Salesforce's Hosted MCP Servers guide](https://developer.salesforce.com/docs/platform/hosted-mcp-servers/guide/hosted-mcp-servers-overview.html) for the current list.
</Note>

## Before you start

Salesforce only accepts MCP clients registered in your org as an **External Client App**, so a Salesforce admin creates one for Spojit. You also need Spojit's redirect URI, which the Spojit dialog shows.

<Steps>
  <Step title="Copy Spojit's redirect URI">
    In Spojit, go to **Connections**, click **Add custom server**, and choose **OAuth 2.0**. Copy the **Redirect URI** shown in the form (for example `https://miraxa.spojit.com/api/connectors/oauth/callback`). Keep the dialog open, or come back to it later.
  </Step>

  <Step title="Create the External Client App">
    In Salesforce **Setup**, search Quick Find for **External Client App Manager** and click **New External Client App**. Fill in the basic information, expand **API (Enable OAuth Settings)**, and select **Enable OAuth**.
  </Step>

  <Step title="Configure OAuth">
    * **Callback URL**: paste Spojit's redirect URI.
    * **OAuth Scopes**: add **Access MCP servers (mcp\_api)** and **Perform requests at any time (refresh\_token)**.
    * **Security**: select **Issue JSON Web Token (JWT)-based access tokens for named users**.

    Save, then copy the app's **Consumer Key** and **Consumer Secret**.
  </Step>

  <Step title="Copy the server URL">
    In Setup, open the hosted MCP servers page, pick the server you want, and copy its **Server URL**. Production and sandbox URLs differ, so copy it from the org you are connecting.
  </Step>
</Steps>

<Warning>
  Without **JWT-based access tokens**, sign-in can appear to succeed but every MCP call fails with `INVALID_AUTH_HEADER` or `INVALID_JWT_FORMAT`.
</Warning>

## Server URL

Salesforce server URLs look like this example from Salesforce's documentation:

```
https://api.salesforce.com/platform/mcp/v1/d/acme/platform/sobject-all
```

Always copy the exact URL from your org's Setup.

## Connect in Spojit

<Steps>
  <Step title="Add a custom server">
    In **Add custom server**, enter a **Name** such as `Salesforce` and paste the **Server URL**.
  </Step>

  <Step title="Choose Auto authentication">
    Choose **Auto** and click **Save & connect**. Because Salesforce needs your own app, the **OAuth 2.0** form opens with the authorization URL, token URL, and scopes already filled in.
  </Step>

  <Step title="Enter your app's credentials">
    Paste the **Consumer Key** as **Client ID** and the **Consumer Secret** as **Client Secret**. Check the **Scopes** field contains `mcp_api refresh_token`, then click **Save & connect**.
  </Step>

  <Step title="Sign in to Salesforce">
    Salesforce opens its login page. Sign in and allow access. Spojit marks the connection **Connected** and refreshes the token automatically.
  </Step>
</Steps>

If the form does not prefill, choose **OAuth 2.0** and enter the endpoints yourself: **Authorization URL** `https://login.salesforce.com/services/oauth2/authorize` and **Token URL** `https://login.salesforce.com/services/oauth2/token` (use `test.salesforce.com` for a sandbox), with scopes `mcp_api refresh_token`.

## Use it in a workflow

Add a **Connector** node, pick your Salesforce server under **Custom Servers**, and choose **Agent Mode** or **Direct Mode**. See [Use a custom server in a workflow](/connectors/remote-mcp-servers/custom#use-a-custom-server-in-a-workflow).

## Troubleshooting

<AccordionGroup>
  <Accordion title="MCP calls fail with INVALID_AUTH_HEADER or INVALID_JWT_FORMAT">
    Turn on **Issue JSON Web Token (JWT)-based access tokens for named users** in the External Client App, then click **Reconnect** on the connection.
  </Accordion>

  <Accordion title="Salesforce reports a redirect_uri mismatch">
    The **Callback URL** in the External Client App must match Spojit's **Redirect URI** exactly.
  </Accordion>

  <Accordion title="The connection stops refreshing">
    Add the **refresh\_token** scope to the External Client App and to the connection's **Scopes**, then reconnect.
  </Accordion>
</AccordionGroup>

## Learn more

* [Hosted MCP Servers: Get Started](https://developer.salesforce.com/docs/platform/hosted-mcp-servers/guide/hosted-mcp-servers-overview.html)
* [Create an External Client App](https://developer.salesforce.com/docs/platform/hosted-mcp-servers/guide/create-external-client-app.html)
* [Salesforce Hosted MCP Servers (Help)](https://help.salesforce.com/s/articleView?id=platform.hosted_mcp_servers.htm\&language=en_US\&type=5)

<Snippet file="start-free.mdx" />
