Connect AI Agents to Your Ad Server
Use the AdGlare Model Context Protocol (MCP) server to connect compatible AI assistants and agents to selected AdGlare tools.
Ask questions in natural language and let your AI client call supported AdGlare functions as part of your workflow. Supports Claude Code, Claude Desktop, Cursor, GitHub Copilot, Gemini, and ChatGPT.
MCP provides a standardized way for AI applications to discover tools and invoke them. If you have an AdGlare account, we'll automatically create your personal MCP server. It acts as the connection between the AI client and the AdGlare operations made available to your account.
What is the AdGlare MCP server?
The Model Context Protocol is an open standard that lets AI applications connect to external tools and data. The AdGlare MCP server exposes your ad server as a set of tools an AI agent can discover and call. For example, you can ask:
- “Which of my campaigns are active right now?”
- “Show impressions, clicks and CTR for campaign 12 last week.”
- “Summarize yesterday’s performance and flag anything unusual.”
It works with any MCP-compatible client, so you do not need a custom integration for each AI system.
Quick start
- Get your API key. Log in to AdGlare and open your account Settings to find your API key.
- Find your MCP URL. Every customer has a dedicated endpoint:
Replacehttps://{your_name}.mcp.adglare.app/mcp{your_name}with your AdGlare account name. - Add the server to your AI agent using one of the examples below, with your key sent as a Bearer token.
- Ask a question, for instance “List my active campaigns.”
Authentication with API keys
Every request must include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Requests without a valid key receive an HTTP 401 response. Never paste your key into a chat message or commit it to a code repository.
Available tools
AI agents discover these tools automatically when they connect.
| Tool | What it does | Parameters |
|---|---|---|
list_campaigns | Lists ad campaigns, optionally filtered by status. | status (optional) |
get_campaign_stats | Returns impressions, clicks and CTR for a campaign over a date range. | campaign_id, from, to (dates as YYYY-MM-DD) |
Set up the MCP server in your AI agent
Replace {your_name} and YOUR_API_KEY in each example. Client configuration formats change over time, so check your client’s own MCP documentation if something differs.
Claude Code
claude mcp add --transport http adglare https://{your_name}.mcp.adglare.app/mcp \
--header 'Authorization: Bearer YOUR_API_KEY'
Claude Desktop
Add this to claude_desktop_config.json. It uses the mcp-remote bridge, which requires Node.js.
{
'mcpServers': {
'adglare': {
'command': 'npx',
'args': ['-y', 'mcp-remote', 'https://{your_name}.mcp.adglare.app/mcp',
'--header', 'Authorization:'],
'env': { 'ADGLARE_AUTH': 'Bearer YOUR_API_KEY' }
}
}
}
Cursor
Add to .cursor/mcp.json in your project, or the global Cursor config.
{
'mcpServers': {
'adglare': {
'url': 'https://{your_name}.mcp.adglare.app/mcp',
'headers': { 'Authorization': 'Bearer YOUR_API_KEY' }
}
}
}
VS Code (GitHub Copilot)
Add to .vscode/mcp.json. VS Code asks for the key once and keeps it out of the file.
{
'servers': {
'adglare': {
'type': 'http',
'url': 'https://{your_name}.mcp.adglare.app/mcp',
'headers': { 'Authorization': 'Bearer ${input:adglare-key}' }
}
},
'inputs': [
{ 'type': 'promptString', 'id': 'adglare-key', 'description': 'AdGlare API key', 'password': true }
]
}
Gemini CLI
Add to ~/.gemini/settings.json.
{
'mcpServers': {
'adglare': {
'httpUrl': 'https://{your_name}.mcp.adglare.app/mcp',
'headers': { 'Authorization': 'Bearer YOUR_API_KEY' }
}
}
}
OpenAI API (Responses API)
from openai import OpenAI
client = OpenAI()
response = client.responses.create(
model='YOUR_MODEL',
tools=[{
'type': 'mcp',
'server_label': 'adglare',
'server_url': 'https://{your_name}.mcp.adglare.app/mcp',
'headers': {'Authorization': 'Bearer YOUR_API_KEY'},
'require_approval': 'always',
}],
input='Which AdGlare campaigns are active?',
)
print(response.output_text)
Test your connection
This request should return the list of tools above:
curl -s https://{your_name}.mcp.adglare.app/mcp \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{'jsonrpc':'2.0','id':1,'method':'tools/list'}'
| Problem | Likely cause |
|---|---|
| HTTP 401 | Missing or incorrect API key, or the header is not formatted as Bearer YOUR_API_KEY. |
| HTTP 404 or cannot connect | Wrong account name in the URL, or the path /mcp is missing. |
| No tools appear | Restart your AI client after editing its configuration, and confirm it supports remote HTTP MCP servers. |
Security and best practices
- An agent can only access what your API key can access. Treat the key like a password.
- Store keys in environment variables or your client’s secret storage, not in shared files.
- Revoke or replace a key in your AdGlare settings if it may have been exposed.
- Keep tool approval turned on in your AI client so you can review actions before they run.
- Data returned by tools is sent to the AI provider you use. For maximum control, use a locally hosted model.
Frequently Asked Questions
What is the AdGlare MCP server?
It is a Model Context Protocol (MCP) server that lets AI agents and assistants securely read data from your AdGlare ad server, such as campaigns and performance statistics, using natural language.
What can I do with AdGlare MCP?
Available actions depend on the tools exposed by your AdGlare MCP endpoint. The initial example supports retrieving statistics for a campaign over a date range. Additional tools may be exposed as they become available. Your AI client can only perform operations that the server makes available and authorizes.
How do I authenticate with the AdGlare MCP server?
Use an API key. Find it in the settings of your AdGlare account and send it as a Bearer token in the Authorization header of every request.
What is my AdGlare MCP server URL?
Each customer has a dedicated URL in the format https://{your_name}.mcp.adglare.app/mcp, where {your_name} is your AdGlare account name.
Does AdGlare MCP work with ChatGPT, Claude, Cursor, or Visual Studio Code?
Any AI system that understands MCP, including Claude Code, Claude Desktop, Cursor, VS Code, Gemini CLI, OpenAI ChatGPT, etc.
Is my ad data safe when I use an AI agent?
The agent can only access what your API key allows. Keep the key secret, revoke it in your settings at any time, and remember that data returned by tools is processed by the AI provider you choose.
Can I use a local AI model with AdGlare MCP?
Yes. Any local setup with an MCP-capable client, for example a model running in Ollama, can connect to the same URL with the same API key.
Is the AdGlare MCP server the same as the AdGlare REST API?
No. The AdGlare REST API provides direct HTTP endpoints. MCP is a standardized interface that lets compatible AI clients discover and call selected tools. MCP complements the API; it does not replace it.
Can an AI agent change or delete my AdGlare campaigns?
An AI client can only request operations exposed by the MCP server and permitted by its API Key. Set the MCP server to 'read-only' mode on page Settings => MCP Server to prevent your AI agent from modifying your data.
