An MCP (Model Context Protocol) server connects Claude, ChatGPT, or other AI models to your marketing tools. Build one that queries your Attio CRM, pulls analytics from Google Analytics, or executes campaigns in HubSpot—all from within Claude. This tutorial covers architecture, a complete code example, and deployment.
An MCP (Model Context Protocol) server is a lightweight application that sits between an AI model (Claude, ChatGPT, etc.) and your APIs or data sources. It defines "tools" that the AI can call. When you ask Claude "Query our top 10 deals from Attio," the MCP server receives that request, calls the Attio API, and returns the result to Claude.
Think of it as a translator: Your AI model speaks in natural language. Your API expects structured requests. The MCP server does the translation—and handles authentication, error handling, rate limiting, and logging.
MCP servers are not new (they've existed for 10+ years as "custom actions" or "API integrations"), but they're newly popular because AI models got smarter at using them. Claude can now call 5-10 tools in sequence, chain results together, and reason about them—which makes a well-designed MCP server incredibly powerful.
1. Automate decision-making. Instead of manually querying your CRM to check a prospect's engagement level, ask Claude "What's the sales engagement score for Acme Corp?" Claude calls your MCP server, which queries Attio, and returns the answer with context.
2. Chain operations together. "Pull top 10 deals from Attio, get their company data from Crunchbase, and draft outreach emails." This requires 3 API calls and integration logic. Your MCP server handles it.
3. Scale your team's capabilities. Every marketer on your team gets access to a personal AI that knows your entire marketing stack. No API documentation needed. No command-line tools. Just natural language.
4. Build custom marketing agents. A marketing agent is an AI that runs autonomously, using your MCP server to make decisions, execute campaigns, and report results. This is the future of marketing operations.
Host (Claude, ChatGPT, etc.)
↓ (natural language request)
MCP Client (handles transport, serialization)
↓ (JSON-RPC protocol)
MCP Server (your application)
↓ (executes tool, calls API)
External API (Attio, Google Analytics, HubSpot, etc.)
↓ (returns data)
MCP Server (formats response)
↓ (JSON-RPC response)
MCP Client
↓ (Claude reads result)
Host (generates answer)
The key: Your MCP server doesn't know about Claude directly. It just listens for RPC requests and responds with results. The MCP client handles the Claude integration.
Technical: Node.js 18+ or Python 3.8+, basic REST API knowledge, API credentials for your target platform (Attio, Google Analytics, HubSpot).
Knowledge: Understand how your target API works (read its docs for 30 minutes). Understand JSON and REST. You don't need to be a professional developer—marketing technologists with Python/JavaScript experience can build MCP servers.
Create a `.env` file for your API credentials:
An MCP server exposes "tools" that Claude can call. Example tools for a marketing MCP:
Your MCP server is now running. It listens on stdin for RPC requests.
In your Claude prompt or Claude desktop app, point to your MCP server:
Claude will now be able to call your tools directly.
Local (simplest): Run on your machine. Claude desktop app connects to localhost. Good for personal use or small teams.
Docker (recommended for teams): Containerize your MCP server. Deploy to AWS ECS, Google Cloud Run, or Heroku. All team members connect to the same endpoint. Scales automatically.
AWS Lambda: Serverless deployment. Good for occasional use (low cost). Cold starts can be slow (2-5 seconds).
Vercel Functions: Similar to Lambda, but easier to deploy from Git. Good for SaaS/web-based use cases.
API key management. Never hardcode API keys. Use environment variables or secrets management (AWS Secrets Manager, HashiCorp Vault). Rotate keys regularly.
Rate limiting. If Claude makes 100 API calls in 1 minute, you'll hit rate limits. Implement queuing and backoff logic in your handlers.
Audit logging. Log all tool calls (user, timestamp, action, result). This is critical for compliance and debugging.
Permission scoping. Grant your MCP server the minimum API permissions it needs. If it only reads deals, don't give it write access to the entire CRM.
Start with one tool (e.g., get_deals_from_attio). Get it working. Then add more tools incrementally: get_company_info, analyze_engagement, draft_email, send_email, log_to_crm.
Once you have 5+ tools working together, you've effectively built a marketing agent—an AI that can autonomously query your stack, make decisions, and take actions.
From there, you can build workflow automations: "Every morning, pull deals at risk, analyze why they're stalling, and draft win-back emails."
Tools: get_aeo_insights (queries our analytics), check_ai_visibility (pings ChatGPT/Claude to see if we're cited), get_client_status (queries Attio), draft_audit_report (uses Claude's native capabilities + our data).
Use case: When a prospect books an audit call, our team runs: "Generate audit brief for [company name]." The MCP server pulls their website, queries AI visibility, checks our CRM for prior notes, and drafts a 1-page briefing document.
Result: Sales team has context in 30 seconds instead of 15 minutes of manual research. Proposals are more personalized. Close rate improved 24%.
No. If you can read API documentation and understand JSON, you can build a basic MCP server in 2-4 hours. The TypeScript/Python knowledge required is minimal.
Yes. Your server can call Attio, Google Analytics, HubSpot, Crunchbase, and any other API simultaneously. That's the whole point.
MCP servers are AI-native. Claude orchestrates them naturally ("pull deals and draft emails"). Zapier/Make require explicit workflow setup. MCP servers are better for knowledge work; Zapier is better for simple, repeating workflows.
Yes. You can build a commercial MCP server and sell it to marketing teams (e.g., "MCP server for HubSpot users"). This is an emerging market.
Ask Claude to help. Paste your API docs (or lack thereof) into Claude and ask "How would I query X?" Claude often reverse-engineers APIs faster than you can read docs.
Want to build a custom MCP server for your marketing stack? Book a free consultation with our MCP specialists.