Salesforce + Pardot MCP Server
Provides tools for querying and reading Salesforce CRM data (SOQL SELECT queries, leads, contacts, tasks, events, activity history, pipeline reports by stage) and, when write tools are enabled, creating and updating leads and contacts. Also integrates Pardot (Marketing Cloud Account Engagement) API v5 for prospects, campaigns, lists, forms, form handlers, emails, visitor activities, and lifecycle history, with per-user OAuth 2.1 authentication against the user's own Salesforce org.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Salesforce + Pardot MCP Server
A remote Model Context Protocol (MCP) server providing Salesforce CRM and Pardot (Marketing Cloud Account Engagement) tools over SSE transport. Built with FastMCP, designed for deployment on Railway.
Users connect via MCP OAuth 2.1 — Claude Desktop handles authentication automatically with zero configuration.
Why This Exists
A GTM team lives in Salesforce and Pardot all day, but most questions — "show open pipeline by stage", "which prospects opened the last campaign email but never submitted a form", "what did this account do on the site last week" — still require dashboards, exports, or someone who writes SOQL. This server makes both systems directly queryable from any MCP client, in plain language.
Design decisions that shaped it:
Read-only by default. Write tools exist but are opt-in via an environment flag — a model can never mutate CRM data unless the operator explicitly allows it.
Multi-tenant by design. One deployment serves any number of users across any number of Salesforce orgs; each user's OAuth tokens are encrypted at rest and isolated per session.
Full MCP OAuth 2.1 Authorization Server in-repo. Dynamic Client Registration (RFC 7591), authorization server metadata (RFC 8414), protected resource metadata (RFC 9728), and PKCE S256 — no third-party auth service, no shared API keys, zero client-side configuration.
In production on Railway since January 2026 — before Salesforce shipped an official MCP server — serving a 20+ person GTM team and saving each user hours of manual CRM reporting every week.
Related MCP server: Salesforce-Hosted-Custom-Mcp-Server
How It Works
1. In Claude Desktop: Settings → Connectors → Add custom connector
2. Enter server URL: https://your-server.up.railway.app/sse
3. Claude Desktop opens a Salesforce login popup
4. User logs in → Done. All tools appear automatically.Claude Desktop handles token management (acquire, store, refresh) automatically via PKCE-secured OAuth. One Connected App on the server handles all users across all Salesforce organizations.
Example
A typical question and the tool calls it turns into (synthetic data):
User: which prospects opened last week's campaign email but never submitted a form?
→ pardot_get_emails # locate last week's send
→ pardot_get_visitor_activities(activity_type_name="email_open")
→ pardot_get_visitor_activities(activity_type_name="form_submit")
Answer: 34 prospects opened "Q3 Product Update" and never submitted a form.
Top 5 by score: ...No dashboard, no export, no SOQL — the model composes the tools on its own.
Available Tools (22 — writes are opt-in)
The server runs in read-only mode by default. Write tools (update/create) are only registered when ENABLE_WRITE_TOOLS=true is set.
Salesforce Tools (sf_*)
Tool | Mode | Description |
| read | Run arbitrary SOQL SELECT queries (read-only enforced) |
| read | Get leads with filters (status, creation recency, lead source) |
| read | Get contacts with filters (name, email, account ID) |
| write | Update lead fields (protected fields blocked) |
| write | Update contact fields (protected fields blocked) |
| write | Create a new lead (LastName + Company required) |
| read | Open opportunities aggregated by stage |
| read | Get tasks with filters (who/what ID, status, date range, subject) |
| read | Get events with filters (who/what ID, datetime range) |
| read | Combined tasks + events for a record, sorted by date |
Pardot Tools (pardot_*)
Tool | Mode | Description |
| read | Get prospects with filters (email, score, campaign) |
| read | Look up a single prospect by email address |
| write | Update prospect fields (protected fields blocked) |
| read | List all campaigns |
| read | List all lists |
| read | List all forms |
| write | Add a prospect to a list |
| read | Get visitor activities with type enrichment (label + category) and friendly name filtering ( |
| read | List all form handlers |
| read | List email templates and sends |
| read | Get lifecycle stage progression for a prospect |
| config | Set Pardot Business Unit ID for the current session |
config — mutates only the current session's settings, never Salesforce or Pardot data; always registered. write — mutates CRM data; registered only behind
ENABLE_WRITE_TOOLS=true.
Visitor Activity Types
pardot_get_visitor_activities supports filtering by friendly name (activity_type_name) or numeric code (activity_type):
Category | Names | Codes |
Web |
| 1, 2, 3, 4, 5, 7, 20, 21 |
| 6, 11, 12, 13, 14, 15, 16, 17 | |
Opportunity |
| 8, 9, 10, 18, 19, 38 |
Each returned activity is enriched with activityLabel and category fields.
Architecture
flowchart LR
CLIENT["MCP client<br/>(Claude Desktop, etc.)"]
subgraph SERVER["FastMCP server — Railway"]
AS["MCP OAuth 2.1<br/>Authorization Server<br/>(DCR + PKCE S256)"]
MW["Bearer auth middleware<br/>+ rate limiting"]
TOOLS["17 + 5 tools<br/>sf_* / pardot_*<br/>(write opt-in)"]
TS[("Token store<br/>Fernet-encrypted,<br/>per user")]
end
SF["Salesforce<br/>REST + SOQL"]
PD["Pardot API v5"]
CLIENT -- "1 · OAuth 2.1 flow" --> AS
AS -- "OAuth proxy:<br/>code exchange / refresh" --> SF
AS -- "2 · session token" --> CLIENT
AS --> TS
CLIENT -- "3 · SSE + Bearer" --> MW
MW --> TOOLS
TOOLS <--> TS
TOOLS --> SF
TOOLS --> PDThe Authorization Server acts as an OAuth proxy to Salesforce: it exchanges and refreshes tokens against Salesforce's own OAuth endpoints, then stores them per user. Each tool request resolves the session token to a user, decrypts that user's Salesforce tokens, and calls the underlying APIs with them — the server itself holds no org-wide credentials beyond the Connected App used for the OAuth handshake.
Security
Feature | Details |
Read-only by default | Write tools disabled unless |
Authentication | Bearer token — session tokens from MCP OAuth 2.1 flow |
MCP OAuth (PKCE S256) | Authorization code flow with mandatory PKCE, timing-safe verification |
Redirect URI validation | Only |
Session TTL | Session tokens expire after 24 hours (configurable via |
SKIP_AUTH restriction |
|
Rate limiting | 60 requests/minute per token (sliding window) |
DCR rate limiting | 10 requests/minute per IP for client registration |
Memory limits | Auth codes (500) and registered clients (200) capped to prevent DoS; refresh tokens expired after 2× session TTL |
Security headers | HSTS, X-Content-Type-Options, X-Frame-Options, CSP |
SOQL injection protection | User input escaped before inclusion in queries |
Read-only enforcement |
|
SF protected fields |
|
Pardot protected fields |
|
Pardot ID validation | Numeric-only validation on prospect/list IDs prevents path injection |
Error truncation | API error messages capped at 200 chars to prevent org data leaks |
Audit logging | SHA-256 key fingerprint logged per request |
Token encryption | Per-user OAuth tokens encrypted at rest with Fernet (AES-128-CBC + HMAC-SHA256 authenticated encryption) |
HMAC cache keys | Client cache uses HMAC-hashed keys to prevent raw token exposure in memory |
Instance URL validation | Only |
Input sanitization | Client names sanitized (control chars stripped, length limited) |
Header injection protection | Pardot Business Unit ID validated as alphanumeric before use in HTTP headers |
Prerequisites
Python 3.10+ (uses
str | Noneunion syntax)Salesforce Connected App with OAuth enabled
Creating a Connected App
In Salesforce: Setup → App Manager → New Connected App
Enable OAuth Settings
Set the callback URL to
https://your-server.up.railway.app/oauth/callbackAdd OAuth scopes:
api,refresh_token,pardot_apiSave and note the Consumer Key and Consumer Secret
Setup
Local Development
git clone https://github.com/DaniilMai/salesforce-pardot-mcp.git
cd salesforce-pardot-mcp
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# Edit .env with your Connected App credentials
python server.py
# → Listening on http://0.0.0.0:8000 (SSE)
# → Health check: http://localhost:8000/healthRailway Deployment
Push the repo to GitHub (or connect Railway to the repo directly)
Create a new Railway service from the repo
Set environment variables (see table below) as Railway service variables
Set health check path to
/healthDeploy
The included railway.toml and Dockerfile handle the rest.
# Or build and run manually:
docker build -t sf-mcp .
docker run -p 8000:8000 --env-file .env sf-mcpConnecting Claude Desktop
Open Claude Desktop: Settings → Connectors → Add custom connector
Enter URL:
https://your-server.up.railway.app/sseLeave OAuth Client ID/Secret empty (Dynamic Client Registration handles it)
Click Add → Salesforce login popup → Done
Environment Variables
Variable | Required | Description |
| Yes | Connected App consumer key |
| Yes | Connected App consumer secret |
| Yes | OAuth callback URL (e.g. |
| No | Salesforce login URL (default: |
| Yes | Fernet key for token encryption (see below) |
| No | Server port (default: |
| No | Set to |
| No | Session token lifetime in seconds (default: |
| No | Dev only: bypass auth in local stdio mode. Ignored on remote SSE transport |
Generate an encryption key:
python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"See .env.example for a full template with comments.
Running Tests
Unit and OAuth suites (170 tests) run in CI on every push to main and every pull request — see the badge above. Integration tests start a real server subprocess and are meant to be run locally.
# Unit tests (no Salesforce connection needed)
python -m pytest tests/test_security.py -v
# MCP OAuth tests (PKCE, token exchange, security hardening)
python -m pytest tests/test_mcp_oauth.py -v
# Integration tests (starts server subprocess)
python -m pytest tests/test_integration.py -v
# All tests via Docker
docker build -f Dockerfile.test -t sf-pardot-mcp-tests .
docker run --rm sf-pardot-mcp-testsProject Structure
server.py # Entry point — FastMCP + SSE + health + OAuth routes + security headers
auth.py # Bearer token middleware (session tokens from MCP OAuth)
user_context.py # ContextVar for per-request user identity
token_store.py # Fernet-encrypted per-user OAuth token storage (HMAC-keyed)
oauth.py # Shared OAuth utilities (SF config, instance URL validation, BUID detection)
mcp_oauth.py # MCP OAuth 2.1 Authorization Server (RFC 9728, RFC 8414, RFC 7591)
tools/
__init__.py # Re-exports ALL_TOOLS list (17 read + 5 write, write opt-in)
salesforce.py # 10 Salesforce tools (SOQL, CRUD, pipeline, activities)
pardot.py # 12 Pardot tools (prospects, campaigns, activities, emails, config)
tests/
test_security.py # Unit tests — SOQL injection, field protection, auth, rate limiting, activity types
test_mcp_oauth.py # MCP OAuth tests — PKCE, token exchange, DCR, redirect validation
test_integration.py # Integration tests — server startup, health, SSE
Dockerfile # Production container
Dockerfile.test # Test runner container
railway.toml # Railway deployment config
requirements.txt # Python dependencies
.env.example # Environment variable templateLimitations
OAuth session state is in-memory. Session tokens, pending auth codes, and DCR-registered clients live in process memory: a redeploy logs users out, and reconnecting is one OAuth click. Per-user Salesforce tokens do survive restarts — they persist in a Fernet-encrypted file on disk.
Deliberately single-instance. In-memory session state means no horizontal scaling; a Redis-backed store is in progress on the
feature/redis-token-refreshbranch.API limits are your org's limits. The server adds its own rate limiting (60 req/min per token) but Salesforce/Pardot daily API quotas belong to the operator's org.
License
MIT — see LICENSE for details.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Read native sales pipelines, customer-learning records and recorded sales evidence in your connected workspace. Native pipeline and learning reads use Contacts read (crm:read). Recorded costs and outcomes also require Operations read and Accounting read; communication-source readouts require Communications read. The separate Sales read (sales:read) permission covers eligible legacy chauffeur inquiry and offer adapters and is not required for the native pipeline. Setup: In a remote MCP client supporting Streamable HTTP and OAuth, add https://platform.samuelz.com/api/v1/mcp/operator?toolset=sales. Sign in and select your authorized workspace. For read-only review, select only the read permissions needed for the tools above. Current membership and module permissions are checked on every call. Write tools require separate authorization and retain their native approval rules. Reading never sends messages, books services or collects payments.
CRM1Unified MCP Server is a remote MCP connector for AI agents and vertical AI products that provides access to 22,000+ authorized SaaS tools across 400+ integrations and 24 categories directly inside LLMs (Claude, GPT, Gemini, Cohere). Tools operate only on explicitly authorized customer connections, enabling agents to safely read and write against live third-party systems.
Connect your ads, shop, analytics, social, CRM and finance platforms once, then let Claude, ChatGPT, Cursor or any MCP client read, join and explain your numbers. Public statistics from the World Bank, IMF, Eurostat, OECD, WHO and SEC filings come as context, searchable and chartable from the same tools. Read-only by design, every number carries its source.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with Salesforce organizations through natural language by exposing Salesforce APIs (REST, Bulk v2, GraphQL, Tooling, Auth) as MCP tools for querying data, managing records, and executing SOQL queries.19MIT
- FlicenseNot gradedqualityDmaintenanceEnables interaction with Salesforce data and services via custom MCP tools, including account analytics, opportunity queries, case creation, and AI agent invocation.4-
- AlicenseAqualityDmaintenanceEnables AI agents to interact with Salesforce through MCP, supporting queries, records, metadata, and bulk operations with flexible OAuth authentication.16MIT
- FlicenseNot gradedqualityDmaintenanceExposes Salesforce as tools for MCP clients, allowing AI to run SOQL queries, describe objects, create contacts, and check org limits directly from natural language, with least-privilege guardrails.-