

# Connect through an MCP server

If a system runs an MCP server, add it to the gateway as an MCP server target that uses the system's OAuth client or API key, as in [Add the system to the gateway](real-time-data-integration-rest.md#real-time-data-integration-resources-other). The server decides which tools it offers. The example on this page is a Salesforce hosted MCP server.

**Important**  
An MCP server target gets its Salesforce token through an OAuth client in AgentCore Identity. It can request a new token on every tool call, and can fail under load. For data that the stack's `salesforce` target already offers, call that target, which reuses a stored token.

To set up a Salesforce hosted MCP server, including the External Client App settings it needs, see [Hosted MCP Servers](https://developer.salesforce.com/docs/platform/hosted-mcp-servers/guide/hosted-mcp-servers-overview.html) and [Set Up Your Org](https://developer.salesforce.com/docs/platform/hosted-mcp-servers/guide/setup-overview.html) in the Salesforce documentation. Then add the server to the stack's gateway as an MCP server target, as in [Add the system to the gateway](real-time-data-integration-rest.md#real-time-data-integration-resources-other).

A server that writes lets every guide and AI agent that uses the gateway write.