# sfmc-mcp-server [Health: Active]

**Category:** 🎯 Marketing  
**Repository:** https://github.com/Inefavel/sfmc-mcp-server  
**GitHub Stars:** 0  
**npm Downloads (last month):** 108  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/sfmc-mcp-server

## Description
MCP Server para Salesforce Marketing Cloud: valida queries do Automation Studio antes de rodar.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "sfmc-mcp-server": {
    "command": "npx",
    "args": ["-y","sfmc-mcp-server"],
    "env": {
      "SFMC_SUBDOMAIN": "",
      "SFMC_CLIENT_ID": "",
      "SFMC_CLIENT_SECRET": ""
    }
  }
}
```

**Requires environment variables:** `SFMC_SUBDOMAIN`, `SFMC_CLIENT_ID`, `SFMC_CLIENT_SECRET` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What the sfmc-mcp-server MCP server does

The sfmc-mcp-server MCP server exposes Salesforce Marketing Cloud data and schema operations to an MCP client. Its primary use is reviewing Automation Studio Query Activities before they run, reducing errors caused by unsupported SQL syntax or mismatches with Data Extension schemas.

It provides three tools:

- `validate_sql` checks a query against known Automation Studio restrictions and the available Data Extensions and columns. It can identify unsupported constructs, missing tables or fields, undeclared aliases, incompatible output columns, and a destination primary key missing from the query result.
- `list_data_extensions` returns Data Extension metadata, supports name filtering and pagination, and can return a complete schema.
- `query_data_extension` retrieves records with filtering, ordering, and pagination.

Validation can flag constructs such as top-level `ORDER BY`, CTEs, DML and DDL, variables, temporary tables, cursors, stored procedures, `FULL OUTER JOIN`, unbalanced parentheses, risky `SELECT *`, and `GETDATE()` usage. Missing column suggestions may be generated from edit distance.

## How it works

The process runs as a stdio MCP server. Salesforce authentication uses the OAuth client-credentials flow. Access tokens are cached with a 60-second expiry margin, and authentication is deferred until the first tool request, allowing the process to start before credentials are checked.

Requests use Salesforce Marketing Cloud REST APIs. The client applies exponential retry behavior for HTTP 429 and 5xx responses. Data Extension queries are paginated and capped at 50 rows per page to limit the amount of data returned to the model.

The server is read-only by default. Tool calls are written to stderr with a timestamp and arguments for audit logging, while retrieved Salesforce data is not persisted by the server.

## Setup and configuration

Install and launch the sfmc-mcp-server MCP server with `npx sfmc-mcp-server`, or install the package globally with `npm install -g sfmc-mcp-server`. Create a Salesforce Marketing Cloud Installed Package with a server-to-server API Integration. The documented minimum permissions are read access to Data Extensions and Automations.

Set `SFMC_SUBDOMAIN`, `SFMC_CLIENT_ID`, and `SFMC_CLIENT_SECRET` in the MCP client's environment configuration. `SFMC_MODE=read` is the default and can be set explicitly. For multiple Business Units, define separate MCP entries and provide the relevant `SFMC_ACCOUNT_ID` (MID) for each one.

Restart the client after changing its configuration.

## Limitations and notes

SQL validation covers known Automation Studio restrictions and schema existence, but it does not prove that a query is logically correct or performant. Shared Data Extensions referenced with `ENT.` are not checked against schema because they belong to the Parent BU and are outside the current Business Unit's REST scope.

In queries containing multiple joins, unqualified columns without an `alias.` prefix are not validated. The endpoint used for Data Extension access may also require a SOAP fallback on older Salesforce Marketing Cloud releases.

Planned capabilities include automation status, journeys, send statistics, row upserts, and Parent BU shared Data Extension support.

_Full upstream README: https://allmcps.com/mcp/sfmc-mcp-server/readme_

