Understand standard protocols for AI editors to communicate with external tools.
π Role of MCP
MCP (Model Context Protocol) is an open protocol developed by Anthropic for AI assistants to securely communicate with external tools and data sources.
AI can call "Tools" through the MCP server.
HubSpot is the official MCP Server (@hubspot/mcp-server) is provided,
You can operate, query, and generate code for HubSpot using natural language using AI editors such as Claude Code and Cursor.
| When not using MCP | When using MCP |
|---|---|
| Code by hand while checking the API reference | Just say "Search for contacts" |
| Check property name and endpoint each time | AI references the portal's actual schema to generate accurate code |
| Open a separate tool for test execution | Execute the API and check the results directly in the editor |
| Follow logs manually for debugging | AI automatically analyzes errors and suggests corrections |
hs mcp setup Setup can be completed in a few minutes using commands.
HubSpot CLI v8.0.0 or higher(Requires Node.js 20)
Authenticated HubSpot CLIοΌhs auth completion)
AI editor: Claude Code, Cursor, VS Code (Copilot)
hs mcp setup automatically writes MCP Server connection information to each AI client's configuration file.
For Claude Code ~/.claude/mcp.json,
For Cursor ~/.cursor/mcp.json,
For VS Code .vscode/mcp.json(per project).
Understand the tools that HubSpot MCP Server provides (the operations that AI can call).
| category | Tool example | explanation |
|---|---|---|
| CRM | crm_search_contacts | Search and filter contacts |
crm_create_contact | Create contact | |
crm_get_deals | Get list of deals | |
crm_update_deal | Update opportunity properties | |
| schema | get_schemas | Schema list of all objects |
get_properties | List of properties of specified object | |
create_property | Create custom property | |
| CMS | get_blog_posts | Get blog article list |
get_hubdb_tables | HubDB table list and structure | |
| workflow | list_workflows | Workflow list |
get_workflow_details | Workflow details and execution history | |
| Analytics | get_analytics_summary | Page view/conversion tally |
get_email_stats | Email open/click rate |
Learn the specific flow of developing while interacting with AI using HubSpot MCP with Claude Code.
at the terminal claude Execute the command and Claude Code will start.
When you start it in your project directory, it automatically loads the context for that codebase as well.
If your MCP Server is configured correctly, you should see "HubSpot tools available."
Configuration and usage patterns for using HubSpot MCP with Cursor IDE.
${env:ε€ζ°ε} You can refer to system environment variables in the format:
It is more secure than writing the token directly to the file..env files and
direnv When combined with , it is easy to switch between development environments.
Cmd + K (inline code generation):In the code, write "//TODO: Get all deals closed in the past 30 days in HubSpot" and implement it as is with Cmd+K.
Cursor Chat (@ reference MCP tools):In the chat, say "Check out the contact schema and design this data model with @hubspot"
Composer (automatic editing of multiple files):"Create a migration script that adds the seat_count property to the subscriptions custom object and also update the README."
Experience the typical workflow of HubSpot development with MCP.
-
1Let AI understand the current status of the portal I asked them to "examine this portal's custom objects, property structure, and workflow, and summarize the current CRM design." AI captures and analyzes the actual schema with MCP tools.
-
2Communicating requirements verbally "I want to sync subscription data from Stripe to the subscriptions custom object every day. Please suggest the best way to implement it."
-
3Have the code generated with the actual property name AI checks the schema with MCP tools and generates code with accurate property names, types, and API paths. Zero time to look up documentation.
-
4Operation check on the spot I asked him to "Run the script you just generated in the sandbox and check the results." The AI ββactually calls the API, checks the response, and fixes any problems.
-
5Also generates test cases and documentation I asked him to write a unit test and a README section for this script. Complete implementation, testing, and documentation all at once.
Switch between multiple portals for development, staging, and production using MCP.
β Chapter 10 Checklist
- Understand the role of MCP (Model Context Protocol) and the positioning of HubSpot MCP Server
hs mcp setupMCP can be set for Claude Code / Cursor / VS Code with command- Understood the structure of the generated mcp.json
- Understood the types of tools provided by HubSpot MCP Server (CRM, schema, CMS, workflow)
- You can perform portal schema queries, data searches, and code generation using natural language.
- You can practice the AI-driven development flow of "schema confirmation β requirements communication β code generation β operation confirmation"
- Multiple portals for development and production can be managed with mcp.json
- Understand the risks of erroneous operations on the production portal and be able to develop with sandbox priority.