Docs · Install · Grok CLI

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.

Last tested with AdRails 0.2.2 · Python 3 · config format checked against xAI Grok MCP docs, docs.x.ai/build/features/mcp-servers on 2026-11-03 · Apache-2.0 · local stdio
What you need first

Before you register the server

  • Grok CLI installed and working, and Python 3 with pipx or uvx.
  • 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 diff is the change review.
Steps

Four steps to a first validated plan

  1. 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.

    shell
    pipx install git+https://github.com/antonioac1/adrails
    python3 -m adsops --selftest
  2. Register the server

    grok mcp add takes a name, then --, then the command. Add --scope project if the entry should live in the repository's .grok/config.toml.

    shell · Grok CLI
    grok 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
  3. Or write config.toml by hand

    The equivalent entry in ~/.grok/config.toml (or .grok/config.toml in a project) is a [mcp_servers.adrails] table with command and args.

    ~/.grok/config.toml
    [mcp_servers.adrails]
    command = "python3"
    args = ["-m", "adsops", "--config", "/absolute/path/config.json"]
  4. Verify, then ask for a plan

    grok mcp doctor adrails diagnoses the configuration and whether the server starts. In the Grok UI, /mcps opens the extensions modal to toggle and refresh servers. When it is healthy, ask the agent to call adsops_campaigns, adsops_status and adsops_plan and 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.

Troubleshooting

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.

FAQ

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.