Salesforce AI Agent MCP

Created By
Pratap Kumar Pattanayak3 months ago
A production-grade MCP server that gives Claude direct, structured access to Jira Cloud, Salesforce (Tooling + Metadata APIs), and n8n workflows. Built for autonomous Salesforce configuration — reads Jira stories, interprets requirements with Claude AI, and deploys metadata (custom fields, validation rules) directly into Salesforce. Reduces Salesforce field configuration from 20 minutes to under 60 seconds.
Overview

Salesforce AI Agent MCP Server

A production-grade Model Context Protocol (MCP) server that gives Claude direct, structured access to Jira Cloud, Salesforce (Tooling + Metadata APIs), and n8n workflows.

Built for the Salesforce Developer AI Agent project — an automation pipeline that reads Jira stories, interprets Salesforce configuration requirements, and deploys metadata (custom fields, validation rules, etc.) directly into Salesforce.


Architecture

Claude Desktop / Claude Code / VS Code
           │  (stdio or SSE)
  salesforce-ai-agent-mcp
  ┌───────────────────────────┐
  │  Tools (12 total)         │
  │  ├── Jira (4 tools)       │──► Jira Cloud REST API v3
  │  ├── Salesforce (6 tools) │──► Salesforce Tooling + Metadata APIs
  │  └── n8n (2 tools)        │──► n8n Webhook + REST API
  └───────────────────────────┘

Prerequisites

  • Node.js ≥ 18
  • npm ≥ 9
  • A Jira Cloud account with API token
  • A Salesforce org with a Connected App (OAuth 2.0)
  • An n8n instance (optional, for workflow orchestration)

Installation

cd salesforce-ai-agent-mcp
npm install
npm run build

Configuration

Copy .env.example to .env and fill in your credentials:

cp .env.example .env

Jira

VariableDescription
JIRA_BASE_URLe.g. https://your-org.atlassian.net
JIRA_EMAILYour Atlassian account email
JIRA_API_TOKENGenerate at Atlassian API Tokens

Salesforce

You need a Connected App with the Username-Password OAuth flow enabled.

  1. In Salesforce Setup → App Manager → New Connected App
  2. Enable OAuth settings
  3. Add scope: api, refresh_token
  4. Copy Consumer Key → SF_CLIENT_ID
  5. Copy Consumer Secret → SF_CLIENT_SECRET
VariableDescription
SF_LOGIN_URLhttps://login.salesforce.com (prod) or https://test.salesforce.com (sandbox)
SF_CLIENT_IDConnected App Consumer Key
SF_CLIENT_SECRETConnected App Consumer Secret
SF_USERNAMEYour Salesforce username
SF_PASSWORDYour Salesforce password
SF_SECURITY_TOKENReset at Setup → Personal Information → Reset Security Token
SF_API_VERSIONAPI version, e.g. v61.0 (default)

n8n

VariableDescription
N8N_BASE_URLYour n8n instance URL, e.g. https://your-n8n.com
N8N_API_KEYGenerate at n8n Settings → API → Create API Key

Usage

stdio mode (Claude Desktop / Claude Code / VS Code)

npm start
# or for development:
npm run dev

SSE mode (for remote/n8n integration)

npm run start:sse
# or for development:
npm run dev:sse

Endpoints available in SSE mode:

  • GET http://localhost:3000/sse — clients connect here
  • POST http://localhost:3000/messages?sessionId=<id> — clients send messages here
  • GET http://localhost:3000/health — liveness probe

Override the port:

MCP_PORT=8080 npm run start:sse

Connecting to Claude Desktop

Add the following to your claude_desktop_config.json:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "salesforce-ai-agent": {
      "command": "node",
      "args": ["/absolute/path/to/salesforce-ai-agent-mcp/dist/index.js"],
      "env": {
        "JIRA_BASE_URL": "https://your-org.atlassian.net",
        "JIRA_EMAIL": "you@company.com",
        "JIRA_API_TOKEN": "your_token",
        "SF_LOGIN_URL": "https://login.salesforce.com",
        "SF_CLIENT_ID": "your_client_id",
        "SF_CLIENT_SECRET": "your_client_secret",
        "SF_USERNAME": "you@yourorg.com",
        "SF_PASSWORD": "yourpassword",
        "SF_SECURITY_TOKEN": "yourSecurityToken",
        "N8N_BASE_URL": "https://your-n8n.com",
        "N8N_API_KEY": "your_n8n_api_key"
      }
    }
  }
}

Connecting to Claude Code (VS Code Extension)

Add to your VS Code settings.json (or via the MCP extension UI):

{
  "mcp.servers": {
    "salesforce-ai-agent": {
      "command": "node",
      "args": ["${workspaceFolder}/salesforce-ai-agent-mcp/dist/index.js"],
      "env": {
        "JIRA_BASE_URL": "https://your-org.atlassian.net",
        "JIRA_EMAIL": "you@company.com",
        "JIRA_API_TOKEN": "your_token",
        "SF_LOGIN_URL": "https://login.salesforce.com",
        "SF_CLIENT_ID": "your_client_id",
        "SF_CLIENT_SECRET": "your_client_secret",
        "SF_USERNAME": "you@yourorg.com",
        "SF_PASSWORD": "yourpassword",
        "SF_SECURITY_TOKEN": "yourSecurityToken",
        "N8N_BASE_URL": "https://your-n8n.com",
        "N8N_API_KEY": "your_n8n_api_key"
      }
    }
  }
}

Alternatively, the mcp.json file at the root of this project is compatible with VS Code's MCP extension and will be auto-detected if placed in your workspace root.


Available Tools (12 total)

Jira Tools

jira_get_story

Fetch a Jira story by issue key. Returns summary, description, acceptance criteria, status, labels, and all custom fields.

issueKey: "SFDC-123"

jira_update_story_status

Transition a Jira story to a new workflow status.

issueKey: "SFDC-123"
targetStatus: "In Progress"   # must match an available transition

jira_post_comment

Post a comment to a Jira story (used by the AI agent to report results or ask for clarification).

issueKey: "SFDC-123"
body: "Deployed Customer_Tier__c field to Account. Deployment ID: 0Af..."

jira_search_stories

JQL-based story search.

jql: "label = \"sf-config\" AND status = \"To Do\" AND project = SFDC"
maxResults: 25

Salesforce Tools

salesforce_get_object_fields

Describe all fields on a Salesforce object.

objectName: "Account"

salesforce_create_custom_field

Create a custom field via the Tooling API.

objectName: "Account"
fieldLabel: "Customer Tier"
fieldApiName: "Customer_Tier"     # __c added automatically
fieldType: "Picklist"
picklistValues: ["Platinum", "Gold", "Silver", "Bronze"]
description: "Tier classification for account segmentation"

Lookup field example:

objectName: "Case"
fieldLabel: "Related Contract"
fieldApiName: "Related_Contract"
fieldType: "Lookup"
referenceTo: "Contract"

salesforce_create_validation_rule

Create a validation rule via the Tooling API.

objectName: "Account"
ruleName: "Require_Phone_For_Hot_Leads"
errorConditionFormula: "AND(Rating = \"Hot\", ISBLANK(Phone))"
errorMessage: "Phone number is required for Hot-rated accounts"
errorDisplayField: "Phone"
active: true

salesforce_deploy_metadata

Trigger a metadata deployment from a base64-encoded ZIP.

zipFile: "<base64-encoded-zip>"
checkOnly: false
testLevel: "RunLocalTests"
rollbackOnError: true

salesforce_get_deployment_status

Poll a deployment's status.

deploymentId: "0AfXXXXXXXXXXXXX"

salesforce_query

Execute SOQL for validation and verification.

soql: "SELECT Id, Name, Customer_Tier__c FROM Account WHERE Rating = 'Hot' LIMIT 10"

n8n Tools

n8n_trigger_workflow

Trigger an n8n workflow via webhook URL.

webhookUrl: "https://your-n8n.com/webhook/abc123"
payload: {
  "issueKey": "SFDC-123",
  "environment": "sandbox",
  "triggeredBy": "claude"
}

n8n_get_execution_status

Check the status of an n8n execution.

executionId: "12345"

Example AI Agent Workflow

You: "Process Jira story SFDC-456 and deploy the Salesforce configuration"

Claude:
1. jira_get_story(issueKey: "SFDC-456")
   → reads requirements: "Add Customer_Tier picklist to Account"

2. salesforce_get_object_fields(objectName: "Account")
   → confirms Customer_Tier__c doesn't exist yet

3. salesforce_create_custom_field(
     objectName: "Account",
     fieldLabel: "Customer Tier",
     fieldApiName: "Customer_Tier",
     fieldType: "Picklist",
     picklistValues: ["Platinum", "Gold", "Silver"]
   )
   → creates the field

4. salesforce_query(soql: "SELECT QualifiedApiName FROM FieldDefinition WHERE EntityDefinition.QualifiedApiName = 'Account' AND QualifiedApiName = 'Customer_Tier__c'")
   → verifies the field was created

5. jira_post_comment(
     issueKey: "SFDC-456",
     body: "✅ Customer_Tier__c picklist field created on Account object with values: Platinum, Gold, Silver."
   )

6. jira_update_story_status(issueKey: "SFDC-456", targetStatus: "Done")

Logging

All logs are written as structured JSON to stderr so they never interfere with the MCP stdio transport.

Control the log level via environment variable:

LOG_LEVEL=debug npm start    # debug | info | warn | error

Development

# Type-check only
npm run typecheck

# Build
npm run build

# Dev with hot reload (stdio)
npm run dev

# Dev with hot reload (SSE)
npm run dev:sse

Project Structure

salesforce-ai-agent-mcp/
├── src/
│   ├── index.ts              # Entry point — stdio & SSE transport setup
│   ├── server.ts             # McpServer creation & tool registration
│   ├── tools/
│   │   ├── jira.ts           # Jira tool definitions (4 tools)
│   │   ├── salesforce.ts     # Salesforce tool definitions (6 tools)
│   │   └── n8n.ts            # n8n tool definitions (2 tools)
│   ├── clients/
│   │   ├── jiraClient.ts     # Jira REST API v3 client
│   │   ├── salesforceClient.ts  # Salesforce Tooling/Metadata API + OAuth
│   │   ├── n8nClient.ts      # n8n webhook + REST API client
│   │   └── logger.ts         # Structured JSON logger (stderr)
│   └── types/
│       └── index.ts          # Shared TypeScript types
├── .env.example              # All required environment variables
├── mcp.json                  # VS Code MCP extension manifest
├── package.json
├── tsconfig.json
└── README.md

Server Config

{
  "mcpServers": {
    "salesforce-ai-agent": {
      "command": "node",
      "args": [
        "/absolute/path/to/salesforce-ai-agent-mcp/dist/index.js"
      ],
      "env": {
        "JIRA_BASE_URL": "https://your-org.atlassian.net",
        "JIRA_EMAIL": "you@company.com",
        "JIRA_API_TOKEN": "your_token",
        "SF_LOGIN_URL": "https://login.salesforce.com",
        "SF_CLIENT_ID": "your_client_id",
        "SF_CLIENT_SECRET": "your_client_secret",
        "SF_USERNAME": "you@yourorg.com",
        "SF_PASSWORD": "yourpassword",
        "SF_SECURITY_TOKEN": "yourToken",
        "N8N_BASE_URL": "https://your-n8n.com",
        "N8N_API_KEY": "your_n8n_api_key"
      }
    }
  }
}
Project Info
Created At
3 months ago
Updated At
3 months ago
Author Name
Pratap Kumar Pattanayak
Star
-
Language
-
License
-
Category

Recommend Servers

View All
Thousand Api

2 hours ago
Hellogrowthcrm

18 hours ago
GovQL
@Alex Stout

# govql-mcp-server An MCP (Model Context Protocol) server for [GovQL](https://govql.us) — gives AI clients like Claude Desktop, Claude Code, and Cursor direct access to the US Congressional GraphQL API at [api.govql.us/graphql](https://api.govql.us/graphql) without bespoke HTTP wiring. For the design rationale (why FastMCP-Python, the passthrough+curated philosophy, roadmap through v0.4), see [design.md](https://github.com/govql/govql/blob/main/mcp-server/docs/design.md). ## What you can do with it Ask an agent questions like: - *"How did Vermont's two senators vote on the most recent nomination?"* - *"Which legislators in the 118th Congress switched parties during their service?"* - *"Compare Senator Sanders' voting record to Senator Murkowski's on cloture votes in the most recent Congress."* The agent picks the right tool, writes the GraphQL query against the live schema, and parses the response — no manual API wrangling. ## Install The server runs as a per-client subprocess over stdio. Pick your client: ### Claude Desktop Edit `claude_desktop_config.json` (Settings → Developer → Edit Config): ```json { "mcpServers": { "govql": { "command": "uvx", "args": ["govql-mcp-server"] } } } ``` Restart Claude Desktop. The `govql` tools appear in the tools panel. ### Claude Code Add to `.mcp.json` in your project (or `~/.mcp.json` for global): ```json { "mcpServers": { "govql": { "command": "uvx", "args": ["govql-mcp-server"] } } } ``` ### Cursor Settings → MCP → Add Server. Use the same `command` / `args` as above. ### Other clients Any MCP-compatible client that supports stdio servers will work. The command is `uvx govql-mcp-server` with no required arguments. ## Tools | Tool | Purpose | |---|---| | `execute_graphql` | Run any GraphQL query against the GovQL endpoint. Returns the result plus an `last_ingest` timestamp so the agent can reason about data freshness. | | `list_types` | Returns the names and kinds of every type in the GovQL schema. Optional `kind` filter (`"OBJECT"`, `"INPUT_OBJECT"`, `"ENUM"`, etc.) to narrow further. Start here when you don't know what's queryable. | | `describe_type` | Returns one type's full details — fields, arg signatures, input fields, enum values. Call after `list_types` to learn the shape of a specific type before writing a query. | ## Configuration All env vars are optional — the package is zero-config for end users. | Env var | Default | Purpose | |---|---|---| | `GOVQL_ENDPOINT` | `https://api.govql.us/graphql` | Endpoint to query. Override to point at a local dev stack. | | `GOVQL_TIMEOUT_MS` | `30000` | Per-request HTTP timeout. | | `LOG_LEVEL` | `INFO` | Logging level. Logs go to stderr only (stdout is reserved for the MCP transport). | ## Limits (enforced by the upstream API) - Max query depth: 10 - Max query complexity: ~10 billion points (`first: N` multiplies child cost by N — keep page sizes reasonable on deeply nested queries) - Rate limit: 100 requests / 60 s per source IP A depth or complexity violation surfaces as a GraphQL `errors` entry in the tool response so the agent can adjust and retry. ## Data freshness Every `execute_graphql` response includes a `last_ingest` ISO timestamp. Vote data refreshes hourly; legislator data refreshes daily. ## Status Version 0.1.0 ships three foundational tools: a GraphQL passthrough (`execute_graphql`) and two narrow schema-discovery tools (`list_types`, `describe_type`). Curated higher-level tools (`find_legislator`, `get_voting_record`, `compare_voters`, etc.) are planned for subsequent releases — see [design.md](https://github.com/govql/govql/blob/main/mcp-server/docs/design.md) for the roadmap. ## Links - [GovQL project site](https://govql.us) - [GraphQL API](https://api.govql.us/graphql) - [Source / issues](https://github.com/govql/govql)

a day ago