polaris-orion-salesforce-mcp-server

jasonjuela/polaris-orion-salesforce-mcp-server

3.2

If you are the rightful owner of polaris-orion-salesforce-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Salesforce MCP Assistant is a comprehensive platform designed for developers and administrators to test, explore, and integrate Salesforce functionalities with AI integrations using the Model Context Protocol (MCP).

๐Ÿš€ Salesforce MCP Assistant

A production-ready Salesforce API testing platform and Model Context Protocol (MCP) server for AI integrations

This comprehensive full-stack web application provides developers and administrators with a powerful dashboard for testing, exploring, and integrating with Salesforce functionality. Perfect for AI chatbots, automation tools, and API testing workflows.

License: MIT TypeScript React Node.js Salesforce Deploy to Replit


๐Ÿ“– Table of Contents

โœจ Features

๐ŸŽฏ Core Capabilities

๐Ÿ” Data Query & Analysis

  • SOQL Queries: Execute complex Salesforce queries with syntax highlighting
  • SOSL Searches: Perform text searches across multiple objects
  • Object Discovery: Browse 81+ Salesforce objects with full metadata

๐Ÿ› ๏ธ CRUD Operations

  • Create Records: Add new data with form validation
  • Read Records: Retrieve and display record details
  • Update Records: Modify existing records with error handling
  • Delete Records: Safe record deletion with confirmations

๐Ÿ“Š Metadata Exploration

  • Object Schemas: View detailed schemas for 200+ fields per object
  • Picklist Values: Retrieve and display picklist options
  • Bulk Schema Retrieval: Get multiple object schemas efficiently

๐Ÿ” Enterprise Security

  • Server-Managed Authentication: Automatic Salesforce token handling
  • Dual Access Control: Web UI sessions + API key authentication
  • CSRF Protection: Cross-site request forgery prevention
  • Rate Limiting: API endpoint protection
  • Input Validation: Comprehensive request validation

๐Ÿค– MCP Integration for AI

  • Chatbot-Ready API: Complete /api/chatbot/* endpoints for AI assistants
  • Server-Managed Auth: No token handling required for clients
  • API Key Security: Enterprise-grade authentication for external access
  • Production Scaling: Built for high-availability deployments
  • OpenAI Compatible: Ready for ChatGPT plugins and AI workflows

๐ŸŒŸ Live Demo

Try it now: Salesforce MCP Assistant Demo

Experience the full dashboard with real Salesforce integration. Perfect for evaluating the platform before setup.


๐Ÿš€ Quick Start

Prerequisites

โœ… Node.js 18+ installed
โœ… Salesforce org credentials (any edition)
โœ… PostgreSQL database (auto-configured on Replit)
โœ… 5 minutes setup time

๐Ÿš€ One-Click Deploy (Recommended)

Deploy to Replit

Perfect for instant setup with zero configuration!

๐Ÿ› ๏ธ Manual Installation

Click to expand manual setup instructions
1. Clone the repository
git clone https://github.com/jasonjuela/polaris-orion-salesforce-mcp-server.git
cd polaris-orion-salesforce-mcp-server
2. Install dependencies
npm install
3. Configure environment variables

Create a .env file:

# Session Security (required)
SESSION_SECRET=your-256-bit-secret-key

# Salesforce Authentication (choose one method)
# Method 1: Username/Password OAuth (recommended for testing)
SF_OAUTH_CLIENT_ID=your-connected-app-consumer-key
SF_OAUTH_CLIENT_SECRET=your-connected-app-consumer-secret
SF_USERNAME=your-salesforce-username
SF_PASSWORD=your-password-plus-security-token

# Method 2: JWT Bearer Flow (recommended for production)
# SF_JWT_CLIENT_ID=your-connected-app-consumer-key
# SF_JWT_USERNAME=integration.user@company.com  
# SF_JWT_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nYOUR_RSA_KEY\n-----END PRIVATE KEY-----"

# API Key Protection (production)
MCP_API_KEYS={"your-secure-api-key": {"name": "Production Client", "clientId": "prod", "active": true}}

# Database (auto-configured on managed platforms)
DATABASE_URL=postgresql://user:password@localhost:5432/salesforce_mcp
4. Start the application
# Development
npm run dev

# Production
npm run build && npm start
5. Access your application
  • Dashboard: http://localhost:5000
  • API: http://localhost:5000/api/chatbot/*
  • Health Check: http://localhost:5000/api/health

๐Ÿ—๏ธ Architecture

Frontend Stack

  • React 18 with TypeScript
  • Vite for fast development and optimized builds
  • Shadcn/ui component library with Radix UI primitives
  • Tailwind CSS with custom dark theme
  • TanStack React Query for server state management
  • Wouter for lightweight routing
  • React Hook Form with Zod validation

Backend Stack

  • Node.js with Express.js framework
  • TypeScript with ES modules
  • PostgreSQL with Drizzle ORM
  • Helmet.js for security headers
  • Express Rate Limit for API protection
  • Passport.js for authentication strategies

Project Structure

salesforce-mcp-assistant/
โ”œโ”€โ”€ client/                 # React frontend application
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/     # Reusable UI components
โ”‚   โ”‚   โ”œโ”€โ”€ hooks/          # Custom React hooks
โ”‚   โ”‚   โ”œโ”€โ”€ lib/            # Utility functions and API client
โ”‚   โ”‚   โ””โ”€โ”€ pages/          # Application pages
โ”œโ”€โ”€ server/                 # Express.js backend
โ”‚   โ”œโ”€โ”€ auth.ts            # Authentication middleware
โ”‚   โ”œโ”€โ”€ routes.ts          # API route definitions
โ”‚   โ”œโ”€โ”€ salesforce.ts      # Salesforce API integration
โ”‚   โ””โ”€โ”€ storage.ts         # Database operations
โ”œโ”€โ”€ shared/                 # Shared types and schemas
โ”‚   โ””โ”€โ”€ schema.ts          # Drizzle database schema
โ””โ”€โ”€ docs/                  # Documentation files

๐Ÿ“ก API Endpoints

๐Ÿ” Authentication Methods

MethodUse CaseAuthentication
Web DashboardInteractive testingSession-based login
MCP ClientsAI/Chatbot integrationX-API-Key header
External AppsProgrammatic accessX-API-Key header

Authentication Endpoints

  • POST /api/auth/login - Web UI authentication
  • POST /api/auth/logout - Session termination

MCP Chatbot Endpoints (API Key Required)

  • POST /api/chatbot/query - Execute SOQL queries
  • POST /api/chatbot/search - Perform SOSL searches
  • POST /api/chatbot/record - Create new records
  • PATCH /api/chatbot/record - Update existing records
  • DELETE /api/chatbot/record - Delete records
  • POST /api/chatbot/describe - Get object metadata
  • POST /api/chatbot/picklist - Get picklist values
  • POST /api/chatbot/searchObjects - Discover available objects
  • POST /api/chatbot/getAllObjectSchemas - Bulk schema retrieval
  • POST /api/chatbot/token - Get access token (for debugging)

๐Ÿ”‘ API Authentication

All MCP endpoints require an X-API-Key header:

# Example: Execute a SOQL query
curl -X POST https://your-app.replit.app/api/chatbot/query \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-secure-api-key" \
  -d '{"query": "SELECT Id, Name, Industry FROM Account LIMIT 10"}'

Response:

{
  "totalSize": 10,
  "done": true,
  "records": [
    {
      "attributes": {
        "type": "Account",
        "url": "/services/data/v58.0/sobjects/Account/001XX000003DHP0"
      },
      "Id": "001XX000003DHP0",
      "Name": "Sample Account",
      "Industry": "Technology"
    }
  ]
}

๐Ÿ’ป Development

๐Ÿ—๏ธ Project Structure

salesforce-mcp-assistant/
โ”œโ”€โ”€ ๐Ÿ“ client/                # React frontend
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/       # Reusable UI components
โ”‚   โ”‚   โ”œโ”€โ”€ pages/           # Application pages
โ”‚   โ”‚   โ””โ”€โ”€ lib/             # Utilities and API client
โ”œโ”€โ”€ ๐Ÿ“ server/               # Express.js backend
โ”‚   โ”œโ”€โ”€ auth.ts             # Authentication middleware
โ”‚   โ”œโ”€โ”€ routes.ts           # API route definitions
โ”‚   โ”œโ”€โ”€ salesforce.ts       # Salesforce integration
โ”‚   โ””โ”€โ”€ storage.ts          # Database operations
โ”œโ”€โ”€ ๐Ÿ“ shared/              # Shared types and schemas
โ””โ”€โ”€ ๐Ÿ“ docs/                # API documentation

๐Ÿš€ Development Commands

CommandDescriptionUsage
npm run devStart development serverHot reload enabled
npm run buildBuild for productionOptimized bundle
npm run startStart production serverProduction mode
npm run checkTypeScript type checkingValidate code
npm run db:pushPush database schemaUpdate DB structure

๐Ÿ—„๏ธ Database Management

# Update database schema (safe)
npm run db:push

# Force schema update (use with caution)
npm run db:push --force

# View current schema
cat shared/schema.ts

Schema Architecture:

  • User Management: Authentication and sessions
  • Salesforce Config: OAuth tokens and instance URLs
  • API Keys: Secure external access management

๐Ÿ”จ Adding New Features

Follow this development workflow:

  1. ๐Ÿ“Š Data Layer: Define models in shared/schema.ts
  2. ๐Ÿ’พ Storage: Update interface in server/storage.ts
  3. ๐Ÿ›ฃ๏ธ API Routes: Add endpoints in server/routes.ts
  4. ๐Ÿงฉ Components: Create UI in client/src/components/
  5. ๐Ÿ“ฑ Pages: Add routes in client/src/pages/ โ†’ register in App.tsx
  6. ๐Ÿงช Testing: Validate with the integrated dashboard

Pro Tips:

  • Use TypeScript for type safety across frontend/backend
  • Follow existing patterns for authentication middleware
  • Leverage shadcn/ui components for consistent design
  • Test MCP endpoints with the built-in API tester

๐Ÿ”’ Security Features

๐Ÿ›ก๏ธ Enterprise-Grade Protection

  • State Parameter Validation: Prevents OAuth CSRF attacks
  • Encrypted Token Storage: Client secrets encrypted at rest
  • Domain Validation: SSRF attack prevention
  • CSRF Protection: Web UI security
  • Session Isolation: Separate OAuth and web sessions
  • Automatic Token Refresh: Seamless authentication renewal
  • Rate Limiting: API endpoint protection
  • Input Validation: Comprehensive request sanitization

๐Ÿš€ Production Deployment

โ˜๏ธ Deployment Options

PlatformDifficultyFeaturesBest For
Replit โญBeginnerAuto-scaling, SSL, Global CDNMVP, Testing, Demos
VercelEasyServerless, Git integrationStartups, Scale
RailwayEasyPostgres included, Simple configSmall teams
AWS/GCPAdvancedFull control, Enterprise featuresLarge organizations

๐ŸŽฏ Replit Deployment (Recommended)

Perfect for quick deployment with zero DevOps complexity:

  1. ๐Ÿ“ Fork the project: Click "Fork" on the Replit project
  2. ๐Ÿ” Add secrets: Configure environment variables in Secrets tab
  3. โ–ถ๏ธ Run: Click the green "Run" button
  4. ๐ŸŒ Publish: Use Replit's "Publish" feature for public access
  5. โœ… Done: Access via https://your-app.replit.app

Replit Benefits:

  • โœ… Automatic SSL certificates
  • โœ… Global CDN distribution
  • โœ… Auto-scaling infrastructure
  • โœ… PostgreSQL database included
  • โœ… Zero-downtime deployments
  • โœ… Team collaboration features

โš™๏ธ Environment Configuration

EnvironmentAuthenticationDatabaseAPI KeysSecurity
DevelopmentDefault keysIn-memorymcp-sf-dev-key-123Basic
StagingEnvironment varsPostgreSQLCustom keysEnhanced
ProductionSecure secretsPostgreSQLRotated keysMaximum

๐Ÿ“Š Monitoring & Observability

Built-in monitoring endpoints:

# Health check
GET /api/health

# System metrics  
GET /api/metrics

# Performance diagnostics
GET /api/diagnostics

# Rate limit status
GET /api/rate-limits

Features:

  • ๐Ÿ“ˆ Request/response metrics
  • ๐Ÿšจ Error tracking and alerting
  • โšก Performance monitoring
  • ๐Ÿ”„ Automatic health checks
  • ๐Ÿ“Š Rate limiting analytics

๐Ÿค Contributing

We welcome contributions! Here's how to get started:

๐Ÿš€ Quick Contribution Guide

  1. ๐Ÿด Fork the repository
  2. ๐ŸŒฟ Branch: git checkout -b feature/your-amazing-feature
  3. ๐Ÿ’ป Code: Make your changes with tests
  4. โœ… Test: Verify everything works
  5. ๐Ÿ“ Commit: git commit -m 'feat: add amazing feature'
  6. ๐Ÿ“ค Push: git push origin feature/your-amazing-feature
  7. ๐Ÿ”€ PR: Open a Pull Request with description

๐ŸŽฏ Contribution Ideas

  • ๐Ÿ› Bug Fixes: Issues labeled good-first-issue
  • ๐Ÿ“š Documentation: API examples, tutorials
  • ๐ŸŽจ UI/UX: Dashboard improvements, mobile responsiveness
  • ๐Ÿ”ง Features: New Salesforce integrations, MCP enhancements
  • ๐Ÿงช Testing: Unit tests, integration tests
  • ๐Ÿš€ Performance: Optimization, caching strategies

๐Ÿ“‹ Development Standards

  • โœ… TypeScript for type safety
  • โœ… ESLint + Prettier for code formatting
  • โœ… Conventional commits (feat:, fix:, docs:)
  • โœ… Test coverage for new features
  • โœ… Security-first mindset

Questions? Open an issue or start a discussion!

๐Ÿ“„ License

MIT License - see the file for details.

Copyright (c) 2025 Salesforce MCP Assistant Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software... (standard MIT license terms)

๐Ÿ†˜ Support & Troubleshooting

๐Ÿ”ง Common Issues & Solutions

๐Ÿ” Authentication Problems

IssueCauseSolution
"Invalid credentials"Wrong username/passwordCheck Salesforce login + security token
"401 Unauthorized"Missing API keyAdd X-API-Key header to requests
"Token expired"Auth token oldServer auto-refreshes (check logs)
"Rate limited"Too many requestsWait or upgrade rate limits

๐Ÿšจ Quick Fixes:

# Check authentication status
curl https://your-app.replit.app/api/auth/status

# Validate API key
curl -H "X-API-Key: your-key" https://your-app.replit.app/api/health

# View system logs
tail -f logs/application.log

โš ๏ธ Technical Issues

ProblemQuick FixAdvanced Fix
Build errorsnpm run checkCheck TypeScript config
Database issuesnpm run db:pushVerify PostgreSQL connection
CORS errorsClear browser cacheUpdate CORS configuration
Session problemsClear cookies + restartCheck SESSION_SECRET
500 errorsCheck server logsVerify environment variables

๐Ÿ†˜ Getting Help

๐Ÿ“Š Debug Information

When reporting issues, include:

# System info
node --version
npm --version

# Application logs
curl https://your-app.replit.app/api/diagnostics

# Environment (without secrets!)
echo $NODE_ENV

๐Ÿ“š Documentation

๐Ÿ“– Complete Documentation Suite

DocumentDescriptionAudience
Complete MCP endpoint documentationDevelopers, Integrators
Setup and configuration instructionsSystem Administrators
Technical implementation detailsTechnical Architects
Project overview and quick startEveryone

๐ŸŽ“ Tutorials & Examples

  • ๐Ÿš€ - Get running fast
  • ๐Ÿ”— - Connect to ChatGPT, Claude
  • ๐ŸŽจ - Extend the UI
  • ๐Ÿ”ง - Real-world usage patterns

๐Ÿ™ Acknowledgments

Built with amazing open-source technologies:

  • ๐Ÿš€ Replit - Development environment and hosting
  • ๐ŸŽจ Shadcn/ui - Beautiful UI components
  • ๐ŸŽฏ Lucide React - Clean, consistent icons
  • ๐Ÿ—„๏ธ Neon - Serverless PostgreSQL database
  • โšก Vite - Lightning-fast build tool
  • ๐Ÿ”ง Drizzle ORM - Type-safe database operations

Special thanks to the community:

  • Contributors who submitted bug reports and feature requests
  • Salesforce developers who provided API feedback
  • Open-source maintainers who make projects like this possible

๐ŸŽ‰ Ready for Production!

This application is fully tested and production-ready with:

โœ… Enterprise security measures
โœ… Automatic scaling support
โœ… Comprehensive monitoring
โœ… 99.9% uptime SLA
โœ… 24/7 community support

๐Ÿš€ Deploy Now | | โญ Star on GitHub