Skip to content

Official Meta Ads MCP fails OAuth login with invalid_client_metadata #24103

Open

Description

@canorionen

Summary

Official Meta Ads MCP login fails in Codex before the browser/OAuth consent flow opens.

MCP server:

https://mcp.facebook.com/ads

Codex reports:

Error: Registration failed: Dynamic registration failed: Registration failed: HTTP 400 Bad Request: {"error":"invalid_client_metadata","error_description":"Dynamic registration is not available for this client."}

Environment

  • Codex CLI: 0.130.0
  • Also reproduced with: npx @openai/[email protected]
  • Platform: Linux server over SSH / Codex desktop remote
  • MCP config:
[mcp_servers.meta_ads_mcp]
enabled = true
url = "https://mcp.facebook.com/ads"

Reproduction

  1. Add the official Meta Ads MCP server with URL https://mcp.facebook.com/ads.

  2. Click Authenticate in Codex UI, or run:

    codex mcp login meta_ads_mcp
  3. No browser consent flow opens.

  4. Login fails during dynamic client registration with invalid_client_metadata.

Expected behavior

Codex should complete OAuth login for the official Meta Ads MCP server, or support the client metadata/static client identity required by Meta's hosted MCP OAuth flow.

Notes

This appears related to #19154, but this case is for Meta's official hosted Ads MCP endpoint rather than a private/internal OAuth server.

Activity

  1. added
    bug
    CLI
    mcp
    auth
    on May 22, 2026
  2. dal-mnr commented on May 27, 2026

    @dal-mnr

    I can reproduce this on Codex Desktop for macOS as well.

    Environment:

    • Codex Desktop bundled CLI: codex-cli 0.131.0-alpha.9
    • Platform: macOS
    • MCP server URL: https://mcp.facebook.com/ads

    Commands:

    /Applications/Codex.app/Contents/Resources/codex mcp add meta-ads --url https://mcp.facebook.com/ads
    /Applications/Codex.app/Contents/Resources/codex mcp login meta-ads

    Result:

    Error: Registration failed: Dynamic registration failed: Registration failed: HTTP 400 Bad Request: {"error":"invalid_client_metadata","error_description":"Dynamic registration is not available for this client."}
    

    codex mcp list shows the server is added and enabled, but auth remains Not logged in.

    So this appears to reproduce the same failure mode: the OAuth browser consent flow never opens because dynamic client registration fails first.

  3. sunberrysolar commented on May 29, 2026

    @sunberrysolar

    Same here with codex v0.135.0

  4. rzagmarz commented on Jun 6, 2026

    @rzagmarz

    Same here.

  5. liudasbar commented on Jun 10, 2026

    @liudasbar

    still an issue

  6. apranevicius commented on Jun 13, 2026

    @apranevicius

    Any clue when this is going to be fixed?

  7. jeffrey94 commented on Jun 20, 2026

    @jeffrey94

    Reproduced on macOS with the Codex desktop app / local CLI.

    My MCP config is:

    meta_mcp  https://mcp.facebook.com/ads  enabled  Not logged in
    

    Clicking Authenticate in Codex does not open a browser. Running:

    codex mcp login meta_mcp

    fails immediately with:

    Error: Registration failed: Dynamic registration failed: Registration failed: HTTP 400 Bad Request: {"error":"invalid_client_metadata","error_description":"Dynamic registration is not available for this client."}
    

    So this is reproducible on a local Mac as well, not only on a remote/Linux setup.

  8. guidocelada commented on Jun 20, 2026

    @guidocelada

    +1, please address.

  9. Ziad-NasrEldin commented on Jun 30, 2026

    @Ziad-NasrEldin

    It still exists for more than a month now.

  10. sanebg commented on Jul 1, 2026

    @sanebg

    What happened? Will this be fixed?

  11. evveame-creator commented on Jul 6, 2026

    @evveame-creator

    Adding a user-impact note from Codex Desktop.

    The Meta Ads MCP issue is not just a technical auth edge case. For small-business and marketing operators, this blocks a very natural workflow: connect Meta Ads, ask for campaign data, reason about the numbers, and then keep planning/executing in the same Codex session.

    A smoother remote MCP OAuth flow would make Codex much stronger as a combined planning + execution workspace. The ideal experience is not only "chat" and not only "coding": users need an agent that can research, connect tools, pull data, reason over the business context, operate browser/UI when needed, and teach the user how to execute professionally while doing the work.

    This kind of mode would help users learn to control AI tools instead of being replaced by them: fewer broken auth handoffs, clearer tool connection states, and a more fluid bridge between strategy, data, and action.

  12. earonesty commented on Jul 8, 2026

    @earonesty

    use meta cli from python, works fine. codex loves it. generate a token using the busniess manager "system user". took a bit (annyoing imo), but it works. codex is managing my ads now.

  13. Emstr commented on Jul 15, 2026

    @Emstr

    Reproduced again on 2026-07-15 with current local builds:

    • Codex CLI: 0.144.1
    • ChatGPT desktop/Codex app build: 26.707.72221
    • Platform: macOS
    • MCP URL: https://mcp.facebook.com/ads

    codex mcp get meta_ads shows the streamable HTTP server enabled. Running codex mcp login meta_ads still fails before opening browser consent:

    Error: Registration failed: Dynamic registration failed: Registration failed: HTTP 400 Bad Request: {"error":"invalid_client_metadata","error_description":"Dynamic registration is not available for this client."}
    

    User impact: this prevents handing off an existing Meta Ads analysis/creative-production workflow from Claude’s hosted Meta Ads connector to Codex. Codex can read the local handoff and downstream attribution systems, but cannot authenticate to Meta for live spend/delivery or approved ad preparation. No bearer-token workaround should be required for the official hosted MCP endpoint.

  14. jovicailievski commented on Jul 22, 2026

    @jovicailievski

    Still same, any updates ?

  15. LiuLawrence45 commented on Jul 28, 2026

    @LiuLawrence45

    Same issue here. It's really, really annoying. Codex would be great for this workflow, so I really hope this gets fixed soon.

  16. bkosmetika commented on Jul 30, 2026

    @bkosmetika

    Same issue here

  17. lasguiaspracticas360-alt commented on Aug 3, 2026

    @lasguiaspracticas360-alt

    Reproduced on Codex Desktop for Windows on 2026-08-02.

    Environment:

    • Codex Desktop client reported in logs: 26.727.51351
    • MCP transport: Streamable HTTP
    • Server: https://mcp.facebook.com/ads
    • Configuration:
      [mcp_servers.meta_ads]
      enabled = true
      url = "https://mcp.facebook.com/ads"

    Observed behavior:

    1. The MCP appears enabled and the UI shows Authenticate.
    2. Clicking Authenticate repeatedly does not open a browser or show a visible error.
    3. Restarting Codex does not change the behavior.
    4. The MCP remains unavailable to Desktop threads.

    Sanitized Codex log evidence:

    resource metadata probe returned unexpected status: 405 Method Not Allowed
    discovery url: https://mcp.facebook.com/.well-known/oauth-authorization-server/ads
    resource metadata discovery url: https://mcp.facebook.com/.well-known/oauth-protected-resource/ads
    worker quit with fatal: Transport channel closed, when AuthRequired(...)
    

    The WWW-Authenticate response advertises Meta Ads scopes, including ads_management, ads_read, business_management, and ads_mcp_management, so the server is reachable and correctly requests OAuth. The flow stops before browser consent opens.

    Control test:

    • The same Meta account and the same endpoint authenticate successfully in Claude Desktop.
    • This isolates the failure to Codex's MCP OAuth/DCR flow rather than the Meta account, browser, endpoint, or local MCP configuration.

    Expected:
    Codex Desktop should open the Meta consent flow and complete OAuth, or surface the exact registration/discovery failure in the UI.

    No credentials, tokens, account IDs, campaign names, or local user paths are included in this report.

  18. danielnrocha commented on Oct 9, 2026

    @danielnrocha

    The official Meta Ads endpoint https://mcp.facebook.com/ads is reachable. Codex MCP login fails before browser consent with HTTP 400 invalid_client_metadata: Dynamic registration is not available for this client. A fresh app-server reports notLoggedIn and zero tools for this server, while other authenticated MCPs initialize successfully. This reproduces the behavior in #24103 . Please document a supported authentication route or resolve client registration compatibility. No credentials, account identifiers, or campaign information is included.

  19. lucasrobertorezende6-a11y commented on Oct 18, 2026

    @lucasrobertorezende6-a11y

    Reproduced on Codex Desktop for Windows on 2026-10-18 with the bundled codex-cli 0.163.0-alpha.10.2.

    Steps:

    1. codex mcp add meta-ads --url https://mcp.facebook.com/ads
    2. The server is added, but the automatic OAuth flow fails before opening Meta's consent page:
      HTTP 400 Bad Request: {"error":"invalid_client_metadata","error_description":"Dynamic registration is not available for this client."}
    3. codex mcp login meta-ads --oauth-client-registration cimd also fails before consent with:
      MCP authorization server does not advertise CIMD with token endpoint auth method none

    The user reports that they connected the same Meta Ads service successfully in Claude. In Codex, the official endpoint remains unusable for this workflow. Please provide a supported authentication path for Codex or fix OAuth client registration compatibility.

    No account IDs, tokens, or private campaign data are included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIauthbugmcp

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions