Chapter 3 of 10
Connect your agent to your CRM
Your AI agent reaches your CRM through MCP, an open standard for connecting assistants to other programs. This chapter explains it in plain words, shows the settings for each common client, and covers tokens and roles.
MCP in plain words
The Model Context Protocol, or MCP, is a standard way for an AI assistant to use another program. The program, here your CRM, offers a list of tools, such as search_records or create_record. The assistant reads the list and picks a tool, and the CRM runs it and sends back the result.
Three things make it work. The CRM needs an MCP server with an address, the agent needs a token that says which CRM user it is, and you need a client that speaks MCP, such as Claude Code, Codex or Cursor.
Some apps get the token by sign-in instead. In Claude or ChatGPT you add a custom connector with the CRM’s address, sign in to the CRM in your browser and approve. The app then keeps a token that expires and renews itself, so there is nothing to copy. This works when the CRM supports it, as mcpcrm Team does.
The CRM still decides what is allowed. If the agent’s user may not delete records, a delete fails, whatever the agent was asked to do.
Where your CRM’s MCP server comes from
Your CRM has its own MCP server
Several hosted CRMs, such as HubSpot, offer an MCP server or an AI connector, and Odoo 20 includes one. Follow its setup page, then use the rest of this guide for roles, rules and routines.
A gateway adds one
For vtiger, mcpcrm Connect adds an MCP server through a plugin in your CRM, and your agent signs in as a CRM user. vtiger is supported, and SuiteCRM and Odoo 16 to 19 are planned.
The CRM is built for agents
mcpcrm Solo and mcpcrm Team give each agent its own token and a role in each workspace, and show you every call it makes.
Settings for each client
These examples use an address from mcpcrm Solo. For mcpcrm Team, use your server’s own address, such as https://crm.yourcompany.com/mcp. For another CRM, use the address and token from its own setup page. Replace the example token with your agent’s token.
Claude Code
The Agents page in the app shows this command with your address and your agent’s token.
claude mcp add --scope user --transport http mcpcrm https://relay.mcpcrm.app/m/your-connection-id/mcp \
--header "Authorization: Bearer mcpcrm_your_agent_token"Codex
Codex reads the token from an environment variable, so the token stays out of its settings file.
# In your shell profile, such as ~/.bashrc or ~/.zshrc
export MCPCRM_TOKEN=mcpcrm_your_agent_token
# Then, once
codex mcp add mcpcrm --url https://relay.mcpcrm.app/m/your-connection-id/mcp --bearer-token-env-var MCPCRM_TOKENCursor and other clients that accept a URL
Use your address from the Agents page.
{
"mcpServers": {
"mcpcrm": {
"url": "https://relay.mcpcrm.app/m/your-connection-id/mcp",
"headers": { "Authorization": "Bearer mcpcrm_your_agent_token" }
}
}
}Claude Desktop with a token
Through the mcp-remote bridge, which needs Node.js. The token goes in env, which also works on Windows. With mcpcrm Team, sign-in is simpler.
{
"mcpServers": {
"mcpcrm": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://relay.mcpcrm.app/m/your-connection-id/mcp", "--header", "Authorization:${AUTH}"],
"env": { "AUTH": "Bearer mcpcrm_your_agent_token" }
}
}
}Claude and ChatGPT with sign-in (mcpcrm Team)
Add a custom connector with your server’s address. You sign in to mcpcrm and choose the agent’s workspaces and role, so there is no token to copy. This works in Claude on desktop, web and phone. For mcpcrm Solo it is planned.
https://crm.yourcompany.com/mcpAfter you add the server, start a new session in your client so that it loads the tools. In Claude Code, the /mcp command shows whether the server is connected.
Look after the token
- A token works like a password for the agent. Anyone who has it can act as that agent.
- Create one token for each agent on each computer, so that you can revoke one without stopping the others.
- Keep tokens out of chats, shared documents and code repositories. Codex reads the token from an environment variable, and Claude Code keeps it in your user settings.
- Give each agent a name you will recognise later, such as “Claude Code on the office laptop”.
- Revoke a token as soon as a computer is lost or a person leaves.
Choose a role for each agent
An agent should be a CRM user of its own, with its own role, and never use an administrator’s or a shared login. Start with the smallest role that does the job. You can give it more later.
| Role | What it can do | Use it for |
|---|---|---|
| Admin | Reads, creates, changes and deletes records in the workspace. It can also add fields and import records. | Your own agent while you set up a workspace and import data. |
| Member | Reads, creates and changes records. It cannot delete. | Day-to-day work, such as logging, follow-ups and clean-up. |
| Contributor | Reads everything, adds records only in the modules you allow, changes only the records it added, and never deletes. | Agents from outside tools, such as a website chat, a form handler or another team’s assistant. |
| Viewer | Reads records and changes nothing. | Reports and questions about your data. |
The contributor role suits agents you do not watch closely. By default a contributor in mcpcrm can add Comments, Tasks and Leads, and the workspace’s owners can change that list. The safety chapter covers it in more detail.
A worked example: two agents in one studio
The owner creates the agent
A design studio’s owner opens Agents in mcpcrm, chooses New agent, names it “Codex on the studio laptop” and gives it the member role in the studio’s workspace. The token is shown once, so she copies it straight into her shell profile.
She adds the server to Codex
She runs the
codex mcp addcommand from the settings below, with her own address. Codex reads the token from theMCPCRM_TOKENvariable.The agent checks its access
She asks the agent what it can do. It calls
list_workspacesandwhoamiand answers that it is the member agent in one workspace, can create and change records, and cannot delete.A second agent for the website
Later she connects the chat on the studio’s website as a contributor. With the default settings it can add Leads, Tasks and Comments, and it cannot change or delete anything a person or another agent created.
Check the connection
Before an agent changes anything, ask it what it can do. It should name its CRM user, its role and its tools. If the answer looks wrong, fix the role before you start.
Check what you can do
Before we start, call list_workspaces if you have it, then whoami. Tell me which workspaces you can use, which CRM user you are, and what your role lets you read, create, change and delete in each module. Change nothing yet.Learn the fields
Call describe_module for Leads, Contacts, Organisations and Opportunities. Summarise the required fields, the picklist values for lead status, lead source and sales stage, and any custom fields. Use only these fields and values from now on.Read the rules first
Read the rules for this workspace and the CRM manual you were given when you connected. Tell me in five lines what you must never do here, and ask me about anything that is unclear before you change a record.