Skip to main content
Glama
salesforce-mcp

salesforce-mcp

by uoparaji
README.md
# Salesforce MCP Server

A [Model Context Protocol](https://modelcontextprotocol.io/) server that connects AI assistants to Salesforce orgs. Enables querying, searching, creating, updating, and managing Salesforce data through natural language via any MCP-compatible client.

## Setup

### Prerequisites

- Node.js 18+
- A Salesforce org with API access

### Installation

```bash
npm install
```

### Configuration

Copy the example env file and fill in your Salesforce credentials:

```bash
cp .env.example .env
```

| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `SF_USERNAME` | Yes | — | Salesforce username |
| `SF_PASSWORD` | Yes | — | Salesforce password |
| `SF_SECURITY_TOKEN` | No | `""` | Security token (appended to password) |
| `SF_LOGIN_URL` | No | `https://login.salesforce.com` | Login URL (use `https://test.salesforce.com` for sandboxes) |

### Build & Run

```bash
npm run build
npm start
```

## MCP Client Configuration

Add to your MCP client config (e.g. Claude Desktop `claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "salesforce": {
      "command": "node",
      "args": ["/absolute/path/to/salesforce_mcp/dist/index.js"],
      "env": {
        "SF_USERNAME": "your_username",
        "SF_PASSWORD": "your_password",
        "SF_SECURITY_TOKEN": "your_token",
        "SF_LOGIN_URL": "https://login.salesforce.com"
      }
    }
  }
}
```

## Available Tools

### Query & Search
- **salesforce_query** — Execute a SOQL query (first batch, up to 2000 records)
- **salesforce_query_all** — SOQL query with automatic pagination (configurable max records)
- **salesforce_query_more** — Fetch next batch using `nextRecordsUrl`
- **salesforce_search** — Execute a SOSL search

### Object Metadata
- **salesforce_describe_object** — Get fields, relationships, and record types for an sObject
- **salesforce_list_objects** — List all sObjects in the org

### CRUD Operations
- **salesforce_get_record** — Get a record by ID
- **salesforce_create_record** — Create a new record
- **salesforce_update_record** — Update an existing record
- **salesforce_delete_record** — Delete a record by ID

### Reports & Dashboards
- **salesforce_list_reports** — List all reports
- **salesforce_run_report** — Execute a report by ID
- **salesforce_describe_report** — Get report metadata (columns, filters, groupings)
- **salesforce_list_dashboards** — List all dashboards
- **salesforce_get_dashboard** — Get dashboard component data and status

### Tooling API
- **salesforce_tooling_query** — Query Apex classes, triggers, flows, validation rules, etc.
- **salesforce_get_metadata_component** — Retrieve full source of a metadata component
- **salesforce_describe_tooling_object** — Get fields for a Tooling API sObject

### Apex Execution
- **salesforce_execute_apex** — Run anonymous Apex code

### Org Info & REST
- **salesforce_get_org_limits** — View API call limits, storage usage, etc.
- **salesforce_get_org_info** — Org edition, instance, API version, user info
- **salesforce_rest_api** — Generic REST API call for any endpoint

## License

MIT

TDQS

B3.4/5.0

Scored across 22 tools

Disambiguation4/5

Most tools have clearly distinct resource+action targets: record CRUD, report/dashboard operations, tooling metadata, and org info are well separated. The only real overlap zone is the query family (query, query_all, query_more, tooling_query) plus the generic rest_api escape hatch, but descriptions clarify when each applies (first batch vs auto-pagination vs nextRecordsUrl vs Tooling API).

Naming Consistency4/5

Nearly all names follow a predictable salesforce_verb_noun snake_case pattern (list_objects, get_record, create_record, run_report, describe_object). Minor deviations exist, notably salesforce_rest_api, which is resource-named rather than verb_named, and the query trio varies only by suffix.

Tool Count4/5

At 22 tools the surface is on the heavy side, but Salesforce is a broad platform and each tool maps to a real capability area (data, reports, dashboards, tooling, Apex, limits). No tool appears redundant enough to be trivially removable.

Completeness4/5

Coverage is strong: full record CRUD, SOQL with pagination, SOSL search, describe calls, reports/dashboards, Tooling API, anonymous Apex, org limits/info, and a generic REST escape hatch for anything else. Gaps are minor and largely mitigated by rest_api — e.g. no Metadata API deploy/retrieve, no bulk API, no list views or file/attachment tools.