Install AdRails with the Grok CLIgrok mcp add and grok mcp doctor · adrails.dev
Direct answer. Run grok mcp add adrails -- python3 -m adsops --config /absolute/path/config.json, then grok mcp doctor adrails. Everything after -- is the local command Grok starts over stdio. Add --scope project to write the entry to .grok/config.toml in the current directory instead of your user config. There is no URL and no AdRails account.
Before you register the server
- Grok CLI installed and working, and Python 3 with
pipxoruvx. - Your own Google Ads API access: a Cloud project with the Google Ads API enabled, a developer token, and a service account added to the account. AdRails has no hosted proxy.
- A git repository for the desired-state and policy files;
git diffis the change review.
Four steps to a first validated plan
- Install the package and write the config
Install
adsops, run the offline self test, then write the config and policy file as in the Claude Code install guide, steps 1 to 3. Those steps are the same for every client.shellpipx install git+https://github.com/antonioac1/adrails python3 -m adsops --selftest
- Register the server
grok mcp addtakes a name, then--, then the command. Add--scope projectif the entry should live in the repository's.grok/config.toml.shell · Grok CLIgrok mcp add adrails -- python3 -m adsops --config /absolute/path/config.json # or, project-scoped: grok mcp add --scope project adrails -- python3 -m adsops --config /absolute/path/config.json - Or write config.toml by hand
The equivalent entry in
~/.grok/config.toml(or.grok/config.tomlin a project) is a[mcp_servers.adrails]table withcommandandargs.~/.grok/config.toml[mcp_servers.adrails] command = "python3" args = ["-m", "adsops", "--config", "/absolute/path/config.json"]
- Verify, then ask for a plan
grok mcp doctor adrailsdiagnoses the configuration and whether the server starts. In the Grok UI,/mcpsopens the extensions modal to toggle and refresh servers. When it is healthy, ask the agent to calladsops_campaigns,adsops_statusandadsops_planand to commit nothing.
The server speaks JSON-RPC 2.0 over stdio and sends diagnostics to stderr. Leave commit_policy.allow_commit at its default of false on a live account until you have read a few plans. Running beside Google's read-only server is covered in AdRails alongside Google's Ads MCP.
When it does not take
doctor says the server did not start
Run python3 -m adsops --selftest in the same shell, then the full command with your config path. Read ~/.grok/logs/mcp/adrails.stderr.log.
I need an environment variable for the server
Grok's documented route is an env table in config.toml, where ${VAR} expands at load time. AdRails itself reads credentials from its config file.
Refusals such as plan_id required or outside guard range are the rails working; see what the guardrails do and don't prevent.
Grok CLI questions
Does Grok pick up an AdRails entry I added for Claude Code or Cursor?
Yes. Grok also reads ~/.claude.json, .cursor/mcp.json and project .mcp.json files; its own config.toml takes priority over them.
Where do I find Grok's logs for AdRails?
For a stdio server that starts but fails to connect, Grok captures stderr to ~/.grok/logs/mcp/adrails.stderr.log. AdRails writes diagnostics to stderr, never to the protocol stream.
Is there a hosted AdRails URL for Grok?
No. AdRails runs on your machine with your own Google Cloud project. See why there is no remote URL.