# Salesforce Analytics & SOQL MCP

> Salesforce Analytics & SOQL gives your AI client direct access to the raw data in your Salesforce environment. It lets you run complex queries (SOQL) against any object, check record counts across accounts or leads, and pull full datasets from saved reports and dashboards using natural language conversation.

## Overview
- **Category:** industry-titans
- **Price:** Free
- **Tags:** soql-query, crm-reporting, data-visualization, sales-performance, dashboard-analytics, data-querying

## Description

Need sales numbers but don't want to jump through three different menus? This MCP connects your AI client directly into the data layer of your Salesforce org. Instead of clicking around to find a dashboard component or running multiple separate queries, you just ask the question—like, "What was our win rate last quarter by industry?" 

Your agent handles the complexity. It runs the necessary queries against standard and custom objects, pulling back structured data whether you need an aggregate total, a detailed report list, or a simple record count. You can also discover available visualizations using tools like sf_list_dashboards before having your agent pull all component metrics with sf_get_dashboard. If you're managing sales operations, this access means instant answers without waiting for the BI team to build a dashboard. Connecting through Vinkius ensures that whether you use Claude or Cursor, you get one single entry point to everything in your CRM data.

## Tools

### sf_get_dashboard
Retrieves all component data—charts, metrics, and tables—from a specific Salesforce dashboard ID.

### sf_record_count
Returns the total number of records for any specified Salesforce object type like Account or Contact.

### sf_list_dashboards
Lists all available Salesforce dashboards, providing their title and ID so you know what visualizations exist.

### sf_list_reports
Provides a list of existing reports, showing their name, folder path, format, and last run date.

### sf_run_report
Executes a specific saved report by ID, returning its full dataset with all rows and columns for deep review.

### sf_run_soql
Runs any custom query against standard or custom objects, allowing you to select fields and apply filters across the entire CRM dataset.

## Prompt Examples

**Prompt:** 
```
What was our total revenue closed this quarter?
```

**Response:** 
```
💰 SELECT SUM(Amount) FROM Opportunity WHERE StageName = 'Closed Won' AND CloseDate = THIS_QUARTER

**$2,340,000** closed this quarter across 47 deals
```

**Prompt:** 
```
Show me all reports in the Sales folder
```

**Response:** 
```
📊 Found 8 reports in Sales:
1. Pipeline by Stage
2. Won Deals MTD
3. Lead Conversion Rate
...
```

**Prompt:** 
```
How many accounts do we have by industry?
```

**Response:** 
```
🏢 SELECT Industry, COUNT(Id) FROM Account GROUP BY Industry

| Industry | Count |
|---|---|
| Technology | 234 |
| Financial Services | 189 |
| Healthcare | 156 |
```

## Capabilities

### Calculate record volume
Quickly determine how many records exist for any object type, such as accounts, contacts, or leads.

### Build custom data reports
Execute raw SOQL queries to pull specific combinations of fields and objects that aren't available in standard reports.

### Extract dashboard metrics
Pull the underlying component data—charts, tables, and metrics—from a specified Salesforce dashboard ID.

### List reporting assets
Retrieve a list of all existing reports in your organization, including their format and last run date.

### Run specific saved reports
Execute established Salesforce reports to get full datasets, returning up to 2000 rows for deep analysis.

## Use Cases

### Determining quarterly revenue trends
The CFO needs to compare 'Closed Won' deals across four different product lines but no single dashboard shows that breakdown. They ask the agent, and it runs a custom query using sf_run_soql to group and sum the amounts exactly as requested.

### Auditing data completeness
The team lead needs to know if any accounts have zero associated contacts. They use sf_record_count to check the number of accounts, then run a specific query using sf_run_soql to find unmatched IDs.

### Reviewing old campaign performance
A marketer wants to see how leads from a specific 2023 campaign performed. They first use sf_list_reports to find the historical report ID, then execute it with sf_run_report to extract all raw data points.

### Quickly checking object health
A manager needs an immediate count of open cases across three regional teams. They don't want a full dashboard; they just ask the agent, and it runs sf_record_count for each specified custom object.

## Benefits

- Get immediate data volume checks. Instead of guessing how many leads you have, use sf_record_count to get an exact, current total for any object in seconds.
- Bypass standard reporting limits. With raw SOQL access (sf_run_soql), you write the exact query needed—combining objects and applying filters that no pre-built report can handle.
- Understand your existing metrics better. Use sf_list_dashboards first, then sf_get_dashboard to pull all component data from a specific visualization for detailed analysis.
- Never wait for a rerun. When you need fresh numbers, use sf_run_report after finding the report ID with sf_list_reports. It's like clicking 'Run Report' instantly.
- Simplify discovery. Need to know what reports exist? sf_list_reports gives you the full manifest of available reporting assets in one clean list.

## How It Works

The bottom line is: you get immediate access to precise CRM data without leaving the conversation with your AI client.

1. Ask your AI client a data question (e.g., "Show me all open opportunities over $50k").
2. The MCP translates that request into the correct Salesforce query, whether it’s running raw SOQL or executing an existing report.
3. Your agent receives structured results—a clean table of data points—which you can then use in your workflow.

## Frequently Asked Questions

**How does sf_run_soql work with multiple objects?**
sf_run_soql allows you to join related standard or custom objects (e.g., Account and Opportunity) in a single query, letting you select fields from both sources at once.

**Is sf_get_dashboard the same as running a report?**
No. A report (sf_run_report) provides raw data rows. sf_get_dashboard pulls specific metrics and component data that are already designed for visualization on a dashboard.

**What if I don't know the name of my custom object?**
You can use general prompts, but providing the API name helps. The MCP supports running queries against both standard and custom objects as long as you provide the correct object type.

**Do I need to run sf_list_reports before using sf_run_report?**
It's best practice. Use sf_list_reports first to confirm the exact report name and ID, which you then pass to sf_run_report for accurate execution.

**Can I just ask for a count without using sf_record_count?**
You can. However, sf_record_count is the dedicated tool designed specifically and reliably to return the total number of records for any object type quickly.