The HubSpot MCP Server provides a bridge between AI assistants and your HubSpot CRM data, enabling natural language interactions with your contacts, companies, and engagement data without leaving your AI interface.
To set up the HubSpot MCP Server:
# Clone the repository
git clone https://github.com/lkm1developer/hubspot-mcp-server.git
cd hubspot-mcp-server
# Install dependencies
npm install
# Build the project
npm run build
You'll need a HubSpot API access token to authenticate with the HubSpot API:
You can provide the token in two ways:
HUBSPOT_ACCESS_TOKEN=your-access-token
npm start -- --access-token=your-access-token
Create a .env
file in the project root:
HUBSPOT_ACCESS_TOKEN=your-access-token
# Start the server
npm start
# Or with a specific access token
npm start -- --access-token=your-access-token
To implement authentication in the SSE server:
Install the authentication package:
npm install mcp-proxy-auth
Set the authentication server URL:
export AUTH_SERVER_URL=https://your-auth-server.com/verify
Run the server with authentication:
npx mcp-proxy-auth node dist/index.js
The SSE endpoint will be available at:
localhost:8080/sse?apiKey=your-api-key
Use hubspot_create_contact
to add a new contact to HubSpot:
{
"firstname": "John",
"lastname": "Doe",
"email": "[email protected]",
"properties": {
"company": "Acme Inc",
"phone": "555-123-4567",
"jobtitle": "Software Engineer"
}
}
Use hubspot_update_contact
to modify an existing contact:
{
"contact_id": "12345",
"properties": {
"email": "[email protected]",
"phone": "555-987-6543",
"jobtitle": "Senior Software Engineer"
}
}
Use hubspot_get_active_contacts
to retrieve recently active contacts:
{
"limit": 15
}
Use hubspot_create_company
to add a new company:
{
"name": "Acme Corporation",
"properties": {
"domain": "acme.com",
"industry": "Technology",
"phone": "555-987-6543",
"city": "San Francisco",
"state": "CA"
}
}
Use hubspot_update_company
to modify an existing company:
{
"company_id": "67890",
"properties": {
"domain": "updated-domain.com",
"phone": "555-123-4567",
"industry": "Software"
}
}
Use hubspot_get_active_companies
to retrieve recently active companies:
{
"limit": 10
}
Use hubspot_get_company_activity
to retrieve a company's engagement history:
{
"company_id": "67890"
}
Use hubspot_get_recent_engagements
to retrieve recent activities across your HubSpot instance:
{
"days": 14,
"limit": 25
}
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.