I've seen some tutorials where people connect their IDEs like Cursor or the Claude Desktop app to local MCP servers. Is it possible to point these local clients to a "Hosted" MCP server inside a Salesforce Sandbox? I'd love to use natural language to query my org's metadata and run Apex tests directly from my coding environment using this protocol.
3 answers
Yes, this is one of the coolest use cases for the Salesforce DX MCP Server! You can configure your claude_desktop_config.json or Cursor's MCP settings to point to the Salesforce endpoint. You'll need the SALESFORCE_ACCESS_TOKEN and the INSTANCE_URL. Once connected, you can literally ask Claude, "Show me all the fields in the Account object," or "Run the AccountTriggerTest class and show me the coverage." It uses the Tooling API under the hood but abstracts it through the MCP standard, making it feel like you're just chatting with your codebase. It saves a ton of time during the initial discovery phase of a project.
Does this setup require a permanent connection, or can it work with Scratch Orgs? I’m worried that if I’m constantly spinning up new environments, updating the access tokens in my local JSON config files will become a massive headache for my dev team.
It works great with Cursor. I’ve been using it to generate SOQL queries based on natural language descriptions of the relationships, and it's remarkably accurate.
I agree with Megan. The "relationship support" in the Salesforce MCP implementation is top-notch. It handles parent-child subqueries much better than a generic LLM would without that specific schema context.
Thomas, you can actually automate the token update using a simple shell script or a Salesforce CLI plugin. When you run sf org display, you can pipe the access token directly into your MCP config. This way, your team stays synced with whatever Scratch Org is currently set as the default. It’s a very agile way to handle development, especially when you're iterating on complex AI prompts that need real-time metadata.