HubSpot CRM MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@HubSpot CRM MCP Server Show me all deals in the pipeline 'Sales'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
HubSpot CRM MCP Server
HubSpot CRM MCP server for Claude Desktop and any MCP client, free-tier compatible. 15 tools over contacts, deals, and pipelines, authenticated with either a HubSpot private-app token or a full OAuth app. Writes are idempotent, so a retried tool call replays its first result instead of creating a duplicate record, and every tool call is written to a PII-redacted audit trail, including the calls denied for a missing scope and the calls that errored.
Related: QuickBooks Online MCP Server · MCP Audit Gateway · What production MCP actually requires
HubSpot runs a hosted MCP server of its own, with wider object coverage than this one. It is built for self-hosting: you run the process, the source is short enough to read in a sitting, and the audit trail, the cache, and the credentials never leave your infrastructure.
The rest is what a REST wrapper usually leaves out. It prompts for the exact missing scope
instead of leaking a raw 403, retries rate limits with backoff, serves record reads from a
local cache (TTL plus write-invalidation, with a signature-verified webhook handler you can wire
to your own HTTP ingress for out-of-band changes), walks cursor pagination, and returns per-item
results when a batch partially fails.
See docs/COMPARISON.md for side-by-side transcripts of a naive
API-wrapper MCP versus this one. Every transcript is generated by running both against the
mocked test suite.
Architecture
flowchart TD
Agent["MCP client / agent"] -->|"stdio (JSON-RPC)"| Server["FastMCP server<br/>server.py"]
Server --> Service["CrmService<br/>scope checks · audit · orchestration"]
Service --> Cache["LocalCache<br/>TTL + write invalidation"]
Service --> Idem["Idempotency store"]
Service --> Audit["Audit log<br/>PII redaction"]
Service --> Client["HubSpotClient<br/>retries · pagination · error mapping"]
Client --> Auth["Token provider<br/>private-app · OAuth refresh"]
Client -->|HTTPS| HubSpot["HubSpot CRM API"]
Ingress["Your HTTP ingress<br/>(optional, host-provided)"] -->|"signed v3 payload"| Processor["WebhookProcessor<br/>verify_signature"]
Processor -->|"invalidate(object)"| CacheThe stdio server speaks JSON-RPC only; it does not listen for webhooks. WebhookProcessor and
verify_signature are shipped as a tested component you mount on your own HTTP ingress (see
Webhook cache invalidation).
Related MCP server: hubspot-mcp-server
Tools
Every tool carries MCP annotations (readOnlyHint, destructiveHint, idempotentHint,
openWorldHint), a described input schema, and an output schema.
Tool | What it does | Scope |
| Search contacts by free-text term, one page at a time |
|
| List contacts in id order with cursor pagination |
|
| Fetch one contact by id, served from the local cache |
|
| Create a contact, idempotent on a supplied or derived key |
|
| Overwrite the properties passed and invalidate the cache entry |
|
| Archive (soft-delete) a contact |
|
| Create up to 100 contacts and report per-row failures |
|
| Search deals by free-text term with cursor pagination |
|
| Fetch one deal by id, served from the local cache |
|
| Create a deal, idempotent on a supplied or derived key |
|
| Update deal properties, including moving it to another stage |
|
| Archive (soft-delete) a deal |
|
| List deal pipelines with stages in display order (cached) |
|
| Fetch one pipeline with its ordered stages |
|
| Export the session audit trail as JSON Lines | none |
Quickstart
Run it without installing anything permanent:
uvx mcp-hubspotOr install it:
pip install mcp-hubspot
mcp-hubspotEither form speaks MCP over stdio on stdin and stdout. Authenticate with either a private-app
token (HUBSPOT_PRIVATE_APP_TOKEN) or an OAuth app (HUBSPOT_CLIENT_ID +
HUBSPOT_CLIENT_SECRET + HUBSPOT_REFRESH_TOKEN). The server auto-detects which is present.
Credentials are resolved lazily. The server starts and answers initialize and tools/list with
nothing configured, which is what lets a directory or a sandbox introspect it; the first tool call
is where a missing credential turns into an actionable error.
Wiring into an MCP client
Add to your MCP host config (for example Claude Desktop's claude_desktop_config.json):
{
"mcpServers": {
"hubspot": {
"command": "uvx",
"args": ["mcp-hubspot"],
"env": { "HUBSPOT_PRIVATE_APP_TOKEN": "pat-na1-..." }
}
}
}Docker
docker build -t mcp-hubspot .
docker run --rm -i -e HUBSPOT_PRIVATE_APP_TOKEN=pat-na1-... mcp-hubspotFrom source
Requires Python 3.12+ and uv.
uv venv
uv pip install -e ".[dev]"
cp .env.example .env # then fill in your HubSpot credentials
uv run mcp-hubspotOAuth authorization URL
For the OAuth flow, mcp_crm.auth.build_authorization_url(...) builds the consent URL with the
scopes the tools need; exchange the returned code for a refresh token and set
HUBSPOT_REFRESH_TOKEN.
Webhook cache invalidation
The stdio server does not receive webhooks. To invalidate the cache on changes made outside this
process (edits in the HubSpot UI, other integrations), mount WebhookProcessor on your own HTTP
endpoint and verify HubSpot's v3 signature with verify_signature (using the
HUBSPOT_WEBHOOK_SECRET you configure). Point it at the same LocalCache your CrmService uses:
from mcp_crm.webhooks import WebhookProcessor, verify_signature
processor = WebhookProcessor(cache)
def handle_hubspot_webhook(request):
ok = verify_signature(
secret=webhook_signing_secret,
method="POST",
uri=request.url,
body=request.raw_body,
signature=request.headers["X-HubSpot-Signature-v3"],
timestamp=request.headers["X-HubSpot-Request-Timestamp"],
)
if not ok:
return 401
processor.process(request.json())
return 200verify_signature rejects tampered bodies, wrong secrets, and stale timestamps;
WebhookProcessor.process maps each subscription to the object it invalidates and reports what it
touched.
Design decisions
Cache scope. Only object-detail reads (
crm_get_contact,crm_get_deal) and the pipeline list are cached; list/search results are query-dependent and left uncached to avoid serving stale result sets. Writes invalidate the relevant object immediately. For out-of-band changes, a signature-verifiedWebhookProcessorships as a component you mount on your own HTTP ingress (see Webhook cache invalidation); the stdio server itself does not listen for webhooks.Idempotency is client-side. HubSpot's create endpoints are not natively idempotent, so a key (supplied or derived from the payload) is stored and replayed. This makes at-least-once tool retries safe without duplicating records. The store lives in the process, so it covers retries within a session rather than across restarts, and
crm_batch_create_contactsdeliberately does not use it; both facts are stated in the tool descriptions.Scope prompting happens twice. The service pre-checks granted scopes (via token introspection) for a fast, actionable error, and the HTTP client also maps a server-side
MISSING_SCOPES403to the same typed error (belt and suspenders).Credentials load lazily. Nothing reads a token at import or at startup. A missing credential surfaces as a typed error on the first tool call, and that failure is audited like any other, so the server is still introspectable in a sandbox with an empty environment.
Backoff and clocks are injectable. Retry sleep, RNG jitter, and time sources are constructor parameters, which is why the whole suite runs offline in well under a second.
Testing
Every external HubSpot call is served by an in-memory fake (tests/fake_hubspot.py) backed by
JSON fixtures (tests/fixtures/), wired in through httpx.MockTransport. No network, no
credentials, deterministic.
uv run pytest -qRegenerate the comparison document (CI also checks it stays in sync):
uv run python scripts/generate_comparison.pyRegistry metadata
server.json describes this package for the Model Context Protocol registry
(io.github.amin-ale/hubspot-crm-mcp, PyPI mcp-hubspot, stdio transport). .mcp.json is the
minimal client config for tools that auto-detect MCP servers from a repository root.
Scope and safety
This is a client for HubSpot data you own or are authorized to access. Point it only at HubSpot accounts you control or have written permission to operate. The audit log redacts emails and phone numbers before writing records; treat exported audit logs as sensitive regardless. Behaviour documented here is point-in-time against the included fixtures, not a guarantee about any live HubSpot account.
Hire me
I build MCP servers and API integrations that survive a senior-dev code review: auth, retries, idempotency, and audit trails included, not bolted on later. Portfolio and contact: https://amin-ale.github.io/portfolio-site · amin.ale.business@gmail.com.
Available Tools
15 toolscrm_batch_create_contactsA
Create many HubSpot contacts in one request and report the outcome of every row.
Use this for bulk loads. Use crm_create_contact instead when a retry must not risk duplicates.
Writes, additively. Needs the crm.objects.contacts.write scope. Returns 'succeeded' with the created records and 'failed' with the input index, HubSpot status code, category, message, and original row for every rejection, so a partial failure never hides the rows that did save. This path does not go through the idempotency store: running the same batch twice can create duplicates, so re-send only the rows listed in 'failed'. Cached contact reads are invalidated.
Inputs: contacts (required). Returns: failed, succeeded
crm_create_contactAIdempotent
Create one HubSpot contact from the properties given and return the new record.
Use this for single creates, especially ones a retry might repeat. Use crm_batch_create_contacts to load many rows at once, and crm_update_contact to change a record that already exists.
Writes, additively. Needs the crm.objects.contacts.write scope. The call is keyed by 'idempotency_key', or by a hash of the properties when none is given, and a repeat of the same key replays the stored record instead of creating a second one. That key store lives in this process, so it covers retries within a session and not restarts. Cached contact reads are invalidated. At least one property must be supplied or the call fails validation.
Inputs: email, phone, company, lastname, +2 more. Returns: id, archived, properties
crm_create_dealAIdempotent
Create one HubSpot deal from the properties given and return the new record.
Call crm_list_pipelines first when setting 'pipeline' or 'dealstage', because HubSpot only accepts a stage id that belongs to the chosen pipeline. Use crm_update_deal to move an existing deal.
Writes, additively. Needs the crm.objects.deals.write scope. The call is keyed by 'idempotency_key', or by a hash of the properties when none is given, and a repeat of the same key replays the stored record instead of creating a second one. That key store lives in this process, so it covers retries within a session and not restarts. Cached deal reads are invalidated. At least one property must be supplied.
Inputs: amount, dealname, pipeline, dealstage, +2 more. Returns: id, archived, properties
crm_delete_contactADestructiveIdempotent
Archive (soft-delete) a HubSpot contact so it drops out of active views.
Use this instead of asking a human to delete in the UI. This server never issues a hard delete; HubSpot keeps archived records restorable from its own UI for a limited window.
Writes, and destructive from an agent's point of view. Needs the crm.objects.contacts.write scope. Archiving the same id again leaves it archived. The record is dropped from the read cache and stops appearing in list and search results. Raises a not-found error for an id that never existed.
Inputs: contact_id (required). Returns: id, archived
crm_delete_dealADestructiveIdempotent
Archive (soft-delete) a HubSpot deal so it drops off the pipeline board.
Prefer moving a lost deal to a closed-lost stage with crm_update_deal, which keeps it in reporting. Archive only when the record should not have existed.
Writes, and destructive from an agent's point of view. Needs the crm.objects.deals.write scope. Archiving the same id again leaves it archived. The record is dropped from the read cache and stops appearing in searches. Raises a not-found error for an id that never existed.
Inputs: deal_id (required). Returns: id, archived
crm_export_audit_logARead-onlyIdempotent
Export this session's audit trail as JSON Lines, one record per line.
Use this to hand a reviewer evidence of what the agent did, or to attach the trail to a ticket or change record.
Read-only and entirely local: it reads an in-memory buffer, makes no HubSpot call, and needs no scope. Every other tool call in the session is present, including calls denied for a missing scope and calls that raised an error, each with an id, timestamp, actor, tool name, outcome, the arguments, a short result summary, and the idempotency key where one applied. Email addresses and phone numbers are redacted before a record is stored. The buffer is not persisted, so it starts empty every time the server starts and an export after a restart covers only the new session.
Inputs: no named parameters. Returns: result
crm_get_contactARead-onlyIdempotent
Fetch one HubSpot contact by record id with its email, name, phone, and company.
Use this once an id is known. Use crm_search_contacts to find the id first.
Read-only. Needs the crm.objects.contacts.read scope. Served from an in-process cache with a 300 second default TTL; writes made through this server invalidate the entry immediately, and a cache hit is recorded in the audit log as a cache hit rather than a live read. Raises a not-found error for an unknown or archived id.
Inputs: contact_id (required). Returns: id, archived, properties
crm_get_dealARead-onlyIdempotent
Fetch one HubSpot deal by record id with its name, amount, pipeline, and stage.
Use this once an id is known; use crm_search_deals to find the id first.
Read-only. Needs the crm.objects.deals.read scope. Served from an in-process cache with a 300 second default TTL, and writes made through this server invalidate the entry immediately. Raises a not-found error for an unknown or archived id.
Inputs: deal_id (required). Returns: id, archived, properties
crm_get_pipelineARead-onlyIdempotent
Fetch one deal pipeline by id with its stages sorted by display order.
Use this when the pipeline id is already known and only its stages are needed. Use crm_list_pipelines to discover ids.
Read-only. Needs the crm.schemas.deals.read scope. Unlike the pipeline list, this call is not cached and always reaches HubSpot. Raises a not-found error for an unknown id.
Inputs: pipeline_id (required). Returns: id, label, stages, display_order
crm_list_contactsARead-onlyIdempotent
List HubSpot contacts in record-id order, one page at a time.
Use this to walk the whole contact set. Prefer crm_search_contacts when there is a term to match on, since listing everything is slower and burns rate limit.
Read-only. Needs the crm.objects.contacts.read scope; a missing scope is denied locally and recorded in the audit log. Not cached. Pass the returned 'after' cursor back for the next page and stop when it comes back null. Archived contacts are excluded.
Inputs: after, limit. Returns: after, results
crm_list_pipelinesARead-onlyIdempotent
List every deal pipeline in the account with its stages in display order.
Call this before creating or moving a deal: it is the source of the 'pipeline' and 'dealstage' ids those tools need, and HubSpot rejects a stage id from the wrong pipeline.
Read-only. Needs the crm.schemas.deals.read scope. Served from an in-process cache with a 300 second default TTL, since pipeline definitions rarely change. Returns an empty list only if the account genuinely has no deal pipelines.
Inputs: no named parameters. Returns: result
crm_search_contactsARead-onlyIdempotent
Search HubSpot contacts by free-text term and return one page of matches.
Use this to find contacts by name, email, company, or any other indexed property. Prefer crm_list_contacts when there is no term to match on, and crm_get_contact when the record id is already known.
Read-only. Needs the crm.objects.contacts.read scope; without it the call is denied before any CRM data request is made and the denial is written to the audit log. Search results are never cached, so every call reaches HubSpot. Pass the returned 'after' cursor back to walk further pages; a null 'after' means this was the last page. Archived contacts are excluded.
Inputs: after, limit, query. Returns: after, results
crm_search_dealsARead-onlyIdempotent
Search HubSpot deals by free-text term and return one page of matches.
Use this to find deals by name, amount, or stage text. Use crm_get_deal when the record id is already known, and crm_list_pipelines to translate the returned pipeline and stage ids into readable labels.
Read-only. Needs the crm.objects.deals.read scope; a missing scope is denied locally and recorded in the audit log. Not cached. Pass the returned 'after' cursor back for the next page and stop when it is null. Archived deals are excluded.
Inputs: after, limit, query. Returns: after, results
crm_update_contactADestructiveIdempotent
Update properties on an existing HubSpot contact and return the updated record.
Use this to change a known record. Use crm_create_contact for records that do not exist yet.
Writes. Only the properties passed are sent, and each one overwrites the value HubSpot held before, so the previous value is lost; properties left out are untouched. Applying the same values again produces the same record, which makes a retry safe. Needs the crm.objects.contacts.write scope. Invalidates this contact's cache entry. Raises a not-found error for an unknown or archived id, and a validation error when no property is supplied.
Inputs: contact_id (required), email, phone, company, +2 more. Returns: id, archived, properties
crm_update_dealADestructiveIdempotent
Update properties on an existing HubSpot deal, including moving it to a new stage.
Use this to advance a deal through its pipeline. The deal's pipeline itself is not changeable here; create the deal in the right pipeline instead.
Writes. Only the properties passed are sent, and each one overwrites the value HubSpot held before; properties left out are untouched. Applying the same values again produces the same record, which makes a retry safe. Needs the crm.objects.deals.write scope. Invalidates this deal's cache entry. Raises a not-found error for an unknown or archived id, and a validation error when no property is supplied.
Inputs: deal_id (required), amount, dealname, dealstage, +1 more. Returns: id, archived, properties
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 15 tools
Each tool targets a distinct resource and action: contacts, deals, pipelines, or audit log. Overlapping search/get/list tools are clearly separated with explicit guidance on when to prefer each.
All tools follow a consistent crm_verb_noun pattern with snake_case throughout. The compound verb 'batch_create' fits the convention as cleanly as simple verbs like 'search' or 'list'.
15 tools is right at the upper bound of the ideal 3-15 range. The count matches the server's stated CRM scope: two primary objects (contacts, deals) plus supporting pipelines and audit coverage.
Contacts have full search/list/get/create/update/delete/batch-create coverage. Deals lack a list-all-deals counterpart to crm_list_contacts, though search can approximate it. Pipeline and audit support are adequate. Minor gap only.
Maintenance
Related MCP Connectors
The HubSpot MCP Server acts as a bridge that enables AI assistants and Large Language Models to securely interact with HubSpot CRM data through natural conversation, without requiring users to understand complex API structures. It provides read-only access to standard CRM objects (contacts, companies, deals, tickets, products, invoices, and more) and their associations, secured via OAuth 2.0, allowing AI agents to perform tasks like summarizing deals, fetching company updates, and looking up record changes.
Search, read, create and update CRM contacts, companies, deals and tickets in HubSpot.
MCP server for the HubSpot Integrations Center HubDB: search and retrieve integration data.
API-first CRM for LLMs - contacts, companies, deals and activities over a native MCP server.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI models to interact with HubSpot CRM data and operations through a standardized interface, supporting contact and company management.16129MIT
- FlicenseAqualityCmaintenanceEnables interaction with HubSpot CRM through MCP, providing tools to manage contacts, companies, deals, and search/associations via natural language.18-
- AlicenseAqualityCmaintenanceExposes HubSpot CRM data and actions as tools for AI agents, enabling contact lookup, company search, contact creation, and activity logging via natural language.4MIT
- AlicenseNot gradedqualityFmaintenanceEnables AI agents to author HubSpot automation end-to-end through MCP, including building workflows, setting enrollment criteria, wiring steps, defining goal criteria, and managing contact lists, with every mutation verified by reading state back.MIT