Bring the capabilities of your externally hosted Model Context Protocol (MCP) servers to Agentforce by configuring, securely packaging, and distributing your MCP server registration. Learn how to set up your Salesforce DX project and create the MCP server registration.
See MCP for Agentforce in Salesforce Help for more information on MCP servers for Agentforce.
MCP for Agentforce Metadata Components
The underlying MCP server definition comprises four packageable metadata types.
Feature Name
Metadata Name
Available In
More Information
External Credential
ExternalCredential
Managed 2GP and Managed 1GP
Contains the named principal and authentication parameters required for the MCP connection.
External Service Registration
ExternalServiceRegistration
Managed 2GP and Managed 1GP
Defines the registration provider and schema type specifically as ModelContextProtocol.
Named Credential
NamedCredential
Managed 2GP and Managed 1GP
Manages the callout endpoint details for your MCP server.
Permission Set
PermissionSet
Managed 2GP and Managed 1GP
Grants your users access to the necessary External Credential Principal and Read access to the User External Credential object.
When you create an MCP server registration through Agentforce Registry in Setup, the components follow the correct naming conventions and the dependencies between them are established.
These components aren’t packageable at this time.
MCP tool actions, which are agent actions that reference server tools.
Agentforce Gateway policies, which set governance rules, define usage limits, and control access to MCP tools and other APIs.
Note
Set Up Your Salesforce DX Project and Scratch Org
Depending on your use case, you can package the MCP server registration either as a component of an Agentforce extension package or as a standalone managed package.
To work with Agentforce as an MCP client, configure your Salesforce DX project and provision a scratch org with the Chatbot and Einstein1AIPlatform features enabled.
Update your project configuration file (sfdx-project.json) to use API version 66.0 or greater and set your namespace.
Update your scratch org definition file (project-scratch-def.json) to include the required Chatbot and Einstein1AIPlatform features.
Scratch orgs are the primary means by which partners develop MCP server registration metadata.
To configure an MCP server using an authentication type other than OAuth 2.0 Client Credential Flow, enter your MCP server endpoint URL and select No Auth for the Authentication Method. If your MCP server supports unauthenticated tool/list requests, you can configure the required authentication method later. If your MCP server requires authenticated tool/list requests, follow the instructions in the Example Metadata for Establishing an MCP Server Registration section.
Note
After you register the MCP server, retrieve the MCP server metadata by running the project retrieve start Salesforce CLI command.
These steps are specific to the OAuth 2.0 Client Credentials Flow authorization type. Depending on your MCP server authentication method, your specific configuration can differ.
Note
From Setup, in the Quick Find box, enter Agentforce Registry, and then select MCP Servers.
Click the name of the MCP server that you deployed. The Connection Status is disconnected.
Under Authentication Details, click the Named Credential listed for your MCP server.
On the Named Credential page, click the External Credential.
On the External Credential page, scroll down to the Principals section, which displays one principal with a parameter name of MCPAuthentication. Click the Actions drop-down menu, and then select Edit.
Enter the Client ID and Client Secret. Then, click Save.
Navigate back to the MCP Servers page in Setup. Select your MCP server and confirm that the Connection Status is now Active.
Click the Tools tab, and then click Manage Tools. Select the tools to activate in the org, and then save your changes.
From Setup, in the Quick Find box, enter Agentforce Assets, and then select Agentforce Assets.
Click the Actions tab to view the newly created MCP tool actions, which are indicated by an orange icon ().
Example Metadata for Establishing an MCP Server Registration
As an alternative way to establish an MCP server registration in an org, you can manually generate metadata to include in your Salesforce DX project. We recommend manually generating metadata if you’re configuring an authorization type other than the OAuth 2.0 Client Credentials Flow authorization type and your MCP server requires authenticated tool/list requests.
In the metadata examples, replace these placeholder values with the values for your package or MCP server.
When you replace the placeholder values, make sure to also remove the brackets. For example, replace {NAMESPACE} with astro__.
Note
NAMESPACE: Package namespace, if applicable. Include double underscores after your namespace. For example: astro__
MCP_SERVER_NAME: Name of your MCP service, which contains only alphanumeric characters. Make sure to enter the MCP service name in both the file names and within the files.