Skip to main content

Simple and lightweight Salesforce MCP server for connecting AI assistants to Salesforce data

Project description

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

Production Usage (Recommended)

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

Option 1: Using uv (Recommended for development)

# 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

Method 3: Using UV (Recommended)

# 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"
      }
    }
  }
}

Option 3: UV Execution (Recommended for Development)

{
  "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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_salesforce_lite-0.1.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_salesforce_lite-0.1.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file mcp_salesforce_lite-0.1.0.tar.gz.

File metadata

  • Download URL: mcp_salesforce_lite-0.1.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.5

File hashes

Hashes for mcp_salesforce_lite-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a849c5ae4a63599c14013de16a6e2bc4496e8ac9d47a535ac9d65af27a33cbfb
MD5 ff178e394ae1f051012ecb11e6c2d867
BLAKE2b-256 541126d8a80e9c27922bde9036d32a9d98b503e1f39a161c372a34f30bc4520c

See more details on using hashes here.

File details

Details for the file mcp_salesforce_lite-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_salesforce_lite-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 987d37f3f47609901f45e58a5114d0ac27fc7d0004b9699245e5177ae89f22f5
MD5 f0563b933bb549ebdd4a69c4697970b9
BLAKE2b-256 d05166a6f6369e458f4e2f574aa1425db2e903791d7a842c1324fb19f91f1318

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page