Using AI with OptiPub
Using AI with OptiPub
The OptiPub Model Context Protocol (MCP) servers enable AI-powered code editors like Cursor and Windsurf, plus general-purpose tools like Claude Desktop and ChatGPT, to interact directly with the OptiPub platform.
What is MCP?
Model Context Protocol (MCP) is an open standard that allows AI applications to securely access external data sources and tools. OptiPub provides two MCP servers:
| Server | URL | Auth | Purpose |
|---|---|---|---|
| Documentation | https://docs.optipub.com/mcp | None | Search API reference and documentation |
| Platform | https://mcp.optipub.com/functions/v1/mcp-server/mcp?app={domain} | OAuth or Bearer Token | Manage your OptiPub instance |
Documentation MCP
The Documentation MCP gives your AI assistant access to the full OptiPub API reference and documentation. No authentication is required.
Add to ~/.cursor/mcp.json:
{
"mcpServers": {
"optipub-docs": {
"url": "https://docs.optipub.com/mcp"
}
}
}What you can do
- Search the full OptiPub API reference
- Look up endpoint details, parameters, and schemas
- Get code examples for any API operation
- Ask questions about OptiPub features and capabilities
Platform MCP
The Platform MCP gives your AI assistant direct access to manage your OptiPub instance — over 250 tools covering subscribers, segments, messages, pages, funnels, and more.
Prerequisites
- An OptiPub application (e.g.
yourapp.app.optipub.com) - An OptiPub API key (generated from your app's admin panel)
Authentication
The Platform MCP supports two authentication methods:
OAuth (preferred) — Clients like ChatGPT and Claude.ai connect via OAuth automatically. You'll be prompted to enter your API key through a secure authorization form. Tokens refresh automatically so you only authenticate once.
Bearer Token (fallback) — For clients that support custom headers (Cursor, Windsurf, Claude Code), you can pass your API key directly as a Bearer token. This is simpler to configure but requires you to manage the key in your config file.
Replace {your-app-domain} with your app's domain and YOUR_API_KEY with your API key in the examples below.
In ChatGPT settings, add the MCP server URL:
https://mcp.optipub.com/functions/v1/mcp-server/mcp?app=yourapp.app.optipub.comChatGPT will handle OAuth automatically — you'll be prompted to enter your API key through a secure form.
Available tools
| Category | Tools | Examples |
|---|---|---|
| Core | ~80 | Subscribers, tags, groups, domains, templates, webhooks, users |
| Billing | 6 | Pricing plans, Discord roles, discounts |
| Contents | ~55 | Pages, authors, FAQs, forms, videos, resources |
| Marketing | ~50 | Ads, funnels, landing pages, partners, testimonials |
| Messaging | ~60 | Messages, segments, senders, auto responders, transactionals |
Tool parameters
All tools accept the following parameter patterns:
- Path parameters (e.g.
id,segment,email) — required, used to build the API URL params— optional object of query parameters for filtering and paginationbody— optional object (POST/PUT only) containing the request body
For detailed parameter schemas, refer to the OptiPub API documentation.
Using both servers together
For the best experience, connect both MCP servers. Your AI assistant can then reference the API documentation while simultaneously managing your OptiPub instance — for example, looking up the correct parameters for an endpoint and then calling it in a single conversation.
Testing your setup
Once configured, restart your AI editor and try:
- Documentation MCP: "What endpoints are available for managing subscribers?"
- Platform MCP: "How many publications do I have?" or "List my segments"
- Both together: "Look up how to create a landing page, then create one called 'Spring Promo'"
Security
- OAuth 2.1 with PKCE — Industry-standard authentication with 1-hour access tokens and 90-day refresh tokens
- Domain validation — Only valid OptiPub domains are accepted (
*.app.optipub.comand a small set of verified exceptions) - No open proxy — Requests to unrecognized domains are rejected
- Pass-through auth — Your API key is forwarded directly to the OptiPub API and is never stored by the MCP server
Updated 40 minutes ago
