← All integrations

HubSpot MCP integration for AI agents

Anlyon's HubSpot integration gives an AI agent HubSpot tools over MCP or through Anlyon's API: it can search, create and update contacts, companies and deals. Each of your users signs in to HubSpot on HubSpot's own consent page, and your company's account connects the same way. The sign-in runs through Anlyon's app or your own OAuth app, which is recommended for production. Your agent calls each action by name and never holds the token.

Let an agent work your CRM without handing it your CRM. It searches and reads contacts, companies and deals, creates and updates them, moves stages and adds notes through named operations, each write counted against a limit you set.

HubSpotsecret · HUBSPOT
host
api.hubapi.com
connect
Sign in, per user
  • Create contact

    hubspot-create-contact

  • Update contact stage

    hubspot-update-contact-stage

  • Set lead status

    hubspot-set-lead-status

  • Add note

    hubspot-add-note

writes are off until switched on

What can an AI agent do in HubSpot? Writes are off until you switch them on.

Each one is a named operation from the pack. Reads change nothing.

Writes

  • Create contact

    read back

    hubspot-create-contact

    Create one HubSpot contact with an email and a name.

  • Update contact stage

    read back

    hubspot-update-contact-stage

    Set the lifecycle stage of one HubSpot contact.

  • Set lead status

    read back

    hubspot-set-lead-status

    Set the lead status of one HubSpot contact.

  • Add note

    read back

    hubspot-add-note

    Add a note to one HubSpot contact.

  • Create company

    read back

    hubspot-create-company

    Create one HubSpot company with a name and domain.

  • Create deal

    read back

    hubspot-create-deal

    Create one HubSpot deal in the default pipeline. The amount is a decimal string in the portal currency.

  • Update deal stage

    read back

    hubspot-update-deal-stage

    Move one HubSpot deal to a stage of the default pipeline.

  • Update contact

    acknowledged

    hubspot-update-contact

    Change common properties of one HubSpot contact: name, email, phone, company name, job title, website, address or owner. A property left out keeps its value. It cannot change the lifecycle stage or lead status; update-contact-stage and set-lead-status do, under their own policies.

  • Update company

    acknowledged

    hubspot-update-company

    Change common properties of one HubSpot company: name, domain, website, phone, address, employees, annual revenue, description or owner. A property left out keeps its value.

  • Update deal

    acknowledged

    hubspot-update-deal

    Change common properties of one HubSpot deal: name, amount, close date, type, priority, description or owner. A property left out keeps its value. It cannot move the deal to another stage or pipeline; update-deal-stage does, under its own policy.

  • Associate records

    acknowledged

    hubspot-associate-records

    Associate two HubSpot records (a contact, company or deal with another) with HubSpot's default, unlabeled association, for example a contact with its company or a deal with its contact. Associating records that already are associated changes nothing.

  • Remove association

    acknowledged

    hubspot-remove-association

    Remove every association between two HubSpot records (a contact, company or deal and another), labeled or not. Both records stay.

  • Add company note

    read back

    hubspot-add-company-note

    Add a note to one HubSpot company.

  • Add deal note

    read back

    hubspot-add-deal-note

    Add a note to one HubSpot deal.

  • Delete note

    read back

    hubspot-delete-note

    Delete one HubSpot note: it moves to HubSpot's recycling bin, where it can be restored within 90 days.

  • Archive contact

    read back

    hubspot-archive-contact

    Archive (delete) one HubSpot contact: it moves to HubSpot's recycling bin, where it can be restored within 90 days, and drops out of searches.

  • Archive company

    read back

    hubspot-archive-company

    Archive (delete) one HubSpot company: it moves to HubSpot's recycling bin, where it can be restored within 90 days, and drops out of searches.

  • Archive deal

    read back

    hubspot-archive-deal

    Archive (delete) one HubSpot deal: it moves to HubSpot's recycling bin, where it can be restored within 90 days, and drops out of searches.

Reads

  • Search contacts

    hubspot-search-contacts

    Search HubSpot contacts for words in their name, email, phone or company, or list every contact when query is left out, most recently modified first. Returns 20 contacts a page with their main properties (email, name, phone, company, job title, lifecycle stage, lead status, owner) and paging.next.after; pass it as after for the next page. Changes nothing.

  • Get contact

    hubspot-get-contact

    Get one HubSpot contact by id: its main properties (email, name, phone, company, job title, lifecycle stage, lead status, owner, dates) and the ids of the companies and deals it is associated with.

  • Get contact by email

    hubspot-get-contact-by-email

    Get one HubSpot contact by its email address: the same properties and associated company and deal ids as get-contact. HubSpot answers 404 when no contact has that email, which makes this the check to run before create-contact.

  • Search companies

    hubspot-search-companies

    Search HubSpot companies for words in their name, domain, website or phone, or list every company when query is left out, most recently modified first. Returns 20 companies a page with their main properties (name, domain, industry, location, size, revenue, owner) and paging.next.after; pass it as after for the next page. Changes nothing.

  • Get company

    hubspot-get-company

    Get one HubSpot company by id with its main properties (name, domain, website, phone, industry, location, employees, annual revenue, lifecycle stage, owner, dates). Use list-associations for its contacts and deals, which can be many.

  • Search deals

    hubspot-search-deals

    Search HubSpot deals for words in their name, description or type, or for a pipeline or stage id (query contractsent finds deals at that stage), or list every deal when query is left out, most recently modified first. Returns 20 deals a page with their main properties (name, amount, stage, pipeline, close date, type, priority, owner) and paging.next.after; pass it as after for the next page. Changes nothing.

  • Get deal

    hubspot-get-deal

    Get one HubSpot deal by id: its main properties (name, amount, stage, pipeline, close date, type, priority, description, owner, dates) and the ids of the contacts and companies it is associated with.

  • List deal pipelines

    hubspot-list-deal-pipelines

    List the account's deal pipelines with their stages: each stage's id, label, order, win probability and whether it closes the deal. HubSpot returns every pipeline in one response and does not page it. Stage ids from a custom pipeline are what search-deals and get-deal show in dealstage.

  • Get property

    hubspot-get-property

    Get the definition of one contact, company or deal property: its label, type and, for a dropdown, every option's value and label, such as the account's lifecycle stages (lifecyclestage), lead statuses (hs_lead_status), industries (industry) or deal types (dealtype). Use it to find the values a field takes in this account.

  • List associations

    hubspot-list-associations

    List the records of one type associated with a HubSpot contact, company or deal: each associated record's id (toObjectId) and its association labels. Returns 100 a page and paging.next.after; pass it as after for the next page. Use get-contact, get-company or get-deal on an id for its details.

  • List notes

    hubspot-list-notes

    List the notes on one HubSpot contact, company or deal, newest first: each note's id, body (HTML), timestamp and owner. Returns 10 notes a page and paging.next.after; pass it as after for the next page. Changes nothing.

How do users connect? Each one brings their own HubSpot.

  1. 1.Call for the userYour server invokes the action for the signed-in user. Without a HubSpot connection, the SDK throws EndUserNotConnectedError with a connect link.
  2. 2.The user signs inThe link opens HubSpot's own sign-in. The user approves the access there. The link lasts 10 minutes and works once.
  3. 3.Anlyon keeps the tokenThe token from the sign-in is stored for that user. It is never shown back.
  4. 4.Your server confirmsYour server confirms the connection for the user who is signed in, and the call goes through.

How do I control what an AI agent does in HubSpot? Suggested limits and approvals, for you to review.

Suggested limits

  • 100 contacts created a day
  • 200 contact updates a day
  • 200 lead status changes a day
  • 500 notes a day
  • 50 companies created a day
  • 50 deals created a day
  • 100 deal stage changes a day
  • 200 contact property updates a day
  • 100 company property updates a day
  • 100 deal property updates a day
  • 200 associations created a day
  • 100 associations removed a day
  • 200 company notes a day
  • 200 deal notes a day
  • 50 notes deleted a day
  • 20 contacts archived a day
  • 10 companies archived a day
  • 20 deals archived a day

Suggested approvals

  • A person approves a stage change to customer
  • A person approves closing a deal
  • A person approves archiving a contact
  • A person approves archiving a company
  • A person approves archiving a deal
  • A person approves deleting a note

What the key must allow

  • Read and write contacts
  • Read and write companies
  • Read and write deals

Good to know

  • A read-back proves the record now holds the value. It can match a value the record already had.
  • HubSpot has no idempotency key for these writes. Anlyon sends each one once and never repeats it.

For your own account

  1. 1.Open Actions, then Integrations, and choose HubSpot.
  2. 2.Press Connect. HubSpot's own consent page opens and shows what Anlyon asks for.
  3. 3.Pick the HubSpot account and approve. The window closes on its own.
  4. 4.The account is now a secret named HUBSPOT, bound to api.hubapi.com.

How do I call HubSpot from my agent's code? For one of your users, or for your own account.

Act for one of your users from your server, or connect your company's own HubSpot with the CLI.

hubspot.ts
import { Client, EndUserNotConnectedError } from "@anlyonhq/sdk";const anlyon = new Client({ apiKey: process.env.ANLYON_API_KEY! });try {  const { data } = await anlyon    .forUser(session.userId)    .actions.invoke("hubspot-update-contact-stage", {      contactId: "151",      lifecyclestage: "opportunity"    });  return { status: "done", grade: data.grade };} catch (error) {  if (error instanceof EndUserNotConnectedError) {    // The user connects their own HubSpot, then you call again.    return { status: "connect_required", url: error.connectUrl };  }  throw error;}

Questions. HubSpot and AI agents.

Anything still unanswered is worth an email.

support@anlyon.com

Email us

Connect a HubSpot account in Anlyon, switch on the operations the agent may use, and call them from the TypeScript or Python SDK or over MCP. Each of your users connects their own account through a connect link, where they sign in on HubSpot's own consent page. Your agent sees the operations by name and never sees the credential.

Through Anlyon it can search, create and update contacts, companies and deals. Reads change nothing. Writes are off until you switch them on, and every write leaves a receipt.

Yes. Every HubSpot action you enable is also an MCP tool on Anlyon's hosted MCP server, at https://api.anlyon.com/mcp. Add that address to Claude Code, Cursor or Codex and sign in. It is Anlyon's own integration, and it calls HubSpot's API with the token Anlyon holds.

No. The token stays with Anlyon and is sent only in the request to HubSpot's API. No API returns it, to you, to the console or to an agent.

Let your agent act for your users, safely.

A few lines of server code, then send a user a connect link. Nothing to host.

$ claude mcp add --transport http anlyon https://api.anlyon.com/mcp