Skip to main content

mcp-salesforce-lite

Simple and lightweight Salesforce MCP server for connecting AI assistants to Salesforce data. Ideal for prototyping and small projects.

Overview

This MCP (Model Context Protocol) server provides AI assistants like Claude with secure access to Salesforce data and operations. It implements the MCP standard to enable seamless integration between AI applications and Salesforce CRM.

Features

  • 🔐 Secure Salesforce authentication via OAuth 2.0
  • 📊 Access to Salesforce objects (Accounts, Contacts, Opportunities, etc.)
  • 🔍 SOQL query execution
  • 📝 CRUD operations on Salesforce records
  • 🛡️ Built-in security and rate limiting
  • 🚀 Easy setup and configuration

Quick Start with Claude Desktop

The easiest way to use this MCP server is to install it directly from PyPI and configure it with Claude Desktop.

Step 1: Configure Claude Desktop

Add the following configuration to your Claude Desktop settings file:

Configuration File Location:

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

Configuration:

{
  "mcpServers": {
    "salesforce-lite": {
      "command": "uvx",
      "args": [
        "--from",
        "mcp-salesforce-lite",
        "mcp-salesforce-lite"
      ],
      "env": {
        "SALESFORCE_ACCESS_TOKEN": "your_access_token",
        "SALESFORCE_INSTANCE_URL": "your_instance_url"
      }
    }
  }
}

Step 2: Set Up Salesforce Credentials

Replace the environment variables in the configuration:

  • SALESFORCE_ACCESS_TOKEN: Your Salesforce access token
  • SALESFORCE_INSTANCE_URL: Your Salesforce instance URL (e.g., https://yourcompany.my.salesforce.com)

Step 3: Restart Claude Desktop

After saving the configuration, restart Claude Desktop. You should see a hammer icon indicating that tools are available.

Step 4: Test the Integration

Try asking Claude:

  • "List available Salesforce objects"
  • "Describe the Account object"
  • "Execute a SOQL query to get recent leads"

Prerequisites

  • Python 3.10 or higher
  • Salesforce Developer/Production org
  • Connected App configured in Salesforce

Development Setup

If you want to modify or contribute to this MCP server, follow these development setup instructions.

Installation

# Install uv if you haven't already
brew install uv  # macOS
# or
curl -LsSf https://astral.sh/uv/install.sh | sh  # Linux/macOS

# Clone and install the server
git clone https://github.com/yourusername/mcp-salesforce-lite.git
cd mcp-salesforce-lite
uv sync

Option 2: Using Poetry

git clone https://github.com/yourusername/mcp-salesforce-lite.git
cd mcp-salesforce-lite
poetry install

Salesforce Development Setup

Create a .env file in the project root:

SALESFORCE_ACCESS_TOKEN=your_access_token
SALESFORCE_INSTANCE_URL=your_instance_url

Usage

Development Mode

First, make sure you have your Salesforce credentials configured in your .env file.

Method 1: Direct Python Execution

# Run the server directly
python src/mcp_salesforce_lite/server.py

Method 2: Using Poetry

# Run with Poetry
poetry run python src/mcp_salesforce_lite/server.py
# Run with UV
uv run python src/mcp_salesforce_lite/server.py

Testing with MCP Inspector

If you have the MCP CLI installed, you can test your server:

# Test with MCP Inspector
mcp inspector

# Or run in development mode
mcp dev src/mcp_salesforce_lite/server.py

How to Release the Server as a Pip Package

The server can be packaged and distributed via PyPI using the included pyproject.toml configuration.

Available Tools

The server provides the following tools that AI assistants can use:

Query Tools

  • soql_query: Execute SOQL queries (schema must be defined to carefully ask for confirmation of UPDATE and DELETE operations)
  • search_records: Search records across multiple objects with limit and pagination
  • get_record: Retrieve a specific record by ID with limit and pagination

CRUD Operations

  • create_record: Create new records (make sure to describe_object first, and find the reference fields of the objects)
  • update_record: Update existing records
  • delete_record: Delete records

Metadata Tools

  • describe_object_definition: Get object metadata and field information with pagination
  • list_avail_objects: List available Salesforce objects with limit and pagination

Development Claude Desktop Integration

If you're developing or running the server from source, you can use these alternative configurations:

💡 Tip: Example configuration files are provided in the examples/ directory:

  • examples/claude_config_direct.json - Direct Python execution
  • examples/claude_config_poetry.json - Poetry execution
  • examples/claude_config_uv.json - UV execution (recommended)

Option 1: Direct Python Execution

{
  "mcpServers": {
    "salesforce-lite": {
      "command": "python",
      "args": ["/ABSOLUTE/PATH/TO/mcp-salesforce-lite/src/mcp_salesforce_lite/server.py"],
      "env": {
        "SALESFORCE_ACCESS_TOKEN": "your_access_token",
        "SALESFORCE_INSTANCE_URL": "your_instance_url"
      }
    }
  }
}

Option 2: Poetry Execution

{
  "mcpServers": {
    "salesforce-lite": {
      "command": "poetry",
      "args": [
        "--directory",
        "/ABSOLUTE/PATH/TO/mcp-salesforce-lite",
        "run",
        "python",
        "src/mcp_salesforce_lite/server.py"
      ],
      "env": {
        "SALESFORCE_ACCESS_TOKEN": "your_access_token",
        "SALESFORCE_INSTANCE_URL": "your_instance_url"
      }
    }
  }
}
{
  "mcpServers": {
    "salesforce-lite": {
      "command": "uv",
      "args": [
        "--directory",
        "/ABSOLUTE/PATH/TO/mcp-salesforce-lite",
        "run",
        "python",
        "src/mcp_salesforce_lite/server.py"
      ],
      "env": {
        "SALESFORCE_ACCESS_TOKEN": "your_access_token",
        "SALESFORCE_INSTANCE_URL": "your_instance_url"
      }
    }
  }
}

Project Structure

mcp-salesforce-lite/
├── src/
│   └── mcp_salesforce_lite/
│       ├── __init__.py
│       ├── server.py          # Main MCP server
│       ├── client.py          # Salesforce client wrapper
│       ├── config.py          # Configuration management
│       └── tools/
│           ├── __init__.py
│           ├── query.py       # SOQL query tools
│           ├── crud.py        # Create, Read, Update, Delete tools
│           └── metadata.py    # Object metadata tools
├── tests/
│   ├── __init__.py
│   ├── test_server.py
│   ├── test_client.py
│   └── test_tools/
│       ├── test_query.py
│       ├── test_crud.py
│       └── test_metadata.py
├── examples/
│   ├── basic_usage.py
│   └── claude_config.json
├── .env.example
├── pyproject.toml
├── poetry.lock
└── uv.lock

Release

Prerequisites

  1. Register for PyPI Production: Go to https://pypi.org/account/register/
  2. Enable 2FA: Set up two-factor authentication in your account settings
  3. Create API Token: Go to https://pypi.org/manage/account/token/ and create a token
  4. Update .pypirc: Replace pypi-YOUR_PRODUCTION_TOKEN_FROM_PYPI_ORG_HERE with your actual token

Publishing Process

  1. Test on TestPyPI first:
# Build the package
uv build
# or: poetry build

# Upload to TestPyPI
twine upload --repository testpypi --config-file .pypirc dist/*

# Test install from TestPyPI
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ mcp-salesforce-lite
  1. Publish to Production PyPI:
# Upload to production PyPI
twine upload --repository pypi --config-file .pypirc dist/*

# Test install from production PyPI
pip install mcp-salesforce-lite

Version Management

To publish a new version:

  1. Update the version in pyproject.toml
  2. Rebuild: uv build or poetry build
  3. Upload: twine upload --repository pypi --config-file .pypirc dist/*

Metadata

Release files for mcp-salesforce-lite 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-salesforce-lite 0.1.1
File Size Uploaded
mcp_salesforce_lite-0.1.1.tar.gz 12.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-salesforce-lite 0.1.1
File Interpreter ABI Platform
mcp_salesforce_lite-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 26.3 kB

Release files / mcp_salesforce_lite-0.1.1.tar.gz

Download URL mcp_salesforce_lite-0.1.1.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
16deb6dd01232a363645aafbe9d97576260d8790c50f1a56f176ad4d8278982b
BLAKE2b-256 checksum
How to use checksums
2fd6041f9d49b6eb10dcc860f9860b72f481c46ad734a14fc0a2f2c6fe18069a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.5

Release files / mcp_salesforce_lite-0.1.1-py3-none-any.whl

Download URL mcp_salesforce_lite-0.1.1-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7dff8c639a6d7c0f2dbfcc5746e8f6b8d1a7476e216a92e6d5626683aaf7167d
BLAKE2b-256 checksum
How to use checksums
63646500f9d734a05e29d4814dfa4f4f05a9d631ca708accb72c5c4cefa20b31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.5

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page