shishirvk/salesforce-dev-mcp
If you are the rightful owner of salesforce-dev-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
A Model Context Protocol (MCP) server designed to streamline Salesforce development by integrating Rally Dev user stories with Salesforce DX workflows.
Salesforce Developer MCP Server
A Model Context Protocol (MCP) server that assists Salesforce developers by integrating Rally Dev user stories with Salesforce DX development workflows.
Features
🏗️ Salesforce DX Operations
- Create and manage Salesforce DX projects
- Create and manage scratch orgs
- Deploy source code to orgs
- Generate Apex classes and Lightning Web Components
- Run Apex tests
- Query and manage org data
- Describe object schemas
- Import/export data
- Validate deployments
📊 Rally Integration
- Configure Rally API connections
- Fetch user stories and requirements
- Get task and test case information
- Search across Rally artifacts
- Access iteration data
🔄 Workflow Automation
- Analyze Rally user stories for Salesforce development
- Generate Salesforce component boilerplates based on requirements
- Create development checklists and estimates
- Map user story requirements to Salesforce capabilities
- Generate comprehensive test scenarios
- Estimate development effort
Installation
- Clone the repository:
git clone <repository-url>
cd salesforce-dev-mcp
- Install dependencies:
npm install
- Configure environment variables:
cp .env.example .env
# Edit .env with your Rally and Salesforce credentials
- Build the server:
npm run build
VS Code + GitHub Copilot Configuration
Prerequisites for Salesforce Engineers
Before setting up the MCP server with GitHub Copilot, ensure you have:
-
VS Code with Extensions:
- GitHub Copilot extension
- GitHub Copilot Chat extension
- Salesforce Extension Pack (recommended)
-
Salesforce CLI Setup:
# Install Salesforce CLI npm install -g @salesforce/cli # Verify installation sf --version # Authenticate with your Dev Hub sf org login web --set-default-dev-hub # Authenticate with sandbox/production orgs sf org login web --alias my-sandbox -
Rally Access:
- Rally account with API permissions
- Rally API key or username/password credentials
- Access to your Rally workspace and projects
Step 1: Install and Configure the MCP Server
-
Clone and build the MCP server (follow Installation steps above)
-
Configure your credentials in
.env:# Rally Configuration RALLY_USERNAME=your-rally-email@company.com RALLY_PASSWORD=your-rally-password RALLY_SERVER=https://rally1.rallydev.com RALLY_API_KEY=_your-rally-api-key-if-available # Salesforce Configuration SALESFORCE_USERNAME=your-sf-username@company.com SALESFORCE_PASSWORD=your-password-and-security-token SALESFORCE_LOGIN_URL=https://test.salesforce.com # For sandbox # SALESFORCE_LOGIN_URL=https://login.salesforce.com # For production # Optional: Connected App credentials for advanced auth SALESFORCE_CLIENT_ID=your-connected-app-consumer-key SALESFORCE_CLIENT_SECRET=your-connected-app-consumer-secret
Step 2: Configure VS Code Settings
-
Open VS Code Settings (
Cmd/Ctrl + ,) -
Search for "MCP" or navigate to Extensions → GitHub Copilot
-
Add MCP Server Configuration:
Option A: Via Settings UI
- Find "GitHub Copilot: MCP Servers" setting
- Click "Edit in settings.json"
Option B: Direct settings.json edit
- Open Command Palette (
Cmd/Ctrl + Shift + P) - Type "Preferences: Open User Settings (JSON)"
- Add the MCP server configuration
-
Add this configuration to your
settings.json:{ "github.copilot.advanced": { "mcp": { "servers": { "salesforce-dev-mcp": { "command": "node", "args": ["/path/to/salesforce-dev-mcp/dist/simple-server.js"], "env": { "NODE_ENV": "production" } } } } } }Replace
/path/to/salesforce-dev-mcpwith the actual path where you cloned the repository.
Step 3: Alternative Configuration Methods
Method 1: Using NPX (Recommended for Teams)
If you want to avoid local installation:
{
"github.copilot.advanced": {
"mcp": {
"servers": {
"salesforce-dev-mcp": {
"command": "npx",
"args": ["salesforce-dev-mcp@latest"],
"env": {
"RALLY_USERNAME": "your-username",
"RALLY_PASSWORD": "your-password",
"RALLY_SERVER": "https://rally1.rallydev.com"
}
}
}
}
}
}
Method 2: Using mcp-config.json
Create a workspace-specific configuration:
-
Create
mcp-config.jsonin your Salesforce project root:{ "mcpServers": { "salesforce-dev-mcp": { "command": "node", "args": ["./node_modules/.bin/salesforce-dev-mcp"], "env": { "RALLY_WORKSPACE_REF": "/workspace/123456789", "SFDX_DEFAULT_USERNAME": "my-dev-org" } } } } -
Reference in VS Code settings:
{ "github.copilot.advanced": { "mcp": { "configFile": "./mcp-config.json" } } }
Step 4: Verify the Setup
-
Restart VS Code to load the new MCP server configuration
-
Open GitHub Copilot Chat (
Cmd/Ctrl + Shift + I) -
Test the connection by asking:
@github Can you list the available Salesforce development tools? -
Expected response: Copilot should show available MCP tools like:
sfdx_create_projectrally_get_user_storiesanalyze_user_story- And 27+ other tools
Step 5: Team Configuration (Enterprise Setup)
For enterprise teams, consider:
Shared Configuration Template
Create a .vscode/settings.json in your team's Salesforce project repository:
{
"github.copilot.advanced": {
"mcp": {
"servers": {
"salesforce-dev-mcp": {
"command": "node",
"args": ["${workspaceFolder}/tools/salesforce-dev-mcp/dist/simple-server.js"],
"env": {
"RALLY_SERVER": "https://your-company.rallydev.com",
"SALESFORCE_LOGIN_URL": "https://your-company--sandbox.sandbox.my.salesforce.com",
"NODE_ENV": "production"
}
}
}
}
},
"files.associations": {
"*.cls": "apex",
"*.trigger": "apex"
}
}
Environment-Specific Configuration
{
"github.copilot.advanced": {
"mcp": {
"servers": {
"salesforce-dev-mcp-dev": {
"command": "node",
"args": ["./tools/mcp-server/dist/simple-server.js"],
"env": {
"NODE_ENV": "development",
"SALESFORCE_LOGIN_URL": "https://test.salesforce.com"
}
},
"salesforce-dev-mcp-prod": {
"command": "node",
"args": ["./tools/mcp-server/dist/simple-server.js"],
"env": {
"NODE_ENV": "production",
"SALESFORCE_LOGIN_URL": "https://login.salesforce.com"
}
}
}
}
}
}
Usage with GitHub Copilot
Once configured, Salesforce engineers can use natural language with GitHub Copilot to interact with Rally and Salesforce:
Example Copilot Interactions
Rally Integration
👤 "Get user story US12345 from Rally and analyze it for Salesforce development"
🤖 Copilot will:
1. Fetch the user story details from Rally
2. Analyze requirements for Salesforce implementation
3. Suggest Salesforce components needed
4. Provide development approach recommendations
Salesforce Development
👤 "Create a new Salesforce project for the customer portal feature"
🤖 Copilot will:
1. Create a new SFDX project
2. Set up project structure
3. Create a scratch org
4. Generate initial component boilerplate
End-to-End Workflow
👤 "Implement Rally story US12345 in Salesforce"
🤖 Copilot will:
1. Fetch story details from Rally
2. Analyze requirements and create development plan
3. Generate Apex classes and Lightning components
4. Create test scenarios based on story acceptance criteria
5. Set up deployment pipeline
Supported Copilot Commands
Rally Commands
"Get user stories from Rally for iteration X""Find Rally defects related to user story Y""Show me the acceptance criteria for story Z""List all tasks for user story ABC"
Salesforce Commands
"Create a new Apex class for [functionality]""Generate Lightning Web Component for [feature]""Deploy source to my scratch org""Run Apex tests and show results""Query Account records with [criteria]"
Workflow Commands
"Analyze this Rally story for Salesforce development""Generate boilerplate code for user story requirements""Create test scenarios based on story acceptance criteria""Estimate development effort for this feature"
Running the MCP Server
For development and testing:
npm run dev
For production use with Copilot:
npm start
The server runs continuously and communicates with GitHub Copilot through the Model Context Protocol.
Available Tools
Salesforce DX Tools
sfdx_create_project- Create a new Salesforce DX projectsfdx_create_scratch_org- Create a scratch org for developmentsfdx_deploy_source- Deploy source code to orgsfdx_create_apex_class- Create a new Apex classsfdx_create_lwc- Create a new Lightning Web Componentsfdx_run_tests- Run Apex testssfdx_list_orgs- List all authenticated orgssfdx_query_data- Execute SOQL queriessfdx_describe_object- Describe Salesforce object schemassfdx_get_org_limits- Get org limits and usage informationsfdx_export_data- Export data from Salesforcesfdx_import_data- Import data into Salesforcesfdx_validate_deployment- Validate deployments without deploying
Rally Integration Tools
rally_configure- Configure Rally API connectionrally_get_user_stories- Fetch user stories from Rallyrally_get_user_story- Get specific user story detailsrally_get_tasks- Fetch tasks for user storiesrally_search- Search across Rally artifactsrally_get_iterations- Get iteration information
Workflow Tools
analyze_user_story- Analyze Rally user story for Salesforce developmentgenerate_apex_boilerplate- Generate Apex class boilerplategenerate_lwc_boilerplate- Generate Lightning Web Component boilerplatecreate_development_checklist- Create development checklistsgenerate_test_scenarios- Generate comprehensive test scenariosmap_story_to_salesforce- Map requirements to Salesforce capabilitiesestimate_development_effort- Estimate development effort
Configuration
Rally Configuration
Set up your Rally connection using the rally_configure tool or environment variables:
RALLY_SERVER- Your Rally server URLRALLY_USERNAME/RALLY_PASSWORD- Rally credentialsRALLY_API_KEY- Rally API key (preferred over username/password)RALLY_WORKSPACE- Default workspaceRALLY_PROJECT- Default project
Salesforce Configuration
Ensure you have the Salesforce CLI installed and configured:
sf org login web --set-default-dev-hub
sf org login web --alias my-org
Troubleshooting
Common Setup Issues
MCP Server Not Found
Error: Cannot find module './dist/simple-server.js'
Solution: Ensure you've built the project:
cd /path/to/salesforce-dev-mcp
npm run build
Authentication Failures
Error: Rally authentication failed
Error: SFDX authentication failed
Solutions:
- Rally: Verify credentials in
.envfile - Salesforce: Re-authenticate with CLI:
sf org login web --alias my-org sf org list
VS Code Not Detecting MCP Server
- Restart VS Code after configuration changes
- Check settings.json syntax (use VS Code's JSON validation)
- Verify file paths are absolute and correct
- Check GitHub Copilot extension is enabled and authenticated
Environment Variables Not Loading
Error: RALLY_USERNAME is not defined
Solutions:
- Ensure
.envfile exists in project root - Check environment variable names match exactly
- For VS Code settings, use the
envobject in MCP configuration
Debug Mode
Enable debug logging by setting:
{
"github.copilot.advanced": {
"mcp": {
"servers": {
"salesforce-dev-mcp": {
"command": "node",
"args": ["./dist/simple-server.js"],
"env": {
"NODE_ENV": "development",
"LOG_LEVEL": "debug"
}
}
}
}
}
}
Getting Help
- Check the logs in VS Code Output panel → GitHub Copilot
- Validate your setup using the test script:
npm run validate - Test individual tools:
npm run test-tools
Example Workflow
- Configure Rally Integration:
rally_configure with your Rally server and credentials
- Fetch User Story:
rally_get_user_story with story ID "US1234"
- Analyze for Development:
analyze_user_story with the fetched story data
- Generate Components:
generate_apex_boilerplate for service classes
generate_lwc_boilerplate for UI components
- Create Project Structure:
sfdx_create_project for the new feature
sfdx_create_scratch_org for development
- Deploy and Test:
sfdx_deploy_source to scratch org
sfdx_run_tests for validation
Development
Project Structure
src/
├── index.ts # Main MCP server entry point
└── tools/
├── base.ts # Base tool interface
├── salesforce.ts # Salesforce DX tools
├── rally.ts # Rally integration tools
└── workflow.ts # Workflow automation tools
Building
npm run build
Testing
npm test
Linting
npm run lint
Prerequisites
- Node.js 18+
- Salesforce CLI (sf)
- Rally account with API access
- VS Code with MCP extension (for testing)
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
License
ISC License - see LICENSE file for details