> ## Documentation Index
> Fetch the complete documentation index at: https://developers.hubspot.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

---
id: eaf7c585-dae1-4565-bf75-ef5057db7657
---

# Ways to work with agents in HubSpot

> Learn how to work in HubSpot from Claude, ChatGPT, Gemini, and other agent tools.

You can work in HubSpot from the agent tools you already use, such as Claude, ChatGPT, and Codex. Agents reach HubSpot through the remote MCP server (a standard way for AI tools to connect to HubSpot, which powers HubSpot's connectors) or the Agent CLI (a command-line tool that agents run in a terminal, currently in beta). The two overlap but aren't interchangeable. If you have a use-case or custom integration in mind that's not currently supported by either of these two features, you can use HubSpot's REST APIs.

Below, learn more about each method, how to choose between them, and what to keep in mind when setting up and using them. For a full breakdown of what each one covers, see the [capability reference](https://developers.hubspot.com/docs/getting-started/work-with-agents/capabilities.md).

To set up and use a HubSpot-provided connector, visit HubSpot's Knowledge Base:

* [Get started with HubSpot AI connectors and Agent CLI](https://knowledge.hubspot.com/integrations/get-started-with-hubspot-ai-connectors-and-agent-cli)
* [Frequently Asked Questions | AI connectors](https://knowledge.hubspot.com/integrations/frequently-asked-questions-ai-connectors)

## The three methods

| | [Remote MCP server](https://developers.hubspot.com/docs/apps/developer-platform/build-apps/integrate-with-the-remote-hubspot-mcp-server.md) | [Agent CLI (BETA)](https://developers.hubspot.com/docs/developer-tooling/local-development/agent-cli/guide.md) | [REST API](https://developers.hubspot.com/docs/api-reference/latest/overview.md) |
| - | - | - | - |
| **What it is** | A HubSpot-hosted service that AI tools connect to by signing in to HubSpot with OAuth. | A command-line tool that agents run in a terminal. | Secure HTTP endpoints for managing HubSpot data and assets, called by code you or your agent write. |
| **Where it's used** | AI clients that support remote MCP connectors, such as Claude, ChatGPT, and Gemini. [Available tools](https://developers.hubspot.com/docs/apps/developer-platform/build-apps/remote-mcp-server-tools.md) vary by connector. | Terminal and agent workspaces such as Claude Code, Claude Cowork, and Codex. | Anywhere you run code, such as your own integrations, scripts, and agents. |
| **Setup** | Connect a [HubSpot-provided connector](https://www.hubspot.com/ai-tools) or [create a custom connector](https://developers.hubspot.com/docs/apps/developer-platform/build-apps/create-a-custom-mcp-connector.md). | [Install and authenticate the CLI](https://developers.hubspot.com/docs/developer-tooling/local-development/agent-cli/guide.md) on each computer or agent workspace. | [Create an app](https://developers.hubspot.com/docs/apps/developer-platform/build-apps/create-an-app.md) or [service key](https://developers.hubspot.com/docs/apps/developer-platform/build-apps/authentication/account-service-keys.md) and manage credentials. |
| **How changes are confirmed** | By default, the agent shows the proposed changes and asks you to approve them before it runs. The prompt depends on the client. | Every write command supports `--dry-run` to preview a change. Destructive commands also require a digest from a prior dry run and a matching `--confirm` value before they apply. | No built-in confirmation. Add your own review or approval step before write requests run. |
| **Coverage** | CRM records, activities, properties, pipelines, segments, conversations, marketing emails, campaigns, social, AEO, CMS pages and blog posts, and more. See the [capability reference](https://developers.hubspot.com/docs/getting-started/work-with-agents/capabilities.md). | CRM records, schemas, pipelines, properties, associations, imports, reports, workflows, sequences, conversations, HubSpot Work, and more. See the [capability reference](https://developers.hubspot.com/docs/getting-started/work-with-agents/capabilities.md). | Most areas of HubSpot, including some the other two don't cover. See the [capability reference](https://developers.hubspot.com/docs/getting-started/work-with-agents/capabilities.md). |
| **Best suited for** | Open-ended questions and analysis in conversation, followed by targeted changes you review and approve. | Bulk operations and scripts that an agent runs, with a preview before changes apply. | Production integrations and custom apps with predictable, code-defined behavior. |

## Choose a method

For many use cases, HubSpot recommends starting with [HubSpot's built-in connectors](https://knowledge.hubspot.com/integrations/get-started-with-hubspot-ai-connectors-and-agent-cli), which use the remote MCP server behind the scenes without any additional code or terminal access.

If you need more than a connector offers, use the questions below to find the right method.

Need help deciding? Ask your agent to review this documentation and recommend a method.

Help me decide how to work in HubSpot from my agent. The options are HubSpot's built-in connectors (which use the remote MCP server), a custom remote MCP connector, the Agent CLI, a combination, or the REST API. Start with the built-in connectors unless my tasks or environment rule them out. Start by reading these pages so you understand the options before looking at my setup:

* [https://developers.hubspot.com/docs/getting-started/work-with-agents/ways-to-work-with-agents.md](https://developers.hubspot.com/docs/getting-started/work-with-agents/ways-to-work-with-agents.md)
* [https://developers.hubspot.com/docs/getting-started/work-with-agents/capabilities.md](https://developers.hubspot.com/docs/getting-started/work-with-agents/capabilities.md)

If you can't read those pages, tell me and ask me to paste their contents instead of guessing.

Then work out what is technically possible in your current environment. Check which HubSpot tools or connectors you have (for example, a built-in HubSpot connector or a custom remote MCP connector), whether you can run terminal commands, and whether the Agent CLI is installed and signed in. Compare the HubSpot tools you actually have against the capability reference rather than assuming they match. Only read and report. Don't change anything in my HubSpot account or on my computer, and don't ask me to paste credentials or tokens. If you can't tell what you have access to, say so and ask me.

Next, ask me these questions one at a time, and wait for my answers before moving on. Offer to go into more detail on specific tasks.

1. What am I trying to accomplish with HubSpot?
2. Which client does my team use?
3. How broad are the changes I typically make: questions and analysis, a few changes I can review in chat, or large-scale changes across many records?
4. Does the work need to run without a person present, such as scheduled jobs or production integrations?

Finally, give me a recommendation: which method or combination fits my environment and answers, why, what you couldn't confirm, and what I would need to set up first. If something I need is only available through a method you can't reach, tell me.

1. **What are you trying to accomplish?**

Coverage differs and changes as HubSpot adds functionality, so check the [capability reference](https://developers.hubspot.com/docs/getting-started/work-with-agents/capabilities.md) for what each method supports. For example, marketing emails, social posts, and CMS pages are available through the remote MCP server but not the Agent CLI, while bulk imports and workflows are available through the Agent CLI but not the remote MCP server. If you've already set up a HubSpot connector or the Agent CLI, you can also ask your agent to review and report what's currently available to it.

2. **Which client does your team use?**

Chat apps typically connect to the remote MCP server, either via a HubSpot-provided connector or custom connector. Agents that run in a terminal, such as Claude Code, can use both a connected remote MCP server and the Agent CLI, depending on which fits the task.

3. **How broad is the surface area you typically work in?**

Asking questions and analyzing your data works well in conversation through the remote MCP server, as does making changes small enough for you to review in the chat. Large-scale changes suit the Agent CLI, where the agent can run a command that previews the changes with `--dry-run` before it applies them.

4. **Does it need to run without a person present?**

Scheduled jobs and production integrations are usually best solved by HubSpot's REST APIs via an integration or service you build. Alternatively, you can perform bulk operations and chain Agent CLI commands with scripting, and could use external tooling to run recurring jobs.

## Best practices

HubSpot's connectors and agent tools are powerful and should be used with caution when accessing your company's data. The practices below start with everyday habits and move toward account-level controls.

* **Be specific:** write your prompts to be detailed and focused on the task at hand. Being specific about details like property names, filters, and asset titles will help to avoid mistakes.
* **Start read-only:** before asking an agent to make changes, ask it to provide a summary of what it finds. That way, you know if it's looking in the right places or if it needs more direction.
* **Ask for a plan first:** have the agent describe what it will do before it acts, and provide approval only for the changes that make sense to you. Revising a plan before taking action can help to improve output and avoid surprises.
* **Review every confirmation prompt:** confirmation is crucial, particularly for updates that span many records and assets. This is especially true when your initial prompt covers multiple tasks.
* **Use a test account:** test accounts are useful for anything that's hard to undo or that changes many records, or if you're just looking to test things out. See [account types](https://developers.hubspot.com/docs/getting-started/account-types.md).
* **Control who has access:** Super Admins manage app access in the account, including approving apps, choosing who can install them, and turning optional data permissions on or off. Learn more about [managing access to apps](https://knowledge.hubspot.com/integrations/manage-access-to-apps#manage-approved-apps).
* **Standardize on context:** share a project context file such as `CLAUDE.md` or `AGENTS.md`, plus [skills](https://agentskills.io/home), so agents behave consistently across your team. How you distribute these files and skills depends on the client you're using. For example, you can store them in a shared repository or package them in a private plugin marketplace. For teams that use Claude, you can [provision skills for your organization](https://support.claude.com/en/articles/13119606-provision-and-manage-skills-for-your-organization), depending on your plan. Learn more about [agent context files](https://developers.hubspot.com/docs/build-with-ai/agent-context-files.md) and [agent skills](https://developers.hubspot.com/docs/build-with-ai/best-practices/agent-skills.md).

> [!TIP]
>
> Super Admins can use [audit logs in HubSpot](https://knowledge.hubspot.com/account-management/view-and-export-account-activity-history#view-filter-and-export-a-centralized-audit-log) to review account activity history (*Starter* or above required). The log attributes actions made through HubSpot's connectors to both the user and the connector. Actions made with a service key show as assisted by the key's name, so give each key a clear name. A service key has no per-user audit trail of its own, and the Agent CLI's local `hubspot history` log stays on the machine, so neither replaces the account audit log.

## Examples

### Draft a marketing email

Agents can also help streamline content creation, as long as you stay in control of what goes out. You might ask a chat agent, *"Look at how last month's newsletter performed, tell me what underperformed, and help me draft next month's newsletter with improvements based on what you find."*

1. The agent reads last month's newsletter and its analytics, such as opens, clicks, and unsubscribes, and compares them with your other recent emails.
2. It reports what stood out, for example strong opens but few clicks, and suggests a likely reason.
3. It writes a draft of next month's newsletter in the chat, explains how the draft responds to its findings, and asks whether you want it to create the draft email in your account.
4. You review the draft in the chat and ask for changes. When you're happy with it, you tell the agent to create the email, and then you open it in HubSpot to edit it and decide whether to send it.

The agent prepares the work and you make the decision at each step, which fits tasks that reach your customers. See [Best practices](#best-practices).

### Bulk cleanup with a preview

Use the Agent CLI when a task touches many records and you want to see exactly what will change first.

1. The agent pipes the records to the update command with `--dry-run`, for example `cat records.jsonl | hubspot objects update --type contacts --dry-run`. Nothing changes. The output reports how many records would be affected, whether the change is reversible, and a digest to use when applying the change.
2. You review the summary.
3. After you approve, the agent runs the same command with the digest and a confirmation value.

The digest ties the apply step to the records you previewed, and it expires, so the agent runs the dry run again if you wait too long. Deletes work the same way.

### Use the remote MCP server and Agent CLI together

Some tasks need both: explore or prepare data with the remote MCP server, then complete a step it doesn't support with an Agent CLI command. For example, the remote MCP server can't read workflows or run bulk imports, but the Agent CLI can. To find which workflows reference a property, an agent can use the remote MCP server to look up the property and the CLI `workflows` commands to read the workflows.

A short instruction about when to switch can help. For example, you can tell the agent to check the Agent CLI when the remote MCP server doesn't support an action, either in your prompt, [agent context file](https://developers.hubspot.com/docs/build-with-ai/agent-context-files.md), or [skill](https://developers.hubspot.com/docs/build-with-ai/best-practices/agent-skills.md).

## Next steps

* [Capability reference](https://developers.hubspot.com/docs/getting-started/work-with-agents/capabilities.md)
* [Remote MCP server guide](https://developers.hubspot.com/docs/apps/developer-platform/build-apps/integrate-with-the-remote-hubspot-mcp-server.md)
* [Agent CLI guide](https://developers.hubspot.com/docs/developer-tooling/local-development/agent-cli/guide.md)
* [Build with AI](https://developers.hubspot.com/docs/build-with-ai/introduction.md)
