Salesforce MCP server

Integrates with Salesforce to enable querying records, managing custom objects/fields, executing DML operations, and handling complex SOSL searches using TypeScript and JSForce
Back to servers
Setup instructions
Provider
Suraj Adsul
Release date
Mar 25, 2025
Language
TypeScript

The Salesforce MCP server enables natural language interactions with your Salesforce data and metadata, allowing Claude to query, modify, and manage Salesforce objects and records using everyday language without complicated technical commands.

Installation

Install the MCP server globally with npm:

npm install -g @surajadsul02/mcp-server-salesforce

Authentication Setup

You can authenticate with Salesforce using one of two methods:

Username/Password Authentication

  1. Set up your Salesforce credentials
  2. Get your security token (Reset from Salesforce Settings)
  3. Configure the environment variables as shown below

OAuth2 Authentication with Consumer Key/Secret

  1. Set up a Connected App in Salesforce
  2. Get the Consumer Key and Consumer Secret
  3. Configure the environment variables as shown below

Required Environment Variables

For Username/Password Authentication:

  • SALESFORCE_USERNAME: Your Salesforce username/email
  • SALESFORCE_PASSWORD: Your Salesforce password
  • SALESFORCE_TOKEN: Your Salesforce security token
  • SALESFORCE_INSTANCE_URL: Your Salesforce instance URL (Optional, default: https://login.salesforce.com)

For OAuth2 Authentication:

  • SALESFORCE_USERNAME: Your Salesforce username/email
  • SALESFORCE_PASSWORD: Your Salesforce password
  • SALESFORCE_CONSUMER_KEY: Your Connected App's consumer key
  • SALESFORCE_CONSUMER_SECRET: Your Connected App's consumer secret
  • SALESFORCE_INSTANCE_URL: Your Salesforce instance URL (Optional, default: https://login.salesforce.com)

IDE Integration

Cursor IDE Setup

  1. Install the package globally (if not already done):
npm install -g @surajadsul02/mcp-server-salesforce
  1. Configure the MCP server in Cursor IDE .cursor/mcp.json:

Using Username/Password Authentication:

{
  "mcpServers": {
    "salesforce": {
      "command": "env",
      "args": [
        "[email protected]",
        "SALESFORCE_PASSWORD=YourActualPassword123",
        "SALESFORCE_TOKEN=YourActualSecurityToken123",
        "SALESFORCE_INSTANCE_URL=https://login.salesforce.com",
        "npx",
        "-y",
        "@surajadsul02/mcp-server-salesforce"
      ]
    }
  }
}

Using OAuth2 Authentication:

{
  "mcpServers": {
    "salesforce": {
      "command": "env",
      "args": [
        "[email protected]",
        "SALESFORCE_PASSWORD=YourActualPassword123",
        "SALESFORCE_CONSUMER_KEY=YourConsumerKey",
        "SALESFORCE_CONSUMER_SECRET=YourConsumerSecret",
        "SALESFORCE_INSTANCE_URL=https://login.salesforce.com",
        "npx",
        "-y",
        "@surajadsul02/mcp-server-salesforce"
      ]
    }
  }
}

Claude Desktop Setup

  1. Install the package globally (if not already done):
npm install -g @surajadsul02/mcp-server-salesforce
  1. Add to your claude_desktop_config.json:

For Username/Password Authentication:

{
  "mcpServers": {
    "salesforce": {
      "command": "npx",
      "args": ["-y", "@surajadsul02/mcp-server-salesforce"],
      "env": {
        "SALESFORCE_USERNAME": "your_username",
        "SALESFORCE_PASSWORD": "your_password",
        "SALESFORCE_TOKEN": "your_security_token",
        "SALESFORCE_INSTANCE_URL": "https://login.salesforce.com"
      }
    }
  }
}

For OAuth2 Authentication:

{
  "mcpServers": {
    "salesforce": {
      "command": "npx",
      "args": ["-y", "@surajadsul02/mcp-server-salesforce"],
      "env": {
        "SALESFORCE_USERNAME": "your_username",
        "SALESFORCE_PASSWORD": "your_password",
        "SALESFORCE_CONSUMER_KEY": "your_consumer_key",
        "SALESFORCE_CONSUMER_SECRET": "your_consumer_secret",
        "SALESFORCE_INSTANCE_URL": "https://login.salesforce.com"
      }
    }
  }
}
  1. Configuration File Location:
    • macOS: ~/Library/Application Support/Claude Desktop/claude_desktop_config.json
    • Windows: %APPDATA%\Claude Desktop\claude_desktop_config.json
    • Linux: ~/.config/Claude Desktop/claude_desktop_config.json

Using the MCP Server

Once configured, you can interact with Salesforce using natural language commands:

Searching Objects

"Find all objects related to Accounts"
"Show me objects that handle customer service"
"What objects are available for order management?"

Getting Schema Information

"What fields are available in the Account object?"
"Show me the picklist values for Case Status"
"Describe the relationship fields in Opportunity"

Querying Records

"Get all Accounts created this month"
"Show me high-priority Cases with their related Contacts"
"Find all Opportunities over $100k"

Managing Custom Objects

"Create a Customer Feedback object"
"Add a Rating field to the Feedback object"
"Update sharing settings for the Service Request object"

Searching Across Objects

"Search for 'cloud' in Accounts and Opportunities"
"Find mentions of 'network issue' in Cases and Knowledge Articles"
"Search for customer name across all relevant objects"

Troubleshooting

Authentication Errors

  • Verify your credentials are correct
  • For username/password auth: ensure security token is correct
  • For OAuth2: verify consumer key and secret

Connection Issues

  • Check your Salesforce instance URL
  • Verify network connectivity
  • Ensure proper API access permissions

Cursor IDE Integration

  • Restart Cursor IDE after configuration changes
  • Check Developer Tools (Help > Toggle Developer Tools) for error messages
  • Verify the package is installed globally

Claude Desktop Integration

  • Verify configuration file location
  • Check file permissions
  • Restart Claude Desktop after configuration changes
  • Ensure environment variables are properly set

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "salesforce" '{"command":"npx","args":["-y","@surajadsul02/mcp-server-salesforce"],"env":{"SALESFORCE_USERNAME":"your_username","SALESFORCE_PASSWORD":"your_password","SALESFORCE_TOKEN":"your_security_token","SALESFORCE_INSTANCE_URL":"https://login.salesforce.com"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "salesforce": {
            "command": "npx",
            "args": [
                "-y",
                "@surajadsul02/mcp-server-salesforce"
            ],
            "env": {
                "SALESFORCE_USERNAME": "your_username",
                "SALESFORCE_PASSWORD": "your_password",
                "SALESFORCE_TOKEN": "your_security_token",
                "SALESFORCE_INSTANCE_URL": "https://login.salesforce.com"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "salesforce": {
            "command": "npx",
            "args": [
                "-y",
                "@surajadsul02/mcp-server-salesforce"
            ],
            "env": {
                "SALESFORCE_USERNAME": "your_username",
                "SALESFORCE_PASSWORD": "your_password",
                "SALESFORCE_TOKEN": "your_security_token",
                "SALESFORCE_INSTANCE_URL": "https://login.salesforce.com"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later