Example: Create a Custom Salesforce-Hosted MCP Server

This example creates a Salesforce-hosted MCP server for order support, adds a Connect REST API operation as a tool and a Prompt Builder prompt, configures behavioral annotations for the tool, and activates the server. Use these steps to automate the custom Salesforce MCP server workflow through the API Catalog Connect REST API.

For the corresponding UI workflow, see Create Custom Salesforce MCP Servers in API Catalog.

1. Create the Salesforce-Hosted MCP Server 

POST /api-catalog/mcp-servers

Create the server with type set to PLATFORM. Salesforce-hosted MCP servers are created inactive, and Salesforce generates their endpoint URL. Do not provide serverUrl or authorization, which apply only to external MCP servers.

Request body:

1{
2  "name": "OrderSupportMcp",
3  "label": "Order Support MCP Server",
4  "description": "Provides approved order support tools and prompts to MCP clients.",
5  "type": "PLATFORM"
6}

Response:

1{
2  "server": {
3    "id": "0MxB000000000001AAA",
4    "name": "OrderSupportMcp",
5    "label": "Order Support MCP Server",
6    "description": "Provides approved order support tools and prompts to MCP clients.",
7    "type": "PLATFORM",
8    "source": "CUSTOM",
9    "active": false,
10    "serverUrl": "https://your-domain.my.salesforce.com/services/mcp/OrderSupportMcp",
11    "createdById": "005000000000001AAA",
12    "createdDate": "2026-08-03T12:00:00Z",
13    "lastModifiedById": "005000000000001AAA",
14    "lastModifiedDate": "2026-08-03T12:00:00Z"
15  },
16  "assets": []
17}

Save the value of server.id. Use it in subsequent requests. The name and type are immutable after creation. You can later change the label or description with PUT /api-catalog/mcp-servers/{id}.

2. Discover Available Asset Sources 

GET /api-catalog/mcp-servers/0MxB000000000001AAA/assets/available/sources

Use this endpoint to discover which asset source categories are enabled in the org and whether each can provide tools, prompts, or both.

Response:

1{
2  "sources": [
3    {
4      "source": "CONNECT",
5      "kinds": ["MCP_TOOL"]
6    },
7    {
8      "source": "APEX_ACTION",
9      "kinds": ["MCP_TOOL"]
10    },
11    {
12      "source": "FLOW_ACTION",
13      "kinds": ["MCP_TOOL"]
14    },
15    {
16      "source": "PLATFORM_AGENT",
17      "kinds": ["MCP_TOOL"]
18    },
19    {
20      "source": "PROMPT",
21      "kinds": ["MCP_TOOL", "MCP_PROMPT"]
22    },
23    {
24      "source": "PLATFORM_SERVER",
25      "kinds": ["MCP_TOOL", "MCP_PROMPT"]
26    }
27  ]
28}

For example, use CONNECT for Connect REST API operations, APEX_REST, AURA_ENABLED, NAMED_QUERY, APEX_ACTION, or FLOW_ACTION for API and action tools; PLATFORM_AGENT for agent tools; PROMPT for Prompt Builder assets; and PLATFORM_SERVER for eligible assets from another Salesforce-hosted MCP server.

3. Select a Source Instance and Its Connect REST API Operation 

GET /api-catalog/mcp-servers/0MxB000000000001AAA/assets/available/sources/CONNECT

This request lists the source instances that provide Connect REST API operations that you can add as tools.

Response:

1{
2  "apiProducts": [
3    {
4      "id": "OrderSupportApi",
5      "name": "OrderSupportApi",
6      "label": "Order Support API",
7      "description": "Connect REST API operations for looking up customer orders.",
8      "source": "CONNECT"
9    }
10  ]
11}

GET /api-catalog/mcp-servers/0MxB000000000001AAA/assets/available/sources/CONNECT/OrderSupportApi?kind=MCP_TOOL

List the tools available from the selected source instance. The response includes the stable values required to add a tool to the server. In this example, select getOrderStatus.

Response:

1{
2  "assets": [
3    {
4      "assetId": "getOrderStatus",
5      "name": "getOrderStatus",
6      "label": "Get Order Status",
7      "description": "Gets the status, shipment details, and delivery date for an order.",
8      "kind": "MCP_TOOL",
9      "source": "CONNECT",
10      "sourceId": "OrderSupportApi",
11      "sourceName": "Order Support API",
12      "addedToServer": false,
13      "serverAssetId": null
14    }
15  ]
16}

4. Select a Prompt Builder Prompt 

GET /api-catalog/mcp-servers/0MxB000000000001AAA/assets/available/sources/PROMPT

List the available Prompt Builder source instances.

Response:

1{
2  "apiProducts": [
3    {
4      "id": "OrderStatusSummary",
5      "name": "OrderStatusSummary",
6      "label": "Order Status Summary",
7      "description": "Generates a concise customer-facing order status summary.",
8      "source": "PROMPT"
9    }
10  ]
11}

GET /api-catalog/mcp-servers/0MxB000000000001AAA/assets/available/sources/PROMPT/OrderStatusSummary?kind=MCP_PROMPT

Retrieve the prompt asset to add. Use kind=MCP_TOOL instead when you want a prompt template to be exposed as a tool rather than as an MCP prompt.

Response:

1{
2  "assets": [
3    {
4      "assetId": "OrderStatusSummary",
5      "name": "OrderStatusSummary",
6      "label": "Order Status Summary",
7      "description": "Generates a concise customer-facing order status summary.",
8      "kind": "MCP_PROMPT",
9      "source": "PROMPT",
10      "sourceId": "OrderStatusSummary",
11      "sourceName": "Order Status Summary",
12      "addedToServer": false,
13      "serverAssetId": null
14    }
15  ]
16}

5. Add the Selected Tool and Prompt 

PUT /api-catalog/mcp-servers/0MxB000000000001AAA/assets

Save the selected assets by replacing the server allowlist. A custom Salesforce-hosted MCP server must be inactive before you can change its assets.

This endpoint uses replace semantics across both tools and prompts. Include every asset that you want to keep. Omitting an existing tool or prompt removes it from the corresponding allowlist.

Request body:

1{
2  "assets": [
3    {
4      "assetId": "getOrderStatus",
5      "name": "getOrderStatus",
6      "kind": "MCP_TOOL",
7      "source": "CONNECT",
8      "sourceId": "OrderSupportApi"
9    },
10    {
11      "assetId": "OrderStatusSummary",
12      "name": "OrderStatusSummary",
13      "kind": "MCP_PROMPT",
14      "source": "PROMPT"
15    }
16  ]
17}

Response:

1{
2  "assets": [
3    {
4      "id": "0TlB000000000001AAA",
5      "name": "getOrderStatus",
6      "label": "Get Order Status",
7      "description": "Gets the status, shipment details, and delivery date for an order.",
8      "kind": "MCP_TOOL"
9    },
10    {
11      "id": "0TlB000000000002AAA",
12      "name": "OrderStatusSummary",
13      "label": "Order Status Summary",
14      "description": "Generates a concise customer-facing order status summary.",
15      "kind": "MCP_PROMPT"
16    }
17  ]
18}

assetId identifies the original available asset, and id identifies the curated copy that belongs to your custom MCP server. Use assetId in a PUT /assets request to add the source asset to the server. Use id for later operations on the curated server asset, such as adding annotations.

6. Add Annotations to the Tool 

PUT /api-catalog/mcp-servers/0MxB000000000001AAA/assets/0TlB000000000001AAA

Configure behavioral annotations after the tool is on the server and while the server is inactive. Annotations help MCP clients understand how to handle a tool.

This operation uses partial-update semantics. Omit annotation fields that you don’t want to change.

Request body:

1{
2  "annotations": {
3    "readOnlyHint": true,
4    "destructiveHint": false,
5    "idempotentHint": true,
6    "openWorldHint": false,
7    "returnDirect": false
8  }
9}

Response:

1{
2  "id": "0TlB000000000001AAA",
3  "name": "getOrderStatus",
4  "label": "Get Order Status",
5  "description": "Gets the status, shipment details, and delivery date for an order.",
6  "kind": "MCP_TOOL",
7  "annotations": {
8    "readOnlyHint": true,
9    "destructiveHint": false,
10    "idempotentHint": true,
11    "openWorldHint": false,
12    "returnDirect": false
13  }
14}

7. Verify the Curated Assets 

GET /api-catalog/mcp-servers/0MxB000000000001AAA/assets

Review the current tools and prompts before activating the server.

Response:

1{
2  "assets": [
3    {
4      "id": "0TlB000000000001AAA",
5      "name": "getOrderStatus",
6      "label": "Get Order Status",
7      "description": "Gets the status, shipment details, and delivery date for an order.",
8      "kind": "MCP_TOOL",
9      "annotations": {
10        "readOnlyHint": true,
11        "destructiveHint": false,
12        "idempotentHint": true,
13        "openWorldHint": false,
14        "returnDirect": false
15      }
16    },
17    {
18      "id": "0TlB000000000002AAA",
19      "name": "OrderStatusSummary",
20      "label": "Order Status Summary",
21      "description": "Generates a concise customer-facing order status summary.",
22      "kind": "MCP_PROMPT"
23    }
24  ]
25}

8. Activate the Server 

POST /api-catalog/mcp-servers/0MxB000000000001AAA/activate

Activate the server when its curated assets are ready for clients. The operation is idempotent.

Response:

1204 No Content

After activation, the server is available at the serverUrl returned in Step 1. To change its tools, prompts, or tool annotations later, first deactivate it.

POST /api-catalog/mcp-servers/0MxB000000000001AAA/deactivate

Response:

1204 No Content