Integrations
HubSpot
Manage contacts, companies, deals, and tickets
The HubSpot integration provides access to HubSpot's CRM API through the Integrate MCP server.
Installation
The HubSpot integration is included with the SDK:
import { hubspotIntegration } from "integrate-sdk/server";Setup
1. Create a HubSpot App
- Go to HubSpot Developer Apps
- Create a new app
- Configure OAuth settings and scopes
- Note your Client ID and Client Secret
2. Configure the Integration on Your Server
Add the HubSpot integration to your server configuration. The integration automatically reads HUBSPOT_CLIENT_ID and HUBSPOT_CLIENT_SECRET from your environment variables:
import { createMCPServer, hubspotIntegration } from "integrate-sdk/server";
export const { client: serverClient } = createMCPServer({
apiKey: process.env.INTEGRATE_API_KEY,
integrations: [
hubspotIntegration({
scopes: [
"crm.objects.contacts.read",
"crm.objects.contacts.write",
"crm.objects.companies.read",
"crm.objects.companies.write",
"crm.objects.deals.read",
"crm.objects.deals.write",
"tickets",
], // Optional
}),
],
});You can override the environment variables by passing explicit values:
hubspotIntegration({
clientId: process.env.CUSTOM_HUBSPOT_ID,
clientSecret: process.env.CUSTOM_HUBSPOT_SECRET,
scopes: ["crm.objects.contacts.read", "crm.objects.contacts.write"],
});3. Client-Side Usage
The default client automatically includes all integrations. You can use it directly:
import { client } from "integrate-sdk";
await client.authorize("hubspot");
const contacts = await client.hubspot.listContacts({});If you're using a custom client, add the integration to the integrations array:
import { createMCPClient, hubspotIntegration } from "integrate-sdk";
const customClient = createMCPClient({
integrations: [hubspotIntegration()],
});Configuration Options
Prop
Type
Available Tools
Contacts
hubspot_list_contacts- List contactshubspot_get_contact- Get a specific contacthubspot_create_contact- Create a new contacthubspot_update_contact- Update a contact
Companies
hubspot_list_companies- List companieshubspot_get_company- Get a specific companyhubspot_create_company- Create a new company
Deals
hubspot_list_deals- List dealshubspot_get_deal- Get a specific dealhubspot_create_deal- Create a new deal
Tickets
hubspot_list_tickets- List support ticketshubspot_get_ticket- Get a specific ticket
Examples
Create a Contact
const result = await client.hubspot.createContact({
properties: {
email: "contact@example.com",
firstname: "Jane",
lastname: "Doe",
phone: "+1-555-0123",
company: "Acme Corp",
},
});
console.log("Contact created:", result);List Deals
const result = await client.hubspot.listDeals({
limit: 50,
properties: ["dealname", "amount", "dealstage"],
});
console.log("Deals:", result);Create a Company
const result = await client.hubspot.createCompany({
properties: {
name: "New Company Inc",
domain: "newcompany.com",
industry: "Technology",
},
});
console.log("Company created:", result);OAuth Scopes
The default scopes provide CRM access. You may need different scopes:
crm.objects.contacts.read- Read contactscrm.objects.contacts.write- Create and update contactscrm.objects.companies.read- Read companiescrm.objects.companies.write- Create and update companiescrm.objects.deals.read- Read dealscrm.objects.deals.write- Create and update dealstickets- Access support ticketscrm.objects.owners.read- Read owners
Error Handling
try {
const result = await client.hubspot.createContact({
properties: {
email: "contact@example.com",
firstname: "Jane",
},
});
} catch (error) {
if (error.message.includes("already exists")) {
console.error("Contact already exists");
} else if (error.message.includes("authentication")) {
console.error("Authentication failed");
} else {
console.error("Unexpected error:", error);
}
}Next Steps
- Explore the Zendesk Integration
- Explore the Intercom Integration
- See Advanced Usage for more examples