Apex SDK
Apex SDK for building Model Context Protocol (MCP) servers natively in Salesforce
What is Apex SDK?
Apex SDK is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to apex sdk for building model context protocol (mcp) servers natively in salesforce
Apex SDK for building Model Context Protocol (MCP) servers natively in Salesforce
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Apex SDK for building Model Context Protocol (MCP) servers n
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx mcp-apex-sdkConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Apex SDK
The MCP Apex SDK lets Salesforce developers build Model Context Protocol servers natively in Apex, Salesforce's platform language, without any external infrastructure. The SDK provides base classes (ctx.Tool, ctx.Resource, ctx.Prompt, ctx.Server) that map directly to MCP primitives, so teams can expose Salesforce data and business logic as AI-callable tools hosted entirely within their Salesforce org via a REST endpoint. It is designed for organisations that must keep AI integrations inside the Salesforce trust boundary.
Prerequisites
- A Salesforce org with permission to install managed packages (Developer, Sandbox, or Enterprise edition)
- Salesforce CLI (sf) for deploying example Apex classes
- Access to Salesforce Setup to create a Site and configure guest user access
- Basic Apex development knowledge
- An MCP-compatible AI client or the MCP Inspector tool for testing
Install the SDK package into your Salesforce org
Install the managed package using the provided Salesforce packaging link for your environment type (production or sandbox). This deploys the SDK base classes to your org.
# Install via Salesforce CLI (replace PACKAGE_VERSION_ID with the actual ID from the repo)
sf package install --package PACKAGE_VERSION_ID --target-org myorg --wait 10Deploy the demo Apex classes
Clone the repository and deploy the example server implementation from force-app/main/example/ to see a working MCP server before writing your own.
git clone https://github.com/bfmvsa/mcp-apex-sdk.git
cd mcp-apex-sdk
sf project deploy start --source-dir force-app/main/example --target-org myorgCreate a Salesforce Site and expose the endpoint
In Salesforce Setup, navigate to Sites, create a new site, and set DemoServer as the active page. Then go to Public Access Settings and add DemoServer to Enabled Apex Class Access.
Note your MCP endpoint URL
Your MCP server endpoint is constructed from your Site URL. For orgs without a namespace it is {site_url}/services/apexrest/mcp. For orgs with a namespace use {site_url}/services/apexrest/{namespace}/mcp.
Test connectivity with MCP Inspector
Use the MCP Inspector browser tool to connect to your Salesforce-hosted endpoint and verify that tools, resources, and prompts are listed correctly.
npx @modelcontextprotocol/inspectorBuild your own MCP server in Apex
Extend the SDK classes to expose your own Salesforce data and business logic. Create Tool, Resource, and Prompt implementations, then register them with ctx.Server.
// Example Apex tool definition
public class MyTool extends ctx.Tool {
public MyTool() {
this.name = 'get_account';
this.description = 'Retrieve a Salesforce Account by name';
}
public override Object call(Map<String, Object> args) {
String name = (String) args.get('name');
Account acc = [SELECT Id, Name, Industry FROM Account WHERE Name = :name LIMIT 1];
return acc;
}
}Apex SDK Examples
Client configuration
MCP client configuration pointing to a Salesforce-hosted MCP endpoint. Replace the URL with your actual Salesforce Site URL.
{
"mcpServers": {
"salesforce-mcp": {
"url": "https://yoursite.my.salesforce-sites.com/services/apexrest/mcp"
}
}
}Prompts to try
Example prompts for an MCP server exposing Salesforce data once the SDK is deployed.
- "List all open opportunities in Salesforce over $50,000"
- "Find the Account record for Acme Corp and show their industry and revenue"
- "Create a new lead in Salesforce with the contact details I'll provide"
- "Run the monthly sales report prompt and summarise the results"
- "What tools are available in this Salesforce MCP server?"Troubleshooting Apex SDK
MCP endpoint returns 404 or 'Page Not Found'
Confirm the Salesforce Site is active (not in Preview mode) and that DemoServer is listed under the site's Active Pages. Also check whether your org uses a namespace — if so, the URL must include it: /services/apexrest/{namespace}/mcp.
Guest user receives 'Insufficient Privileges' error when calling tools
In Salesforce Setup, navigate to the Site's Public Access Settings > Enabled Apex Classes and ensure your MCP server Apex class (e.g., DemoServer) is listed. Also verify that any objects accessed by your tools have appropriate object-level permissions on the guest user profile.
Package installation fails in sandbox
Use the sandbox-specific installation link from the repository (not the production link). Ensure the sandbox type supports managed packages — Developer Pro or higher is required. Check the installation log in Setup > Installed Packages for detailed error messages.
Frequently Asked Questions about Apex SDK
What is Apex SDK?
Apex SDK is a Model Context Protocol (MCP) server that apex sdk for building model context protocol (mcp) servers natively in salesforce It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Apex SDK?
Follow the installation instructions on the Apex SDK GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Apex SDK?
Apex SDK works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Apex SDK free to use?
Yes, Apex SDK is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
Apex SDK Alternatives — Similar Developer Tools Servers
Looking for alternatives to Apex SDK? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Apex SDK in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Apex SDK?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.