# SugarCRM MCP

> SugarCRM provides an MCP Server that lets your AI agent talk directly to your enterprise CRM instance. It gives you ten tools—from listing specific accounts to running bulk updates across modules. Manage customer records, track relationships, and pull account history without ever leaving your chat interface.

## Overview
- **Category:** sales-automation
- **Price:** Free
- **Tags:** crm, customer-success, enterprise-sales, record-management, sugarcrm

## Description

You connect your AI agent straight into your SugarCRM instance, giving it full read and write access across all modules. This server exposes ten tools that let you manage every piece of customer data using natural language commands.

To pull a focused list of accounts or contacts, use `list_records`. You can apply complex JSON filters to narrow down the results, so your agent only pulls exactly what you need from any module. If you just want the details for one specific record ID, `get_record` grabs all that data instantly. For quick reporting metrics, you'll use `count_records`; it tells you immediately how many records match a set of criteria.

When you need to map out client relationships, `list_related_records` finds and lists every existing record connected to one specific ID. You can establish new connections by calling `link_record`, or if the relationship is wrong, `unlink_record` removes the link while keeping both data points intact.

Changing records is straightforward. To add a brand-new entry into any designated module, you use `create_record`. If an existing record needs tweaks—say, updating a phone number or changing a status—`update_record` lets your agent change specific fields using the record's ID. You can permanently wipe data by running `delete_record`, which removes that identified SugarCRM record from the system.

When you gotta make big changes across multiple entries, don’t bother with ten separate calls; use `bulk_request`. This tool sends multiple API calls at once, letting your agent process dozens of records in a single operation. To wrap up all this functionality, remember that you can also pull targeted lists using the foundational `list_records` and run counts to verify how many items match those filters.

## Tools

### bulk_request
Sends multiple API calls at once, letting you process many records in a single operation.

### count_records
Counts how many records match a specific filter inside any CRM module.

### create_record
Adds a brand new record into any designated SugarCRM module.

### delete_record
Permanently removes a specific, identified SugarCRM record from the system.

### get_record
Pulls all data for one single, known SugarCRM record ID.

### link_record
Establishes a relationship between two existing records in the CRM.

### list_records
Retrieves a list of filtered records from any module, supporting complex JSON query filters.

### list_related_records
Finds and lists all records connected to a specific existing record ID.

### unlink_record
Removes an established relationship link between two records, keeping the data intact.

### update_record
Changes specific fields on an existing SugarCRM record using its ID.

## Prompt Examples

**Prompt:** 
```
List the first 5 accounts from SugarCRM.
```

**Response:** 
```
I've retrieved the first 5 accounts. They include 'Nelson Inc', 'Global Tech', and 'Apex Corp'. Would you like to see the details for any of these?
```

**Prompt:** 
```
Count how many Leads we have in the system.
```

**Response:** 
```
There are currently 1,250 leads recorded in your SugarCRM instance.
```

**Prompt:** 
```
Show me all contacts related to Account ID 'acc_123'.
```

**Response:** 
```
I've found 3 contacts related to that account: John Doe, Jane Smith, and Robert Brown. Do you need the contact info for any of them?
```

## Capabilities

### View and Filter Customer Data
Use list_records to pull targeted lists of accounts or contacts by applying complex JSON filters.

### Manage Single Records
Retrieve details for one specific record using get_record, or modify its data with update_record and delete_record.

### Create & Update Data Sets
Generate new records in any module via create_record, or execute massive changes across multiple entries using bulk_request.

### Map and Break Relationships
Understand the full client picture by listing related records with list_related_records, or clean up data by calling unlink_record.

### Run Data Counts
Determine how many records match specific criteria instantly using count_records for quick reporting metrics.

## Use Cases

### The Account Audit
A CSM needs to understand why a client's billing address changed. They ask their agent to 'Show me all records related to Account ID X.' The agent uses `list_related_records` and pulls the account history, showing the exact change date and user.

### Lead Status Blitz
An SDR finishes a big outreach day. Instead of logging into SugarCRM for 50 leads, they prompt: 'Update all these 50 IDs to Stage 3.' The agent runs `bulk_request` and updates every status in seconds.

### Data Integrity Check
A data analyst suspects some contacts are incorrectly linked. They ask the agent to 'Check for unlinked accounts with more than five contacts.' The agent uses a combination of `list_records` and `count_records` to flag potential data problems.

### Mass Deletion Cleanup
An admin needs to clear out all test records from a specific module. They prompt: 'Delete all records in the Test Leads module.' The agent executes `delete_record` safely, keeping the main data clean.

## Benefits

- Stop manual data lookups. Use `list_related_records` to instantly pull every contact or account touchpoint tied to a single client ID in one request.
- Handle large-scale cleanups fast. The `bulk_request` tool lets you update status fields across hundreds of leads simultaneously, bypassing tedious individual calls.
- Get immediate metrics without running reports. Just ask the agent to count records using `count_records`, and it gives you the exact number right now.
- Keep your work in context. Instead of logging into SugarCRM, use the agent's ability to run `get_record` and get the data straight into your chat window.
- Maintain clean data relationships. Use `link_record` or `unlink_record` directly via prompts, ensuring your CRM structure is accurate without needing manual admin intervention.

## How It Works

The bottom line is you use natural language prompts; the server does the heavy API lifting.

1. First, subscribe to the server and plug in your SugarCRM Instance URL, Username, and Password.
2. Next, tell your AI agent exactly what you need. For example: 'List all accounts associated with John Doe.'
3. The agent translates that into a specific tool call (e.g., `list_related_records`), runs it against your CRM data, and sends the results back to your chat.

## Frequently Asked Questions

**How do I get a list of accounts using the list_records tool?**
You prompt the agent to use `list_records` and specify the module ('Accounts') along with your required JSON filters. The system runs it, returning the records that match your criteria.

**Can I update many leads at once using bulk_request?**
Yes. You gather all the IDs and the field changes you want to make, then send a single prompt asking the agent to run `bulk_request`. This is far faster than individual updates.

**What is the difference between get_record and list_records?**
`get_record` requires one specific ID and returns only that record's data. `list_records` allows you to query a set of records using filters, giving you multiple results.

**How do I establish a link between two accounts? Do I use link_record?**
You tell the agent to use `link_record`. You just need to provide the IDs for both existing records, and it handles creating the necessary relationship in SugarCRM.

**How do I use advanced filters when calling list_records?**
You must pass complex filtering criteria using a JSON object in the parameters. This allows you to query specific data points, like finding all Accounts owned by a certain user or created within a date range, far beyond simple module listing.

**What happens if I try to use link_record with an invalid Account ID?**
The API will return an error stating that the provided record ID does not exist. You must verify both the source and target IDs before running a link request; otherwise, the operation fails.

**Is it better to use bulk_request or multiple individual updates with update_record?**
Always use bulk_request when performing several similar actions. It drastically reduces API overhead and speeds up processing time by grouping those calls into a single, efficient transaction.

**If I delete_record, does it affect related records that were linked via link_record?**
The system handles deletion based on your instance's configured rules. Generally, deleting a core record might break associated links; always check the resulting data to confirm referential integrity before running delete operations.

**Can I filter records by specific criteria like account name?**
Yes! Use the `list_records` tool with a JSON filter string. For example, you can pass `[{"name": "Nelson Inc"}]` to find specific accounts matching that name.

**How do I see all opportunities linked to a specific account?**
Use the `list_related_records` tool by providing the primary module (Accounts), the record ID, and the link name (e.g., 'opportunities').

**Is it possible to get a total count of records in a module?**
Absolutely. The `count_records` tool allows you to retrieve the total number of records in any module, optionally filtered by specific conditions.