I Built an MCP Server to Create HubSpot Marketing Emails with Claude
Source: Dev.to
Introduction
Creating newsletters regularly is surprisingly time‑consuming: logging into HubSpot, picking a template, thinking of a subject line, and writing the body. I wanted to offload this repetitive work to AI, so I built a Model Context Protocol (MCP) server that lets Claude interact directly with HubSpot’s marketing email API. The project is open‑sourced on GitHub.
Features
- List marketing emails
- Get email details
- Create email drafts
- Update existing emails
Note: The server does not include email‑sending functionality to prevent accidental sends.
Setup
-
Install dependencies
npm install -
Get a HubSpot access token
- Log in to your HubSpot account.
- Navigate to Development > Legacy Apps (開発 > 旧アプリ).
- Create a new app and set the required scope:
content(for Marketing Emails). - Copy the generated access token (format
pat-na1-…).
-
Build the server
npm run build -
Configure Claude Desktop
Edit
~/Library/Application Support/Claude/claude_desktop_config.jsonand add the MCP server definition:{ "mcpServers": { "hubspot-email": { "command": "npx", "args": ["-y", "/path/to/hubspot-email-mcp"], "env": { "HUBSPOT_ACCESS_TOKEN": "your-access-token" } } } } -
Restart Claude Desktop
After saving the config, restart Claude Desktop to load the new MCP server.
Usage
Once the MCP server is running, you can interact with HubSpot purely through conversation with Claude Desktop.
-
Create a newsletter
Create a newsletter in HubSpot announcing our new product. Subject: Introducing Product A Body: We're excited to announce the release of Product A... -
List recent emails
Show me the emails I created last week. -
Check an email’s content
Check the content of email ID 12345.
Claude will call the MCP server behind the scenes to perform the requested actions. After the draft is ready, you perform a final review and send the email manually from HubSpot’s dashboard.
Future Plans
I’m planning to add WordPress integration so that published blog posts can automatically generate newsletter drafts:
“Publish a blog post, and a newsletter draft is already waiting for you.”
This would create a fully automated workflow for content marketing, reducing the operational burden significantly.
Repository
The source code, detailed setup instructions, and additional documentation are available on GitHub:
If you find the project useful, please consider starring the repository!