Gemini CLI can talk to external services through the Model Context Protocol (MCP), an open standard that lets AI tools call outside systems as if they were built-in features. This guide connects Gemini CLI to AdStellar as a remote MCP server, giving you a working meta ads mcp for gemini cli setup. When you finish, you can analyze performance, build campaigns, and launch ads from your terminal with plain-language prompts.
Before you start, you need Gemini CLI installed, an AdStellar account with your Meta ad account connected, and enough comfort with JSON to edit one config file.
Step 1: Confirm Gemini CLI and your AdStellar account are ready
Open a terminal and run the version command:
- Run gemini --version. If the command is not found, install Gemini CLI from Google's official documentation first.
- Compare your version against the latest release. If yours is old, update it. MCP support and the settings syntax have changed between releases, so an outdated install is the most common source of confusing errors.
- Skim the current Gemini CLI documentation on MCP servers before moving on. The file locations and field names in the next steps reflect the documentation as of November 2026, and you should confirm them against what you see.
Next, log in to AdStellar and check that your workspace has a Meta ad account connected. The MCP server can only act on data AdStellar can see, so if the connection is missing or expired, every prompt later will return empty or partial answers. Fix it now rather than debugging it from the terminal. If you are still evaluating the product, the Meta ads platform trial period guide explains what to expect before you commit.
Mistake to avoid: testing on a live account with large budgets. A first run is when you learn how prompts translate into actions, and you do not want to learn that with real spend at stake. AdStellar supports unlimited workspaces, so create a dedicated workspace for testing, or point it at a small-budget ad account. Once you trust the behavior, switch to your main workspaces.
Step 2: Locate your Gemini CLI settings file
Gemini CLI reads its MCP servers from a settings.json file, under a top-level key called mcpServers. As of November 2026, there are two places this file can live:
- User-level: a .gemini folder in your home directory, so the full path is ~/.gemini/settings.json. Servers defined here are available in every project you open.
- Project-level: a .gemini folder inside a project directory, giving .gemini/settings.json. Servers defined here apply only when you run Gemini CLI from that folder.
Verify both paths against the current Gemini CLI configuration docs, since they are the details most likely to shift between releases.
Choosing between the two
If you manage one business, user-level is simplest: AdStellar is available wherever you open a terminal. If you work with several clients, project-level is safer. Keep one folder per client, each with its own settings file, and you will never ask a question about the wrong account because you ran it from the wrong directory. Agencies in particular tend to prefer this setup, and the same logic applies to a multi-account Meta ads platform workflow.
Create and back up the file
If the .gemini folder or settings.json does not exist, create it. If a settings file already exists, copy it to something like settings.json.bak before you touch it. The file may hold theme, auth, or other MCP server settings you will want to keep, and a backup makes any mistake a ten-second fix.
Step 3: Add AdStellar as a remote HTTP MCP server
Open your settings file and add an adstellar entry under mcpServers. If the file is new, this is the whole thing:
{
"mcpServers": {
"adstellar": {
"httpUrl": "https://app.adstellar.ai/api/mcp"
}
}
}
That endpoint is the only URL you need. There are no API keys or custom headers to add here, so do not paste in anything beyond what is shown.
Remote HTTP versus local stdio
Many MCP servers are local stdio servers: Gemini CLI launches a program on your machine and talks to it through standard input and output, which means installing packages and keeping a process running. A remote HTTP server works differently. AdStellar hosts the server, and Gemini CLI simply connects to the endpoint over HTTP. Nothing to install, nothing to run locally, nothing to keep updated on your side.
Common errors
- Invalid JSON. A trailing comma after the last property, a missing quote, or an unclosed brace will stop the whole file from loading. Paste the file into a JSON validator if anything misbehaves.
- Duplicate mcpServers keys. If your file already has an mcpServers block, add adstellar inside it as a new entry, separated by a comma from the others. A second mcpServers key can override the first and silently drop your existing servers.
- Using url instead of httpUrl. In Gemini CLI, url is for SSE transport and httpUrl is for streamable HTTP. Confirm the field name in the current docs, and use httpUrl for this setup.
Save the file once it validates.
Step 4: Restart Gemini CLI and authorize the connection
Settings are read when a session starts, so exit any running Gemini CLI session and launch a new one from the folder where your settings file applies. If you used a project-level file, make sure you start it from that project directory.
Inside the session, run the /mcp command. It opens the MCP status view, which lists each configured server, its connection state, and the tools it exposes. You want to see adstellar marked as connected, with a list of tools beneath it. That list is your proof that the server is reachable and that Gemini CLI can call it.
If you are asked to sign in
Remote servers often require authorization before they hand over data. If Gemini CLI or the server prompts you to sign in, complete it in the browser with your AdStellar account, then return to the terminal. The exact flow can differ by Gemini CLI version and may change on the AdStellar side, so follow the on-screen prompts and the current docs rather than expecting a fixed sequence of screens.
Troubleshooting
- Server shows as disconnected. Check the URL character by character against https://app.adstellar.ai/api/mcp. Then validate the JSON, and confirm that a corporate proxy or firewall is not blocking outbound HTTPS to the endpoint.
- Connected, but the tools list is empty. Re-authorize the connection, quit Gemini CLI completely, and start a fresh session. Also confirm your AdStellar account has a Meta ad account connected (Step 1).
- Nothing about adstellar appears at all. You are likely running Gemini CLI from a folder that does not use the settings file you edited. Check which level you configured.
Step 5: Run a read-only prompt to verify real Meta data
Your first prompt should only read, never change anything. Analysis is the safest way to confirm the pipeline works end to end:
Using AdStellar, summarize my Meta ad performance for the last 7 days and flag my top and bottom ads by ROAS.
Gemini CLI may ask permission before calling an AdStellar tool. Approve it for this run and watch the response.
What a good response looks like
A good answer contains figures from your actual account: real ad names, spend, ROAS, and a ranked top and bottom. A bad answer is generic advice about how to read ROAS, or numbers that look plausible but name nothing you recognize. If you get the latter, the tools were probably not called, so go back to /mcp and check the connection.
Spot-check at least two or three numbers against Meta Ads Manager for the same date range. Small differences can come from attribution windows and reporting delays, but the ads and the general magnitude should line up. If they do not, tell the model which account and window you meant and ask again. For a refresher on what each figure means, see Meta ads performance metrics explained.
A follow-up on creative fatigue
Once the basics check out, go deeper:
Which creatives in my active campaigns show signs of fatigue, and why? Use the last 14 days and treat ROAS as the goal metric.
This draws on AdStellar's creative analytics and fatigue detection, which score ad elements and flag creatives whose performance is declining. Ask for the reasoning so you can judge it yourself. If results are slipping broadly, the guide on Meta ads performance declining covers the usual causes.
Tip: name the account, the date range, and the goal metric in every prompt. "How are my ads doing?" invites a vague answer. "For the test workspace, over the last 7 days, rank ads by ROAS" does not.
Step 6: Prompt Gemini CLI to build and launch a Meta campaign
Creating works best when the prompt carries the same inputs a media buyer would brief a colleague with: objective, product, audience, budget, and creative direction. For example:
Using AdStellar, build a conversion campaign for our best-selling product in the test workspace. Base it on my past performance, target US women 25 to 44, set a daily budget of $30, and use UGC-style video creative. Explain your reasoning for the audience, budget split, and creative choices. Do not launch yet; show me the draft.
AdStellar shows the reasoning behind each campaign it builds, so you can interrogate it. Follow up with "Why did you choose this audience?" or "What past ads informed this creative direction?" If an answer does not hold up against what you know about your customers, say so and ask for a revision. To sharpen the audience portion of your prompts, read about an AI targeting strategy for Meta ads.
Bulk variations and reusing winners
Two prompts worth keeping close:
- Create variations of my top ad using 5 headlines and 4 creatives, then summarize the combinations before launching.
- Pull my top three winning creatives from the creative library and build a new ad set around them for a lookalike audience. Show me the plan first.
Guardrails before launch
The MCP server does not replace your judgment, and vague prompts produce vague campaigns. Make a habit of asking for a draft or summary first, then check the budget, audience, and creative before you reply with an explicit go-ahead. Set limits in the prompt itself: a maximum daily budget, a maximum number of ads, a specific workspace. Avoid open-ended instructions like "launch everything", which hand over decisions you would never delegate to a new hire on day one.
Step 7: Save reusable prompts and set up an optimization routine
Once a prompt works, stop retyping it. Gemini CLI supports a project context file, conventionally named GEMINI.md as of November 2026 (confirm the file name in the current docs). It is loaded into the session as standing instructions. Put the details you would otherwise repeat in it:
- The AdStellar workspace and ad account to use
- Your target ROAS or CPA, and what counts as underperforming
- Naming conventions for campaigns, ad sets, and ads
- Budget ceilings and the rule that nothing launches without your confirmation
For agencies, one context file per client folder pairs naturally with project-level settings from Step 2, and it supports the broader process of scaling Meta ads for agencies.
Routine prompts to reuse
- Daily check: "Summarize yesterday's spend, ROAS, and CPA against my targets and flag anything off by more than 20%."
- Weekly creative refresh: "List creatives showing fatigue, propose replacements based on my top performers, and show a draft before launching."
- Pause-or-scale review: "Compare each ad set to my target CPA over the last 7 days. Recommend pause, hold, or scale, with reasons, and make no changes until I approve."
If you use Cometly attribution with AdStellar, ask Gemini CLI to factor that data into these reviews, since attribution can change which ads look like winners. In every routine, ask for decisions to be explained before changes are made. That keeps you as the media buyer and the model as the analyst. Teams that want to go further can explore automated budget optimization for Meta ads.
Start small, then widen the scope
Two checks tell you the setup is sound: /mcp shows adstellar as connected with its tools listed, and a read-only prompt returns numbers that match Meta Ads Manager. If both hold, run your first launch with a small budget in your test workspace, review the draft, and compare the result to what you expected. Expand to larger budgets and more workspaces as your prompts and context file prove reliable.



