Labsco
steffensbola logo

Salesforce TypeScript Connector

β˜… 2

from steffensbola

Interact with Salesforce data using SOQL queries, SOSL searches, and CRUD operations via a TypeScript MCP server.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedAccount requiredAdvanced setup

MCP Salesforce TypeScript Connector

A TypeScript implementation of a Model Context Protocol (MCP) server for Salesforce integration, allowing LLMs to interact with Salesforce data through SOQL queries, SOSL searches, and CRUD operations.

Features

  • πŸ” Simplified Password Authentication: Secure OAuth 2.0 Resource Owner Password Credentials Flow
  • πŸ“Š SOQL & SOSL: Execute queries and searches against Salesforce
  • πŸ” Metadata Access: Retrieve object fields, labels, and types
  • ✏️ CRUD Operations: Create, read, update, and delete records
  • πŸ› οΈ Tooling API: Execute Tooling API requests
  • ⚑ Apex REST: Execute Apex REST requests
  • 🌐 REST API: Make direct REST API calls to Salesforce
  • 🐳 Docker Ready: No hardcoded values, fully configurable via environment variables
  • πŸ”„ Token Refresh: Automatic token refresh for long-running sessions

Available Tools

  • authenticate_password - Authenticate using username/password with OAuth
  • run_soql_query - Execute SOQL queries
  • run_sosl_search - Execute SOSL searches
  • get_object_fields - Get metadata for Salesforce objects
  • get_record - Retrieve specific records by ID
  • create_record - Create new records
  • update_record - Update existing records
  • delete_record - Delete records
  • tooling_execute - Execute Tooling API requests
  • apex_execute - Execute Apex REST requests
  • restful - Make direct REST API calls

Environment Variables

The server requires the following environment variables:

Required (OAuth Authentication)

  • SALESFORCE_CLIENT_ID - Consumer Key from your Connected App
  • SALESFORCE_CLIENT_SECRET - Consumer Secret from your Connected App
  • SALESFORCE_USERNAME - Your Salesforce username
  • SALESFORCE_PASSWORD - Your Salesforce password
  • SALESFORCE_SECURITY_TOKEN - Your Salesforce security token

Optional

  • SALESFORCE_SANDBOX - Set to "true" for sandbox, "false" for production (default: "false")

Alternative (Direct Token Authentication)

Instead of username/password, you can use:

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

Backward Compatibility

The server also supports alternative variable names:

  • SF_CONSUMER_KEY / SF_CONSUMER_SECRET
  • SF_USERNAME / SF_PASSWORD / SF_SECURITY_TOKEN

Using Docker Compose

  1. Create a .env file with your environment variables:
SALESFORCE_CLIENT_ID=your_consumer_key
SALESFORCE_CLIENT_SECRET=your_consumer_secret
SALESFORCE_USERNAME=your_username@domain.com
SALESFORCE_PASSWORD=your_password
SALESFORCE_SECURITY_TOKEN=your_token
SALESFORCE_SANDBOX=true
DOCKER_HUB_USERNAME=steffensbola
  1. Run using Docker Compose:
docker-compose up -d

Examples

Using the Tools

Once connected, you can use the tools through your MCP client:

Authentication:

Please authenticate with Salesforce using my credentials

Query Data:

Run this SOQL query: SELECT Id, Name, Industry FROM Account WHERE Industry = 'Technology' LIMIT 10

Search:

Search for contacts named "John" using SOSL

Get Metadata:

Get all the fields for the Contact object

Create Record:

Create a new Account with Name "Test Company" and Industry "Technology"

Contributing

See CONTRIBUTING.md for information about:

  • Project architecture and development setup
  • Running from source code
  • Contributing guidelines and pull request process

License

MIT License - see LICENSE file for details.

Links