npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@exiahuang/salesforce-mcp

v1.0.0

Published

Salesforce MCP Server - A Model Context Protocol server for Salesforce

Readme

@exiahuang/salesforce-mcp

Salesforce MCP Server - A Model Context Protocol server for Salesforce that enables AI assistants like Claude to interact with Salesforce orgs through a standardized protocol.

Overview

This MCP server provides comprehensive Salesforce integration using Salesforce CLI (sf) for authentication and direct REST API calls. It supports both standalone server mode and library mode for programmatic access.

Features

  • Connection Management: Auto-detect default org, support explicit alias, direct token injection
  • SOQL Queries: Execute queries, pagination support, aggregate functions, relationship queries
  • Tooling API: Query metadata (ApexClass, CustomField, FlowDefinition, etc.)
  • CRUD Operations: Create, Read, Update, Delete, Upsert records
  • Metadata Operations: Describe global, describe SObject, describe fields
  • Apex Execution: Execute anonymous Apex, run tests, get Apex class/trigger body
  • Debug Logs: Retrieve organization debug logs
  • User Management: Assign permission sets
  • Recent Records: Get recently accessed, updated, deleted records
  • API Limits: Query API usage limits
  • Chatter: Post feed items

Installation

npm install

Configuration

Environment Variables

Copy .env.example to .env and configure:

# Option 1: Direct token injection (highest priority)
SF_ACCESS_TOKEN=your_access_token_here
SF_INSTANCE_URL=https://yourinstance.salesforce.com

# Option 2: Use org alias
SF_ALIAS=myorg

# API Version (default: 65.0)
SF_API_VERSION=65.0

Priority Order

  1. Constructor parameter (library mode)
  2. SF_ACCESS_TOKEN + SF_INSTANCE_URL (env vars)
  3. SF_ALIAS (fetch via sf org display)
  4. Default org (auto-detect from sf config)

Usage

As Library

import { SalesforceClient } from '@exiahuang/salesforce-mcp';

const client = new SalesforceClient({
  apiVersion: '65.0',
  alias: 'myorg'
});

// Query
const accounts = await client.query('SELECT Id, Name FROM Account LIMIT 10');

// CRUD
await client.create('Account', [{ Name: 'Test Account' }]);
await client.update('Account', [{ Id: 'xxx', Name: 'Updated' }]);
await client.delete('Account', ['xxx']);

// Metadata
const sobjects = await client.describeGlobal();
const fields = await client.describe('Account');

As Standalone Server

npm run build
npm run start

Or with CLI:

sf-mcp

Development

# Setup
chmod +x init.sh
./init.sh

# Build
npm run build

# Test
npm test

# Type check
npm run typecheck

Project Structure

src/
├── index.ts          # Main exports
├── client.ts         # SalesforceClient class
├── server.ts         # MCP server wrapper
├── cli.ts            # CLI entry point
├── config.ts         # Configuration
├── types.ts          # TypeScript types
├── errors.ts         # Error classes
├── connection/       # Connection management
├── salesforce/       # REST API calls
├── sfcli/            # SF CLI wrapper
├── mcp/              # MCP tool definitions
└── tools/            # Tool implementations

MCP Tools

| Category | Tools | |----------|-------| | Connection | salesforce_get_org_info, salesforce_set_connection | | Query | salesforce_query, salesforce_query_more, salesforce_search, salesforce_tooling_query | | CRUD | salesforce_create, salesforce_read, salesforce_update, salesforce_delete, salesforce_upsert | | Metadata | salesforce_describe_global, salesforce_describe, salesforce_describe_field | | Apex | salesforce_execute_apex, salesforce_run_tests, salesforce_get_apex_body | | Logging | salesforce_get_logs | | User Management | salesforce_assign_permission_set | | Recent Records | salesforce_recently_accessedcently_updated, salesforce_recently_deleted | |, salesforce_re Limits | salesforce_get_limits | | Chatter | salesforce_chatter_post_feed_item |

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Salesforce CLI (sf) installed and configured
  • At least one Salesforce org authenticated

License

MIT