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

# Salesforce

> MCP server for Salesforce integration

<Warning>
  **No longer maintained.** This Runlayer-built connector is deprecated and
  will not receive further updates. Use Salesforce's official hosted MCP servers instead. See the [Salesforce hosted MCP guide](https://developer.salesforce.com/docs/platform/hosted-mcp-servers/guide).
</Warning>

Connect your AI assistant to [Salesforce](https://www.salesforce.com) for CRM data queries, record management, and schema exploration. Uses **Salesforce OAuth** for authentication.

## Available Tools

| Tool              | Description                                                   |
| ----------------- | ------------------------------------------------------------- |
| `query`           | Execute SOQL queries against Salesforce                       |
| `search`          | Search across objects using SOSL                              |
| `list_objects`    | List all available sObjects in the org                        |
| `describe_object` | Get field details, relationships, and metadata for an sObject |
| `get_record`      | Retrieve a single record by ID with optional field selection  |
| `create_record`   | Create a new record on any sObject                            |
| `update_record`   | Update fields on an existing record                           |
| `delete_record`   | Delete a record (moves to Recycle Bin)                        |
| `get_limits`      | View org governor limits and usage                            |

## Setup

<Steps>
  <Step title="Create a Connected App in Salesforce">
    1. In Salesforce Setup, go to **App Manager** (or **External Client App Manager**)
    2. Click **New Connected App** (or **New External Client App**)
    3. Fill in:
       * **Connected App Name**: `Runlayer MCP`
       * **Contact Email**: your email
    4. Under **OAuth Settings**:
       * **Enable OAuth Settings**: checked
       * **Callback URL**: `https://<your-tenant>.runlayer.com/oauth/callback`
       * **Selected OAuth Scopes**: `Full access (full)` and `Perform requests at any time (refresh_token, offline_access)`
    5. Click **Save**

    <Note>
      It may take up to 10 minutes for the Connected App to propagate in Salesforce.
    </Note>
  </Step>

  <Step title="Get Credentials">
    1. After saving, go to the Connected App's detail page
    2. Copy the **Consumer Key** (Client ID) and **Consumer Secret** (Client Secret)
  </Step>

  <Step title="Add Server in Runlayer">
    1. In Runlayer, go to **My connectors**, find **Salesforce**, and click **Add connector**
    2. Check **Custom OAuth credentials**
    3. Enter your **Client ID** and **Client Secret**
    4. If connecting to a **sandbox org**, set **Login URL** to `https://test.salesforce.com`
    5. Click **Deploy Server**
  </Step>

  <Step title="Authorize">
    1. Click **Connect** on the server page
    2. Log in with your Salesforce credentials and click **Allow**

    <Note>
      Each user authorizes with their own Salesforce credentials. Queries and operations run with that user's permissions and field-level security.
    </Note>
  </Step>
</Steps>

## Configuration Reference

**Required:**

| Variable                         | Description                        |
| -------------------------------- | ---------------------------------- |
| `SALESFORCE_OAUTH_CLIENT_ID`     | Consumer Key from Connected App    |
| `SALESFORCE_OAUTH_CLIENT_SECRET` | Consumer Secret from Connected App |

**Optional:**

| Variable               | Description                                                                                                  |
| ---------------------- | ------------------------------------------------------------------------------------------------------------ |
| `SALESFORCE_LOGIN_URL` | Login endpoint (defaults to `https://login.salesforce.com`, use `https://test.salesforce.com` for sandboxes) |

## Troubleshooting

<Accordion title="Redirect URI mismatch">
  Verify the callback URL in your Connected App matches exactly: `https://<your-tenant>.runlayer.com/oauth/callback` (no trailing slash for Salesforce).
</Accordion>

<Accordion title="Cross-org OAuth error">
  The Connected App must be created in the same org you are authenticating against. External Client Apps do not support cross-org OAuth flows.
</Accordion>

<Accordion title="Connected App not found after creation">
  Salesforce Connected Apps can take up to 10 minutes to propagate. Wait and retry the authorization.
</Accordion>

<Accordion title="INVALID_SESSION_ID errors">
  Your Salesforce access token has expired (tokens last \~2 hours). Reconnect in Runlayer to get a fresh token. If you have `refresh_token` scope enabled, this should happen automatically.
</Accordion>

<Accordion title="Consumer Secret not shown (External Client App Manager)">
  In the **External Client App Manager**, the Consumer Secret is gated behind a user permission. If you only see the Consumer Key, your user is missing the required permission on the External Client App.

  Grant your user the **Create, edit, and delete External Client Apps** permission (and **View External Client App Consumer Secrets in Metadata** if you also need metadata access), then revisit the app's detail page and click **Manage Consumer Details** to reveal both the key and secret. See the Salesforce help article on [External Client App user permissions](https://help.salesforce.com/s/articleView?id=005197683\&type=1) for the full list.
</Accordion>
