A Model Context Protocol (MCP) server that provides Salesforce org context to your IDE AI agent
IBM Salesforce Context
An MCP server by IBM that provides super-fast Salesforce org context and actions to your IDE AI agent
Table of contents
Key features
- Salesforce Integration: Seamless connection to Salesforce orgs for AI-powered development
- Built on Model Context Protocol
- Supports stdio and HTTP transport
- Comprehensive use of Model Context Protocol features: tools, resources, roots, prompts, elicitation, completion, sampling, progress notifications, logging, etc.
Toolset overview
| Tool | Description |
| --- | --- |
| apex_debug_logs | Inspect, activate, deactivate, or fetch Apex debug logs with enforced output formatting so you can keep traceability during troubleshooting sessions without ever touching the CLI. |
| chat_with_agentforce | Send curated prompts to Agentforce and receive structured responses that help coordinate guided automations or conversational assistance directly from the MCP client. |
| deploy_metadata | Deploy only the exact Apex classes, triggers, or Lightning bundles you list, guaranteeing atomic deployments and avoiding the risk of pushing entire folders by mistake. |
| describe_object | Retrieve complete schema details, including permissions, data types, picklist values, and relationship metadata for any sObject so tools can reliably map field API names. |
| execute_queries_and_dml | Batch multiple SOQL queries plus DML operations in one composite call, referencing earlier results to build transactional workflows with minimal round-trips. |
| generate_metadata | Scaffold Apex classes, test classes, triggers, or LWC/Aura bundles with best-practice boilerplate so you can start coding immediately while keeping folder structure consistent. |
| get_apex_class_code_coverage | Report coverage percentages, covered/uncovered line counts, and the exact test methods contributing to each class, making it easy to focus on the biggest gaps. |
| get_recently_viewed_records | Surface the most recently accessed records for the authenticated user, including links, so you can quickly jump back into active work without crafting SOQL. |
| get_record | Fetch a single record by Id with all requested fields plus formatted lookup references, ensuring MCP clients can present friendly names and deep links at once. |
| get_setup_audit_trail | Download filtered Setup Audit Trail entries with user, action, and timestamp data to trace admin changes or validate compliance requirements in seconds. |
| invoke_apex_rest_resource | Call any registered Apex REST resource in the org using GET/POST/PUT/PATCH/DELETE along with custom bodies and headers, then receive a structured response body. |
| run_anonymous_apex | Execute ad-hoc Apex snippets that skip DML/SOQL, perfect for utility code, logging, or feature toggles when you just need quick logic to run inside the org. |
| run_apex_test | Trigger test classes, suites, or selected methods, receive per-method runtime and status tables, and optionally fetch coverage for the classes impacted by the run. |
| utils | Retrieve org/user metadata, current datetime, record prefixes, or request cache resets so both humans and agents can understand the environment before issuing tool calls. |
Requirements
- Node.js v22 or newer
- Salesforce CLI installed globally and connected to an org
- Install:
npm install -g @salesforce/cli - Or visit: https://developer.salesforce.com/tools/salesforcecli
- Install:
- IDE with AI agent supporting MCP protocol
Getting started
Install in your IDE
Manual installation
Add this configuration to your client:
{
"mcpServers": {
"salesforce": {
"command": "npx",
"args": [
"-y",
"test_research4@latest"
]
}
}
}
Command Line Interface
IBM Salesforce Context supports comprehensive CLI arguments for configuration:
Basic Usage
# Use stdio transport (default)
test_research4
# Use HTTP transport
test_research4 --transport http
# Use HTTP transport with custom port
test_research4 --transport http --port 8080
# HTTP transport automatically finds available port if default is occupied
test_research4 --transport http # Will use 3001, 3002, etc. if 3000 is busy
# Set log level
test_research4 --transport stdio --log-level debug
# Set workspace paths
test_research4 --transport http --workspace /path/to/project
# Show help
test_research4 --help
# Show version
test_research4 --version
CLI Arguments
| Argument | Description | Default | Example |
|----------|-------------|---------|---------|
| --transport TYPE | Transport type: stdio or http | stdio | --transport http |
| --log-level LEVEL | Set log level | info | --log-level debug |
| --port PORT | HTTP port for http transport (auto-finds available if occupied) | 3000 | --port 8080 |
| --workspace PATHS | Workspace paths (comma-separated) | - | --workspace /path/to/project |
| --help | Show help message | - | --help |
| --version | Show version information | - | --version |
Environment Variables
Environment variables can be used for default configuration (overridden by CLI arguments):
| Variable | Description | Default | Example |
|----------|-------------|---------|---------|
| MCP_TRANSPORT | Transport type: stdio or http | stdio | MCP_TRANSPORT=http |
| LOG_LEVEL | Log level | info | LOG_LEVEL=debug |
| MCP_HTTP_PORT | HTTP port for http transport (auto-finds available if occupied) | 3000 | MCP_HTTP_PORT=8080 |
| WORKSPACE_FOLDER_PATHS | Workspace paths (comma-separated) | - | WORKSPACE_FOLDER_PATHS=/path/to/project |
Automatic Port Management
When using HTTP transport, the server automatically handles port conflicts:
- Default Behavior: Starts on port 3000 (or specified port)
- Port Conflict Detection: If the requested port is occupied, automatically finds the next available port
- User Notification: Displays a warning message when using an alternative port
- Port Range: Checks up to 10 consecutive ports starting from the requested port
- Error Handling: Clear error messages if no ports are available
Example output when port 3000 is occupied:
⚠️ Port 3000 is occupied. Using port 3001 instead.
🚀 MCP HTTP server running on port 3001
HTTP Endpoints
When running in HTTP mode, the server provides several useful endpoints:
Root Status Page
# Open in browser or use curl
curl http://localhost:3000/
Returns a beautiful HTML dashboard showing:
- Server status and uptime
- Salesforce CLI version and org connection status
- Available MCP tools and resources
- Environment information
- Real-time status updates
The root page serves as the default landing page when accessing the server in a web browser.
Health Check Endpoint
curl http://localhost:3000/healthz
Returns basic health information:
{
"status": "healthy",
"timestamp": "2024-01-15T10:30:00.000Z",
"activeSessions": 2,
"serverType": "MCP HTTP Server",
"version": "1.0.0"
}
Detailed Status Endpoint
curl http://localhost:3000/status
Returns comprehensive server information including:
- Server details (name, version, uptime)
- Active MCP sessions
- Salesforce CLI version and org connection status
- Available MCP tools and resources
- Environment information
Priority Order
Configuration values are applied in the following priority order:
- CLI Arguments (highest priority)
- Environment Variables (medium priority)
- Defaults (lowest priority)
Examples
# CLI argument overrides environment variable
MCP_TRANSPORT=http test_research4 --transport stdio # Result: stdio
# Environment variable when no CLI argument
MCP_TRANSPORT=http test_research4 # Result: http
# Default when no CLI or environment variable
test_research4 # Result: stdio
# Complex configuration
test_research4 --transport http --port 3001 --log-level debug --workspace /path/to/project
License
See the LICENSE file for details.