Model Context Protocol (MCP) SDK and server for the Salesforce Toolkit (SF Toolkit).
sf-toolkit-mcp is a Node.js server that implements the Model Context Protocol (MCP) to provide a bridge between the SF Toolkit and Salesforce orgs. It exposes a set of tools and APIs for interacting with Salesforce, managing orgs, running SOQL queries, navigating toolkit applications, and more. The server is designed to be extensible and integrates with the SF Toolkit via the MCP protocol over stdio.
- MCP Server: Implements the Model Context Protocol for tool-based automation and integration.
- Salesforce Org Management: List orgs, fetch session IDs, and manage org windows.
- SOQL Query Execution: Display SOQL queries in the SF Toolkit.
- Navigation: Programmatically navigate to different applications within the SF Toolkit.
- REST API & Metadata Operations: (Extensible) Support for REST API calls and metadata operations via JSforce.
- Extensible Handlers: Modular handler system for adding new tools and integrations.
- Clone the repository:
git clone https://github.com/grebmann1/sf-toolkit-mcp.git cd sf-toolkit-mcp - Install dependencies:
npm install
- (Optional) Configure environment variables in a
.envfile:API_HOST(default:http://localhost)API_PORT(default:12346)OAUTH_DISABLED(default:false)
Before running as a CLI or using with npx, build the project:
npm run buildThis will generate the bundled output in the dist/ directory.
Start the MCP server:
npm startYou can run the server as a CLI tool after building:
npx ./Or, if you have linked the package globally:
sf-toolkit-mcpOnce published, you (or others) can run:
npx sf-toolkit-mcpTo start in watch mode (auto-rebuild on changes):
npm run dev- Entry Point:
src/index.jsinitializes the MCP server, registers handlers, and starts the stdio transport. - Handlers: Located in
src/handlers/, each handler registers a set of tools with the MCP server. Handlers include:global: Tools for window management and launching the SF Toolkit.org: Tools for org listing and session management.navigation: Tools for navigating to specific applications in the SF Toolkit.applications/soql: Tool for displaying SOQL queries in the SF Toolkit.- (Extensible)
applications/restapi,documentation,jsforceMcpfor advanced Salesforce operations.
- Utilities: Common utilities for error handling and fetch response management.
global_listOfWindows: List open SF Toolkit windows.global_openSpecificOrg: Open the SF Toolkit for a specific org alias.global_openToolkitProtocol: Launch the SF Toolkit using the OS protocol.
Org_getListOfOrgs: List all locally stored and SFDX orgs.Org_getSessionIdAndServerUrl: Fetch sessionId and serverUrl for an org (if OAuth enabled).
Navigation_navigate: Navigate to a specific application (soql, api, anonymousapex, org, metadata, etc.) in the SF Toolkit.
SOQL_displayQueryInSFToolkit: Display a SOQL query in the SF Toolkit for a given org alias.
- REST API Handler: Run REST API calls and manage saved API scripts.
- Documentation Handler: Search documentation.
- JSforce MCP Handler: Advanced Salesforce operations (SOQL, REST, Metadata, Apex, SObject, User, Deployment, etc.).
- Handlers are modular and can be extended by adding new files in
src/handlers/and registering them insrc/index.js. - Utilities for error logging and fetch handling are in
src/handlers/util.js. - The project uses zod for schema validation and jsforce for Salesforce API integration.
- This project is licensed under the MIT License. See LICENSE for the full license text.