<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Anujgarg on Medium]]></title>
        <description><![CDATA[Stories by Anujgarg on Medium]]></description>
        <link>https://medium.com/@anujgarg3334?source=rss-a57b9e686be9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*eqhYvvZIRpG6hbIm</url>
            <title>Stories by Anujgarg on Medium</title>
            <link>https://medium.com/@anujgarg3334?source=rss-a57b9e686be9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 14:54:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anujgarg3334/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Integrate Salesforce Agentforce with MuleSoft via MCP Bridge]]></title>
            <link>https://medium.com/@anujgarg3334/integrate-salesforce-agentforce-with-mulesoft-via-mcp-bridge-5cc8f5e468b7?source=rss-a57b9e686be9------2</link>
            <guid isPermaLink="false">https://medium.com/p/5cc8f5e468b7</guid>
            <category><![CDATA[model-context-protocol]]></category>
            <category><![CDATA[mulesoft]]></category>
            <category><![CDATA[mcp-bridge]]></category>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[salesforce-agentforce]]></category>
            <dc:creator><![CDATA[Anujgarg]]></dc:creator>
            <pubDate>Fri, 26 Jun 2026 20:23:01 GMT</pubDate>
            <atom:updated>2026-07-09T07:56:23.076Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>How to expose an existing MuleSoft REST API as a secure MCP Bridge and call it from an Agentforce agent (2026 Guide)</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TXScpSToRCztJGU7Iu_VRA.png" /></figure><p>I already had the working MuleSoft Order Management APIs. I already had an Agentforce agent in Builder. The question was: how do I let the agent call the API — without rebuilding either side?</p><p>The answer was <strong>MCP Bridge</strong>. Instead of writing a new integration, I stood up an <strong>MCP Bridge</strong> on the MuleSoft Omni Gateway and added the API to it. An MCP Bridge is one gateway instance that fronts one <em>or more</em> API instances and exposes their operations as MCP tools. The Agentforce agent picks up those tools as callable actions. The backend sees nothing different; it keeps receiving the same HTTP requests it always did.</p><p>This is not a getting-started tutorial. It is the exact sequence of steps I followed, the configuration decisions that matter.</p><p><strong>What you will walk away with:</strong></p><ol><li><strong>MuleSoft</strong> — an existing REST API promoted to a secure MCP server on Omni Gateway, with inbound auth and outbound credential injection.</li><li><strong>Wiring</strong> — the Salesforce side: registering the MCP server, importing the tools, binding them to Agent Script actions.</li><li><strong>Agentforce</strong> — a router + place_order subagent in Agent Script, wired to an MCP tool.</li><li><strong>Troubleshooting</strong> — the real errors, documented inline at the step where each one shows up (message, cause, fix).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7RtCzXr1C-37Hg3mj8WDIA.png" /><figcaption>End-to-end request</figcaption></figure><h4>Table of Contents</h4><ul><li><a href="#1e71">Prerequisites</a></li><li><a href="#8278">Part 1 — Build a Secure MCP Bridge on MuleSoft</a></li><li><a href="#65dc">Part 2 — Register the MCP Server in Salesforce</a></li><li><a href="#7ddc">Part 3 — Add MCP Tool in the Agentforce Agent</a></li><li><a href="#2325">Common Issues and Solutions</a></li></ul><h3>Prerequisites</h3><p>Get these in place before you start.</p><ul><li>Anypoint Platform account with permissions — API Manager (API Creator, Deploy API Proxies, Manage APIs Configuration, Manage Policies), Runtime Manager (Manage Servers), and root Organization Administrator (to connect Salesforce).</li><li>Omni Gateway (formerly Flex Gateway) 1.12.0+, running — self-managed or MuleSoft-managed.</li><li>Salesforce org with Agentforce enabled and permissions — System Administrator (org connection) and Manage Agents / Customize Application (Agentforce Builder).</li></ul><h3>Part 1 — Build a Secure MCP Bridge on MuleSoft</h3><p>MuleSoft’s <strong>Add to new MCP instance</strong> wizard (API Manager) builds an <strong>MCP Bridge</strong> — a gateway instance that fronts one or more API instances and translates MCP tools/call messages into HTTP. Point it at whatever fits, System or Process API; the MCP layer itself becomes your agent-facing <strong>experience layer</strong>. The backend keeps receiving the same HTTP calls.</p><p>The MCP bridge runs on an <strong>Omni Gateway</strong> (formerly Flex Gateway) — self-managed or MuleSoft-managed; I used a MuleSoft-managed one on <strong>1.13.2</strong>, since MCP Bridge needs a recent gateway version.</p><h4>Step 1 — Add to New MCP Instance</h4><p>Two ways to start the wizard:<br> 1. <strong>From the API:</strong> API Manager → <strong>API Instances</strong> → open the API (mine: order-management-api, RAML/OAS, Active) → <strong>Actions → Add to new MCP instance</strong>.<br>2. <strong>From the gateway:</strong> API Manager → <strong>Agent and Tool Instances → Add → MCP Bridge</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xyS2mYJzqJbCJIPXtCqSlA.png" /></figure><h4>Step 2 — Select the Gateway and APIs</h4><p>Choose the Omni Gateway that will host the MCP server (verify it shows <strong>Running</strong>), then check every API you want in the catalog — bundling several gives the agent one MCP endpoint that spans all of them. I added two — order-management-api and product-sapi — and set the <strong>MCP asset name</strong> to order-mgmt-mcp (this is what&#39;s published to Anypoint Exchange).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UQoveGl2b-KWgIuGO3go0g.png" /></figure><h4>Step 3 — Configure the Downstream (Where Salesforce Connects)</h4><ul><li><strong>Base path:</strong> must be unique per instance, e.g. /order-mgmt. (Instances can share a port as long as the base path differs.)</li><li><strong>Consumer endpoint — the most important field here.</strong> This is the exact URL Salesforce picks up to reach your bridge, and it must end with a trailing slash — append / so the path finishes as …/mcp/:</li></ul><pre>https://{omni-gateway-host}/order-mgmt/mcp/</pre><p>Salesforce reads this URL verbatim, so save it exactly — you’ll need it in Part-2. Note: <strong>This is the single most common reason an MCP server fails to sync in Salesforce.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hyw7u3aliJ6wyQNl8cKhfQ.png" /></figure><h4>Step 4 — Configure the Upstream (Where the Gateway Forwards)</h4><p>Point the upstream route at your actual backend API. This is either the managed order-management-api upstream or a new unmanaged upstream URL. TLS context is optional for internal routes. The specific <strong>API instance</strong> you pick must already have its <strong>own consumer endpoint configured</strong> in API Manager.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9lMaYgNTfEg2cz3QeRxaMw.png" /></figure><h4>Step 5 — Review the Auto-Generated Tools</h4><p>The wizard turns each API operation into a tool, grouped by source API — so both order-management-api and product-sapi show up here. Enable just the operations the agent should call and leave the rest off.<br><em>Each tool’s definition — </em><strong><em>AI tool name</em></strong><em> (</em><em>snake_case), </em><strong><em>description</em></strong><em>, and </em><strong><em>HTTP mapping</em></strong><em> — is auto-generated from the API spec; open any tool (</em><strong><em>⋮ → Edit</em></strong><em>) to refine it.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fMYYDzDdnvKQdNpnSMZaiw.png" /></figure><p><strong>Next -&gt; Save &amp; Deploy</strong></p><h4>Step 6 — Secure the MCP Server (Inbound + Outbound)</h4><p>Security is a two-sided problem here, and mixing them up is the single most common source of 401 errors.</p><ul><li><strong>Inbound</strong> = the agent → MCP server hop (authenticated by gateway policy).</li><li><strong>Outbound</strong> = the MCP server → upstream API hop (authenticated by credential injection).</li></ul><h4>Inbound policies</h4><p>Three policies are auto-added to implement the bridge: MCP Support, MCP Schema Validation, and MCP Transcoding Router. Like any inbound policy, you can reorder, update, or remove them. Add <strong>Client ID Enforcement</strong>, an <strong>OAuth</strong> policy, or others to authenticate the caller — I used Client ID Enforcement.</p><h4>Outbound policies</h4><p>Outbound policies cover a lot (<a href="https://docs.mulesoft.com/gateway/latest/policies-outbound-directory">full directory</a>) — circuit breaking, idle timeouts, logging, TLS, credential injection. The one that matters here: <strong>if your upstream API has its own security, configure it on the outbound side</strong>, since the bridge doesn’t forward the caller’s inbound credentials to the backend. Mine enforced Client ID Enforcement, so I added <strong>Credential Injection — API Key</strong> to inject the upstream’s client_id/client_secret (skip it and you hit the 401 in Troubleshooting).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0skDaxODq_T6OUXivCOLFw.png" /><figcaption>Showing Policies Side by Side (Not An Actual Image)</figcaption></figure><p>Before moving to Salesforce, validate the consumer endpoint with an MCP client.</p><h3>Part 2 — Register the MCP Server in Salesforce</h3><p>With the bridge live and tested, Salesforce does most of the work — there’s no “paste your URL.” MuleSoft MCP servers sync in from your connected Anypoint org; you create a connection and allowlist their tools.</p><blockquote><strong><em>Connect the orgs first:</em></strong><em> Salesforce and Anypoint need a tenant trust or nothing syncs — </em><a href="https://docs.mulesoft.com/access-management/connecting-salesforce-orgs"><em>connect them once</em></a><em>. (No connection, or a non-MuleSoft server? Add it by hand via the </em><strong><em>Agentforce Registry</em></strong><em> or </em><strong><em>API Catalog → MCP Servers → Add MCP server</em></strong><em>.)</em></blockquote><ol><li>In your salesforce org click Setup (gear icon at right top) → search <strong>MCP Server</strong> → Select <strong>MCP Servers (</strong>under <strong>API Catalog)</strong>.</li><li><strong>Enable sync.</strong> Click <strong>Manage Sync</strong> and turn it on; your MuleSoft servers can take 10–15 minutes to appear. Each mcp server lands <strong>Inactive.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UiKNciw1ZP2ov-Y-pxxy5w.png" /></figure><p>3. <strong>To make it Active, </strong>click the down arrow on its right → <strong>Create Connection</strong>, give a label and <strong>description -&gt; </strong>click <strong>Save</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6N17plrEEZKrPMrYvrFtHg.png" /></figure><p>4. <strong>Confirm the tools — where it usually breaks.</strong> Click on your mcp server → <strong>Tools → Manage Tools</strong>. Empty list or error? Almost always a bad <strong>MCP server link</strong> — recheck the consumer endpoint (Anypoint → MCP Bridge).</p><ul><li><strong>Debug it:</strong> open the browser network panel (inspect element) and watch the connection call for the real error.</li><li><strong>Credentials error?</strong> On connect, Salesforce auto-registers a <strong>Named Credential</strong> for the bridge (Setup → <strong>Named Credentials</strong>; also linked from the MCP server config) — verify the MCP Bridge credential there.</li></ul><p>5. <strong>Add Tools what you need.</strong> Enable the tools the agent should call (e.g. post_orders); each becomes an action in the <strong>Subagent Asset Library</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sud6Ff3W3AqqpUtUMposvQ.png" /></figure><p>Now you are ready to use these mcp tools in your agentforce agent.</p><h3>Part 3 — Add MCP Tool in the Agentforce Agent</h3><p>I am going to add mcp tool in an existing agent. You can create a new agent also (check <a href="https://developer.salesforce.com/workshops/agentforce-workshop">here</a>).</p><ol><li><strong>Open the agent.</strong> In your Salesforce org: <strong>Apps → Agentforce Studio →</strong> open your agent (mine: <strong><em>Order Assistant</em></strong>). It opens in <strong>Agentforce Builder</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3gZJkU5CEsWVSLYdjupFsg.png" /></figure><p>2. <strong>Add the tool.</strong> In the <strong>Explorer</strong> panel, click the <strong>+</strong> next to your subagent (mine: Place Order — subagents were formerly called <em>topics</em>) → <strong>Add from Asset Library.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QYpUd2bmCxTJpgsSbZz_kg.png" /></figure><p>3. Search your MCP tool → <strong>Select</strong> → <strong>Add to Agent</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pNtaZaZs_qLHlzL6I_yXhQ.png" /></figure><p>4. <strong>Tune and save.</strong> The tool now appears as an <strong>action</strong> under that subagent. Tweak the subagent’s reasoning instructions as per the need, then <strong>Save</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NjVqGjWgtikS1KjNsHR_Tw.png" /></figure><p>That’s the whole connection. If you prefer the <strong>Script view</strong>, it’s the same action bound to the mcpTool:// target. The subagent parses the request and resolves the customer details first; the MCP tool is the call that actually places the order.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mop0bnjwS1zWamfEA0gPOg.png" /></figure><h3>Test it</h3><p>Click <strong>Preview</strong> and set the mode to <strong>Live Test Mode</strong>(Simulate mocks actions; <strong>Live Test runs the real call — the order is actually placed</strong>). Chat with the agent. I typed:</p><pre>I want to order 1 keyboard and 1 mouse for me.</pre><p>and it replied:</p><pre>Your order has been placed:<br>Order Number: SO-1011<br>Items:<br>- 1 keyboard<br>- 1 mouse<br>Would you like to track this order or need help with anything else?</pre><p>SO-1011 came back from the MuleSoft Order Management API — through the MCP Bridge, into the agent. A clean round trip means every layer is wired: the agent action, the API Catalog connection, inbound Client ID Enforcement, and outbound credential injection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_IXIv0EDG2dR0Yvs4XGuqw.png" /></figure><p><strong>Voilà — a few clicks, and a MuleSoft MCP server is integrated with Agentforce.</strong></p><h3>Common Issues and Solutions</h3><p>If the agent does not return the expected response, check the following:</p><h4><strong>1. MCP tool call is not visible in Preview settings or Trace</strong></h4><p><strong>a. Check MCP Tool Action in Subagent<br>Issue</strong>: MCP tool name is listed in <strong>Trace → Available Actions.</strong><br><strong>Solution: </strong>Check the MCP tool name and configuration details in the subagent. It is usually easier to verify this in <strong>script mode</strong>. Don’t change the name of the action in agent script.</p><p><strong>b. Tool is not called by Agent<br>Issue</strong>: Don’t see a call to your subagent or to the available action.<br><strong>Solution:</strong> Review the reasoning instructions. Improve the instructions so the agent clearly understands when and how to call the subagent or action.</p><h4><strong>2. MCP tool call failed</strong></h4><p><strong>Issue</strong>: MCP tool call failed. <br><strong>Solution: </strong>Check the error details in <strong>Trace</strong>, fix the underlying issue, and then run the agent again. Common errors are listed below.</p><p><strong>a. Authentication issue</strong><br>Verify the authentication configuration between <strong>Salesforce and the MuleSoft MCP Bridge</strong>, as well as between the <strong>MCP Bridge and the upstream API instance</strong>. Make sure credentials, tokens, permissions, and connection settings are valid.</p><p><strong>b. Gateway-related error</strong><br>Check whether your <strong>MCP instance is live and reachable</strong>. Also verify that the gateway configuration, endpoint URL, and network connectivity are correct.</p><p><strong>c. Other errors</strong><br>Reproduce the issue and review the application logs for more details. Use the logs to identify the root cause, update the configuration or code as needed, and then retry the MCP tool call.</p><h3>Wrapping up</h3><p>I started with a working MuleSoft API and an Agentforce agent, and one question: how to connect them without rebuilding either side. The MCP Bridge was the answer — it turns the existing API into agent-callable tools, and Agentforce calls them as native actions. No new integration code, on either side.</p><p>To take it further, point the same bridge at more APIs and operations, or swap the static outbound credentials for <strong>OAuth On-Behalf-Of</strong> so the end user’s identity flows through to the backend.</p><p>Built something similar, or hit a different error than the above? Drop it in the comments — I’ll help you trace it to its layer.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5cc8f5e468b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>