HubSpot
Give agents tools to search, create, and update contacts, companies, deals, and tickets, and manage notes, tasks, and marketing emails in HubSpot through Mastra Connect. Each tool call goes through the Mastra platform, which adds the connection's credential. Your application never stores HubSpot credentials.
ConnectDirect link to Connect
Before you start, complete the Connect setup to install @mastra/connect and configure your platform project.
Connect an accountDirect link to Connect an account
Run this command from the directory that contains your .env file:
mastra connect add hubspot
The CLI guides you through HubSpot's authorization and waits until the connection is active.
Add tools to an agentDirect link to Add tools to an agent
Pass tools() to the agent and select the hubspot provider:
import { Agent } from '@mastra/core/agent'
import { tools } from '@mastra/connect'
export const hubspotAgent = new Agent({
id: 'hubspot-agent',
name: 'HubSpot agent',
instructions:
'You help people search, create, and update contacts, companies, deals, and tickets, and manage notes, tasks, and marketing emails in HubSpot.',
model: 'openai/gpt-6-luna',
tools: tools({ providers: ['hubspot'] }),
})
The agent gets 50 HubSpot tools, with keys such as hubspot_batch_create_companies. See HubSpot tools for the full list, and the tools() parameters to restrict tools or require approval before a call runs.