Skip to main content

Connect Claude Code or Codex to DatAds

Add the DatAds MCP server to Claude Code or the Codex CLI with one command, sign in in the browser and query your ad data.

Written by Daniel von Mirbach

Connect Claude Code or Codex to DatAds to ask about your ad data and reports from your terminal or code editor. Both tools connect to the DatAds MCP server and sign you in with your DatAds account in the browser.

Who can use this

  • Plans: DatAds Regular and Custom, the legacy Plus and Pro plans, and the free trial. Not available on Lite and the legacy Starter plan.

  • Roles: Any DatAds role that can open a client. Visitors can read data but can't change anything in DatAds.

  • Tools: Claude Code (terminal and IDE extension), and Codex: the Codex CLI, the Codex IDE extension and the ChatGPT desktop app, which share one Codex configuration.

  • Platforms: Meta, TikTok, Google Ads

Before you connect Claude Code or Codex to DatAds

Connecting Claude Code or Codex to DatAds needs these things:

  • Claude Code or the Codex CLI, installed and signed in.

  • A DatAds account in a workspace on one of the plans above.

  • A browser on the same computer for the DatAds sign-in. On a remote computer without a browser, see the troubleshooting section of this article.

The DatAds server URL is https://mcp.datads.io/mcp. DatAds also shows it under MCP in the sidebar. Claude Code and Codex don't need a Client ID or a Client Secret from DatAds.

Connect Claude Code to DatAds

To add DatAds to Claude Code:

  1. Open a terminal.

  2. Run claude mcp add --transport http datads --scope user https://mcp.datads.io/mcp. Claude Code prints a line that starts with Added.

  3. Run claude mcp login datads. Your browser opens the DatAds sign-in page.

  4. Enter the email address of your DatAds account and select Continue, or select Continue with Google. Then finish the sign-in.

  5. If a page asks you to allow Claude Code access to your DatAds account, allow it.

  6. Back in the terminal, run claude mcp list.

Claude Code shows ✔ Connected next to datads. If it shows ! Needs authentication, run claude mcp login datads again.

The option --scope user makes DatAds available in all your Claude Code projects. Without it, DatAds works only in the folder where you ran the command. You can also sign in from inside Claude Code: enter /mcp, select datads and follow the steps in the browser.

Connect Claude Code in your IDE extension

To add DatAds to the Claude Code extension of your IDE:

  1. In the Claude Code extension of your IDE, select the / button next to the chat input.

  2. Select MCP servers, then Add servers.

  3. Select HTTP (remote).

  4. Enter the server URL https://mcp.datads.io/mcp.

  5. Select the scope, then select Add server.

If Claude Code asks you to sign in to DatAds, sign in with your DatAds account and allow access. Then test the connection as described in the section "Test the DatAds connection in Claude Code or Codex".

Use your Claude connection to DatAds in Claude Code

Claude Code can use the DatAds custom connector of your Claude account, without its own setup. This works when you connected Claude to DatAds on claude.ai and you sign in to Claude Code with that Claude account. See Connect Claude to DatAds.

In Claude Code, enter /mcp. The DatAds connector appears in the claude.ai section of the list. Claude Code doesn't load claude.ai connectors when it uses an API key instead of your Claude account. If you also added DatAds with claude mcp add, Claude Code uses that server and hides the claude.ai connector.

Connect Codex to DatAds

To add DatAds to Codex:

  1. Open a terminal.

  2. Run codex mcp add datads --url https://mcp.datads.io/mcp.

  3. Run codex mcp login datads. Your browser opens the DatAds sign-in page.

  4. Enter the email address of your DatAds account and select Continue, or select Continue with Google. Then finish the sign-in.

  5. If a page asks you to allow Codex access to your DatAds account, allow it.

  6. Back in the terminal, run codex mcp list.

Codex lists datads. Codex saves DatAds in its configuration file ~/.codex/config.toml. The Codex IDE extension and the ChatGPT desktop app read the same file, so DatAds works there too.

The Codex card on the DatAds MCP page shows the steps for ChatGPT. To connect ChatGPT on the web, see Connect ChatGPT to DatAds.

Test the DatAds connection in Claude Code or Codex

To test the connection, start claude or codex in a terminal and ask: "List my accessible clients in DatAds." The tool answers with the DatAds clients you can open. A client is a folder of ad accounts in DatAds, for example one brand.

Then ask a real question and name the client, for example: "In DatAds, which TikTok ads of the client Cookie had the lowest cost per acquisition (CPA) last week?" Claude Code and Codex can ask you to approve each DatAds tool before they use it. To see the DatAds tools, enter /mcp in either tool.

What Claude Code and Codex can see and do in DatAds

Claude Code and Codex read your DatAds data live through the DatAds MCP server, so they see the same numbers as DatAds. This table lists what they can read:

Area

What Claude Code and Codex can read

Clients

The clients you can open in DatAds, in every workspace on a plan that includes the MCP server

Ads and performance

Ad accounts, campaigns, ad sets, ads, AI tags, transcripts and metrics, for up to 90 days per request

Reports

Your saved Top performing, Comparative analysis, Recently launched and Testing Log reports

Benchmarks

The client's own benchmark ranges and industry benchmarks

Inspo

Ads and brands in Discovery, and the client's Inspiration Boards

Blink

Brand Context, Brand Memory, projects and the client's Blink chats

For a period longer than 90 days, ask for it in parts of up to 90 days each.

Both tools can also make changes in DatAds when you ask, for example update Brand Memory, create a project or start a Blink chat. Only Admins and Members can make changes. Reading data uses no AI credits. A Blink chat started from Claude Code or Codex uses your workspace's AI credits. See What your AI tool can see and do in DatAds.

Remove DatAds from Claude Code or Codex

To remove DatAds from Claude Code:

  1. Run claude mcp logout datads to sign out of DatAds.

  2. Run claude mcp remove datads --scope user.

To remove DatAds from Codex:

  1. Run codex mcp logout datads to sign out of DatAds.

  2. Run codex mcp remove datads.

The tool can no longer read your DatAds data. Nothing is deleted in DatAds. DatAds doesn't show a list of connected AI tools. To stop someone's access, a workspace Admin removes the person from the client or the workspace in DatAds.

Troubleshooting Claude Code and Codex with DatAds

claude mcp list shows "! Needs authentication" for datads

Claude Code shows this status when it has no valid DatAds sign-in. Run claude mcp login datads and sign in again. In Codex, run codex mcp login datads.

The tool says: "The workspace of this client is on a plan without MCP access."

Claude Code or Codex shows this DatAds error when the client's workspace is on the Lite or legacy Starter plan. Clients of a Lite workspace also don't appear in the list of clients. To fix it, a workspace Admin upgrades the workspace to Regular. See Compare plans. If the tool says that a client is not a client of the current user, your DatAds account can't open that client. Ask a workspace Admin to give you access to the client.

The tool says: "Only users who can edit this client can …"

Claude Code or Codex shows this DatAds error when a Visitor asks for a change in DatAds. Visitors can read data only. Ask a workspace Admin to give you the Member role. See Roles and permissions.

The browser doesn't open for the DatAds sign-in

The DatAds sign-in needs a browser, so it can't open on a remote computer, for example over SSH. Run claude mcp login datads --no-browser or codex mcp login datads --no-browser. Open the printed URL in a browser on your own computer and sign in to DatAds. Then paste the full URL from the browser's address bar back into the terminal.

For more error messages, see MCP connection problems and error messages. If the DatAds connection still doesn't work, contact support via the chat in the app or at [email protected]. Send your workspace name, the tool and version you use and the exact error text.

Related articles

Did this answer your question?