(basic)
- getProperties - Get the list of all groups that are available on any hubspot object.
- getCompany - Retrieve a company
- updateCompany - Update a company
- getContact - Retrieve a contact
- updateContact - Update a contact
- createContact - Create a contact
- getDeal - Read
- updateDeal - Update
- createDeal - Create
Get the list of all properties that are available on any hubspot object.
import { Hubspot } from "mcp-hubspot";
const hubspot = new Hubspot({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const result = await hubspot.basic.getProperties({
objectType: "deals",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { HubspotCore } from "mcp-hubspot/core.js";
import { basicGetProperties } from "mcp-hubspot/funcs/basicGetProperties.js";
// Use `HubspotCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const hubspot = new HubspotCore({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const res = await basicGetProperties(hubspot, {
objectType: "deals",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetPropertiesRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.GetPropertiesResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 4XX, 5XX | */* |
Retrieve a company by its ID (companyId
) or by a unique property (idProperty
). You can specify what is returned using the properties
query parameter.
import { Hubspot } from "mcp-hubspot";
const hubspot = new Hubspot({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const result = await hubspot.basic.getCompany({
companyId: "<id>",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { HubspotCore } from "mcp-hubspot/core.js";
import { basicGetCompany } from "mcp-hubspot/funcs/basicGetCompany.js";
// Use `HubspotCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const hubspot = new HubspotCore({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const res = await basicGetCompany(hubspot, {
companyId: "<id>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetCompanyRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.GetCompanyResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 4XX, 5XX | */* |
Update a company by ID (companyId
) or unique property value (idProperty
). Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.
import { Hubspot } from "mcp-hubspot";
const hubspot = new Hubspot({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const result = await hubspot.basic.updateCompany({
companyId: "<id>",
simplePublicObjectInput: {
properties: {
"property_date": "1572480000000",
"property_radio": "option_1",
"property_number": "17",
"property_string": "value",
"property_checkbox": "false",
"property_dropdown": "choice_b",
"property_multiple_checkboxes": "chocolate;strawberry",
},
},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { HubspotCore } from "mcp-hubspot/core.js";
import { basicUpdateCompany } from "mcp-hubspot/funcs/basicUpdateCompany.js";
// Use `HubspotCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const hubspot = new HubspotCore({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const res = await basicUpdateCompany(hubspot, {
companyId: "<id>",
simplePublicObjectInput: {
properties: {
"property_date": "1572480000000",
"property_radio": "option_1",
"property_number": "17",
"property_string": "value",
"property_checkbox": "false",
"property_dropdown": "choice_b",
"property_multiple_checkboxes": "chocolate;strawberry",
},
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.UpdateCompanyRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.UpdateCompanyResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 4XX, 5XX | */* |
Retrieve a contact by its ID (contactId
) or by a unique property (idProperty
). You can specify what is returned using the properties
query parameter.
import { Hubspot } from "mcp-hubspot";
const hubspot = new Hubspot({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const result = await hubspot.basic.getContact({
contactId: "<id>",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { HubspotCore } from "mcp-hubspot/core.js";
import { basicGetContact } from "mcp-hubspot/funcs/basicGetContact.js";
// Use `HubspotCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const hubspot = new HubspotCore({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const res = await basicGetContact(hubspot, {
contactId: "<id>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetContactRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.GetContactResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 4XX, 5XX | */* |
Update a contact by ID (contactId
) or unique property value (idProperty
). Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.
import { Hubspot } from "mcp-hubspot";
const hubspot = new Hubspot({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const result = await hubspot.basic.updateContact({
contactId: "<id>",
simplePublicObjectInput: {
properties: {
"property_date": "1572480000000",
"property_radio": "option_1",
"property_number": "17",
"property_string": "value",
"property_checkbox": "false",
"property_dropdown": "choice_b",
"property_multiple_checkboxes": "chocolate;strawberry",
},
},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { HubspotCore } from "mcp-hubspot/core.js";
import { basicUpdateContact } from "mcp-hubspot/funcs/basicUpdateContact.js";
// Use `HubspotCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const hubspot = new HubspotCore({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const res = await basicUpdateContact(hubspot, {
contactId: "<id>",
simplePublicObjectInput: {
properties: {
"property_date": "1572480000000",
"property_radio": "option_1",
"property_number": "17",
"property_string": "value",
"property_checkbox": "false",
"property_dropdown": "choice_b",
"property_multiple_checkboxes": "chocolate;strawberry",
},
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.UpdateContactRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.UpdateContactResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 4XX, 5XX | */* |
Create a single contact. Include a properties
object to define property values for the contact, along with an associations
array to define associations with other CRM records.
import { Hubspot } from "mcp-hubspot";
const hubspot = new Hubspot({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const result = await hubspot.basic.createContact({
associations: [
{
types: [
{
associationCategory: "HUBSPOT_DEFINED",
associationTypeId: 2,
},
],
to: {
id: "101",
},
},
],
properties: {
"amount": "1500.00",
"dealname": "Custom data integrations",
"pipeline": "default",
"closedate": "2019-12-07T16:50:06.678Z",
"dealstage": "presentationscheduled",
"hubspot_owner_id": "910901",
},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { HubspotCore } from "mcp-hubspot/core.js";
import { basicCreateContact } from "mcp-hubspot/funcs/basicCreateContact.js";
// Use `HubspotCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const hubspot = new HubspotCore({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const res = await basicCreateContact(hubspot, {
associations: [
{
types: [
{
associationCategory: "HUBSPOT_DEFINED",
associationTypeId: 2,
},
],
to: {
id: "101",
},
},
],
properties: {
"amount": "1500.00",
"dealname": "Custom data integrations",
"pipeline": "default",
"closedate": "2019-12-07T16:50:06.678Z",
"dealstage": "presentationscheduled",
"hubspot_owner_id": "910901",
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.SimplePublicObjectInputForCreate | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.CreateContactResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 4XX, 5XX | */* |
Read a Deal Object identified by {dealId}
. {dealId}
refers to the internal object ID by default, or optionally any unique property value as specified by the idProperty
query param. Control what is returned via the properties
query param.
import { Hubspot } from "mcp-hubspot";
const hubspot = new Hubspot({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const result = await hubspot.basic.getDeal({
dealId: "<id>",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { HubspotCore } from "mcp-hubspot/core.js";
import { basicGetDeal } from "mcp-hubspot/funcs/basicGetDeal.js";
// Use `HubspotCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const hubspot = new HubspotCore({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const res = await basicGetDeal(hubspot, {
dealId: "<id>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.GetDealRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.GetDealResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 4XX, 5XX | */* |
Perform a partial update of an Object identified by {dealId}
. {dealId}
refers to the internal object ID by default, or optionally any unique property value as specified by the idProperty
query param. Provided property values will be overwritten. Read-only and non-existent properties will be ignored. Properties values can be cleared by passing an empty string.
import { Hubspot } from "mcp-hubspot";
const hubspot = new Hubspot({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const result = await hubspot.basic.updateDeal({
dealId: "<id>",
simplePublicObjectInput: {
properties: {
"property_date": "1572480000000",
"property_radio": "option_1",
"property_number": "17",
"property_string": "value",
"property_checkbox": "false",
"property_dropdown": "choice_b",
"property_multiple_checkboxes": "chocolate;strawberry",
},
},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { HubspotCore } from "mcp-hubspot/core.js";
import { basicUpdateDeal } from "mcp-hubspot/funcs/basicUpdateDeal.js";
// Use `HubspotCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const hubspot = new HubspotCore({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const res = await basicUpdateDeal(hubspot, {
dealId: "<id>",
simplePublicObjectInput: {
properties: {
"property_date": "1572480000000",
"property_radio": "option_1",
"property_number": "17",
"property_string": "value",
"property_checkbox": "false",
"property_dropdown": "choice_b",
"property_multiple_checkboxes": "chocolate;strawberry",
},
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.UpdateDealRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.UpdateDealResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 4XX, 5XX | */* |
Create a deal with the given properties and return a copy of the object, including the ID. Documentation and examples for creating standard deals is provided.
import { Hubspot } from "mcp-hubspot";
const hubspot = new Hubspot({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const result = await hubspot.basic.createDeal({
associations: [
{
types: [
{
associationCategory: "HUBSPOT_DEFINED",
associationTypeId: 2,
},
],
to: {
id: "101",
},
},
],
properties: {
"amount": "1500.00",
"dealname": "Custom data integrations",
"pipeline": "default",
"closedate": "2019-12-07T16:50:06.678Z",
"dealstage": "presentationscheduled",
"hubspot_owner_id": "910901",
},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { HubspotCore } from "mcp-hubspot/core.js";
import { basicCreateDeal } from "mcp-hubspot/funcs/basicCreateDeal.js";
// Use `HubspotCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const hubspot = new HubspotCore({
hubspotToken: process.env["HUBSPOT_HUBSPOT_TOKEN"] ?? "",
});
async function run() {
const res = await basicCreateDeal(hubspot, {
associations: [
{
types: [
{
associationCategory: "HUBSPOT_DEFINED",
associationTypeId: 2,
},
],
to: {
id: "101",
},
},
],
properties: {
"amount": "1500.00",
"dealname": "Custom data integrations",
"pipeline": "default",
"closedate": "2019-12-07T16:50:06.678Z",
"dealstage": "presentationscheduled",
"hubspot_owner_id": "910901",
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.SimplePublicObjectInputForCreate | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.CreateDealResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.APIError | 4XX, 5XX | */* |