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.
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:
Response:
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}.
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:
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.
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:
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:
GET /api-catalog/mcp-servers/0MxB000000000001AAA/assets/available/sources/PROMPT
List the available Prompt Builder source instances.
Response:
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:
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:
Response:
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.
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:
Response:
GET /api-catalog/mcp-servers/0MxB000000000001AAA/assets
Review the current tools and prompts before activating the server.
Response:
POST /api-catalog/mcp-servers/0MxB000000000001AAA/activate
Activate the server when its curated assets are ready for clients. The operation is idempotent.
Response:
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: