Introduction
It’s been a while since we’ve posted a deep-dive technical article here at SLIDEFACTORY—but with so many shifts happening in the development landscape, it felt like the right time. In this post, we’re exploring how to connect HubSpot’s powerful CRM with conversational AI using Cursor, a purpose-built IDE for working with Large Language Models (LLMs). At the heart of this setup is HubSpot’s Managed ChatGPT Plugin (MCP) server, which acts as a secure middleware layer, enabling AI models to fetch and interact with live CRM data. Whether you're aiming to enhance sales conversations, streamline support, or supercharge your marketing workflows, this integration opens the door to smarter, more dynamic automation. We’ll walk you through configuring HubSpot, setting up Cursor, and building a working example that queries CRM data using natural language.
What is Cursor?
Cursor is a modern Integrated Development Environment (IDE) tailored for developers building applications powered by Large Language Models. It simplifies AI integration, allowing you to quickly prototype, test, and refine prompts and responses. Cursor has gained popularity within the developer community, particularly among those familiar with "vibe coding," a coding style focused on rapid, iterative development and experimentation in a relaxed and intuitive manner. Cursor embraces this approach, making it easier than ever to experiment, tweak, and evolve AI interactions in real-time. We're not going to dive into vibe coding at this point, but i'm sure we'll touch on it at some point in the future.
Key features Cursor include:
- Intuitive Prompt Engineering: Quickly build and adjust prompts to optimize interactions.
- Real-time Debugging: Easily identify and resolve issues during development.
- Multi-language Support: Seamlessly work with Python, JavaScript, and more, ensuring compatibility across diverse development environments.
Understanding HubSpot and Its MCP Server
What is an MCP server?
An MCP (Model Context Protocol) server is middleware designed to provide a secure, abstracted interface for AI models to interact with business systems and APIs. By standardizing data access and authentication, MCP servers simplify the integration process, ensuring your AI can securely and efficiently communicate with essential business tools without needing detailed API knowledge.
HubSpot’s MCP Server, released in public beta on May 6, 2025, provides this powerful middleware specifically for HubSpot’s CRM platform. It enables AI-powered applications like Cursor to securely retrieve, create, or modify HubSpot CRM data, including contacts, deals, tickets, tasks, and notes.
Connecting your AI models to HubSpot via the MCP server offers significant benefits:
- Single source of truth: Conversational AI can access real-time customer records, pipeline data, and ticket statuses.
- Enhanced personalization: Customer interactions become richer, leveraging up-to-date account histories and recent interactions.
- Task automation: Routine tasks like logging interactions, creating tasks, and updating CRM data can be fully automated through natural language interactions.
- Developer productivity: Reduces manual API handling, enabling developers to quickly integrate structured CRM data into their workflows.
What We’ll Cover Next
Now that we've outlined the key concepts, it's time to roll up our sleeves and dive into the hands-on part. In the upcoming sections, we’ll guide you step-by-step through configuring your HubSpot account, setting up Cursor for development, and connecting everything together. By the end of this guide, you'll have a working MCP integration capable of fetching data directly from HubSpot, empowering you to enhance your business processes with conversational AI.
Setting Up the Integration
Step 1: Configuring Your HubSpot Environment
Begin by preparing your HubSpot account for integration:
- Create a Private App and Get Your Access Token:
- Go to Settings > Integrations > Private Apps in your HubSpot dashboard.
- Click "Create Private App", give it a name, and assign the appropriate scopes (start with read-only scopes if you're just testing).
- Click Create App, then copy and securely store the generated Private App Access Token.
- This token will be used in your MCP configuration to authenticate requests from Cursor to HubSpot.
- Set Appropriate Permissions:Ensure your API key includes access to:
Step 2: Using Cursor for MCP Development
Let’s begin by installing Cursor if you haven’t already:
- Install Cursor:
Once installed, create a new directory for your MCP integration project. For example:
mkdir hubspot-integration
cd hubspot-integration
Then, generate a new Cursor project inside that directory:
cursor new .
Next, set up your project so Cursor can talk to HubSpot’s MCP server.
A configuration file is a lightweight, structured file that helps applications know how to behave in specific environments. In this case, it tells Cursor how to launch and connect to the HubSpot MCP Server, what command to run, and what authentication token to use. Instead of hardcoding connection details into your scripts, this config file makes the integration clean, portable, and easy to manage—especially when working across different environments or team members.
Before you start issuing prompts or fetching data, Cursor needs this setup in place so it knows how to communicate with the HubSpot MCP Server. When you run Cursor with this configuration, it uses the provided npm package (@hubspot/mcp-server) to launch a local MCP server instance in the background. This local server acts as a bridge between your prompts and the HubSpot CRM, interpreting natural language commands and translating them into structured API calls on your behalf. This is done using a configuration file in your project directory. Create the .cursor/mcp.json
file with the following content:
mkdir -p .cursor && touch .cursor/mcp.json
Paste the following configuration inside:
{
"mcpServers": {
"hubspot": {
"command": "npx",
"args": ["-y", "@hubspot/mcp-server"],
"env": {
"PRIVATE_APP_ACCESS_TOKEN": "<your-private-app-access-token>"
}
}
}
}
Make sure you have Node.js and npm installed, and replace <your-private-app-access-token>
with the token you generated from your HubSpot private app. This tells Cursor how to start and authenticate with the HubSpot MCP server. Once saved, restart Cursor to enable access to the MCP tools.
Test Prompt Communication
Before we move on to actual data retrieval, it's a good idea to make sure everything is working. At this point, you’ve installed Cursor, configured the MCP server, and connected it to your HubSpot account. Now, let’s test that connection.
You can use a simple prompt to validate that Cursor can send requests through the MCP server and receive a response from HubSpot:
prompt = "Fetch latest deals from HubSpot"
response = cursor.call_llm(prompt)
print(response)
If everything is configured correctly, you should see a structured response containing recent deal data from your HubSpot CRM. If not, double-check your .cursor/mcp.json
file, ensure your access token is valid, and confirm that the MCP server is running without errors.
Getting MCP Access Details from HubSpot
OK, we're almost there. Before we make any calls to HubSpot’s MCP server, we need to know what endpoints are available and how they’re structured. Fortunately, HubSpot provides detailed API documentation and changelogs that outline MCP server functionality.
To explore the available actions and data models you can use:
- Visit developers.hubspot.com
- Look for the MCP Server (Beta) changelog released on May 6, 2025
- Review the available objects such as contacts, deals, tickets, and their supported operations (e.g., list, get by ID, create, update)
Additionally, HubSpot's own developer documentation offers examples of how to:
- Set up an access token via OAuth (recommended for production)
- Understand object properties and relationships
- Format requests and responses expected by the MCP interface
This is a critical step for building reliable integrations: the more you know about the object structure and available actions, the more control you’ll have over your AI's output.
Step 3: Connecting Cursor to HubSpot’s MCP Server
Now that Cursor is configured to work with the HubSpot MCP server and you’ve verified that everything is set up correctly with a test prompt, let’s look at how you can access your CRM data directly using Python. While most interactions in Cursor will happen through natural language prompts, it’s helpful to understand what’s happening behind the scenes.
The MCP server translates natural language into structured API calls. If you prefer—or need—to test the underlying API layer directly (such as during debugging or for advanced control), you can use Python’s requests
library to simulate how the MCP would interact with HubSpot’s REST API.
import requests
api_key = 'YOUR_PRIVATE_APP_ACCESS_TOKEN'
headers = {'Authorization': f'Bearer {api_key}'}
response = requests.get('https://api.hubspot.com/crm/v3/objects/deals', headers=headers)
deals_data = response.json()
print(deals_data)
Recap and Next Steps
Alright, if everything's gone well, at this point we've successfully configured our HubSpot environment, set up our Cursor project, and established a connection between Cursor and HubSpot’s MCP server. With this foundation, we're now ready to dive into a practical example. In the next section, we'll create a working integration that fetches specific CRM data from HubSpot using straightforward Python scripts, demonstrating the power and simplicity of MCP integrations.
Building a Practical Example
Now that we’ve connected Cursor to the HubSpot MCP server and confirmed access, let’s see it in action with a realistic use case. HubSpot MCP is designed to respond to natural-language-style queries and automate actions such as listing contacts, creating notes, or pulling deal summaries. The example below shows how to fetch deals programmatically, but you can also experiment with prompts like:
- “Summarize the last five tickets created for Alex Smith.”
- “List all overdue tasks.”
- “Add a note to Acme Inc. thanking them for their order.”
These are interpreted and handled by the MCP layer running behind the scenes.
Create a functional example to fetch the five most recent deals from your CRM:
import requests
def get_recent_deals(api_key, limit=5):
headers = {'Authorization': f'Bearer {api_key}'}
params = {'limit': limit, 'order': 'createdate'}
response = requests.get('https://api.hubspot.com/crm/v3/objects/deals', headers=headers, params=params)
deals = response.json()
return deals
recent_deals = get_recent_deals(api_key)
for deal in recent_deals['results']:
print(f"Deal: {deal['properties']['dealname']} - Amount: {deal['properties']['amount']}")
Preparing for Debugging and Optimization
Once your integration is functional, the next important step is testing and refining. This is where you’ll catch small errors, optimize performance, and improve the accuracy of the data you’re working with. In this section, we’ll look at how Cursor’s built-in logging and debugging features can help you troubleshoot issues quickly and fine-tune your prompts for better results.
Debugging and Optimization
Utilize Cursor’s debugging tools to streamline troubleshooting:
cursor.log('Fetching recent deals...')
try:
recent_deals = get_recent_deals(api_key)
except Exception as e:
cursor.log_error(f"Error fetching deals: {e}")
Iteratively refine prompts within Cursor to optimize the integration’s performance and accuracy.
Getting Ready to Deploy
With everything working and tested, it's time to think about deployment. Whether you're building this for internal automation or customer-facing tools, you'll want to make sure it's secure, reliable, and easy to maintain. This next section will walk through the key considerations and best practices to follow when putting your integration into production.
Deploying Your MCP Integration
Ensure smooth deployment and maintenance of your integration by:
- Secure API Key Management: Use environment variables or dedicated secret management tools.
- Performance Monitoring: Track integration performance and proactively manage API rate limits.
- Regular Updates: Consistently review and update your integration in line with HubSpot API changes.
Conclusion
In this guide, we walked through every step of building a working MCP integration using Cursor and HubSpot. We started by understanding what Cursor is and how it supports rapid, AI-first development. Then, we covered the basics of HubSpot’s newly released MCP server—what it is, why it matters, and how to explore the available objects and actions. After setting up our HubSpot environment and configuring Cursor, we connected the two systems using simple Python scripts and ran a practical example that fetched real CRM data.
From setup to deployment, the entire process highlights how approachable and powerful it can be to bring conversational AI into your existing business workflows. Whether you're looking to automate common tasks, create smarter assistants, or just make it easier to work with CRM data, this integration is a practical way to get started.
By combining Cursor’s LLM tooling with HubSpot’s structured data access via MCP, you’re building a bridge between language and logic—making your tools more responsive, more intelligent, and more useful every day.