---
title: "Set Up Your MCP Client"
description: "Connect Claude Code, the Claude apps, or Codex to the Formbricks MCP server over OAuth — plus how to manage and revoke access."
icon: "plug"
---

These guides connect your MCP client to Formbricks using OAuth (no API keys). They use the Formbricks Cloud URL `https://app.formbricks.com/api/mcp`; if you self-host, swap in your own `https://<your-formbricks-domain>/api/mcp`. For how the flow works and prerequisites, see [Connect AI agents (MCP)](/platform/mcp/overview).

## Claude Code

Claude Code runs on your machine and performs the OAuth handshake itself.

<Steps>
  <Step title="Add the server">
    ```bash
    claude mcp add --transport http formbricks https://app.formbricks.com/api/mcp
    ```
  </Step>
  <Step title="Authenticate">
    In a Claude Code session, run `/mcp`, select **formbricks**, and choose **Authenticate**. Your
    browser opens to Formbricks; sign in if needed and **approve** the requested access on the consent
    screen. Claude Code registers itself automatically and stores the token — there's no scope to type
    in.
  </Step>
  <Step title="Verify">
    ```bash
    claude mcp list
    claude mcp get formbricks
    ```
    Then ask Claude to use it, e.g. *"Use the formbricks MCP server to list my surveys."*
  </Step>
</Steps>

To share the server definition with a project (no credentials committed), add it to `.mcp.json` at the repo root and authenticate with `/mcp` on first use:

```json
{
  "mcpServers": {
    "formbricks": {
      "type": "http",
      "url": "https://app.formbricks.com/api/mcp"
    }
  }
}
```

## Claude apps (custom connectors)

Use this for **claude.ai** and **Claude Desktop**, where Formbricks is added as a custom connector.

<Steps>
  <Step title="Open the connectors settings">
    Go to **Settings → Connectors** (**Customize → Connectors**) and click **Add custom connector**.
  </Step>
  <Step title="Add the server URL">
    Enter `https://app.formbricks.com/api/mcp` and confirm. Leave the optional OAuth client fields
    blank — Formbricks registers the connector automatically.
  </Step>
  <Step title="Approve access">
    Claude opens Formbricks in your browser. Sign in and **approve** the requested access. The
    connector then shows as connected, and you can enable it per chat from the **+** menu.
  </Step>
</Steps>

<Warning>
  **Two things to know about the Claude apps:**

  - **Custom connectors depend on your Claude plan.** They're available on Free, Pro, Max, Team, and
    Enterprise, but the Free plan is limited to a single connector. On **Team/Enterprise**, an
    **organization owner** must add the connector under **Organization settings → Connectors** first;
    members then connect to it individually.
  - **The connection runs from Anthropic's servers, not your machine.** A custom connector therefore
    **cannot reach a `localhost` server** — the MCP URL must be a **public HTTPS** address. Formbricks
    Cloud works out of the box; if you self-host, expose your instance on a public HTTPS domain (a
    tunnel such as ngrok/cloudflared works for testing). To connect a local dev server, use **Claude
    Code** instead — it runs locally.
</Warning>

## ChatGPT (MCP apps)

Use this to add Formbricks to **ChatGPT** as a custom MCP app. Custom MCP apps need ChatGPT
**developer mode**, which is available on Business and Enterprise/Edu plans and has to be enabled by
a workspace admin first — see OpenAI's
[Developer mode and MCP apps in ChatGPT](https://help.openai.com/en/articles/12584461-developer-mode-and-mcp-apps-in-chatgpt).

<Steps>
  <Step title="Create the app">
    In ChatGPT, go to **Settings → Apps → Create**. Enter the MCP URL
    `https://app.formbricks.com/api/mcp` and choose **OAuth** as the authentication mechanism.
  </Step>
  <Step title="Approve access">
    ChatGPT opens Formbricks in your browser and registers itself. Sign in and **approve** the
    requested access; ChatGPT then scans the available tools.
  </Step>
</Steps>

<Note>
  Like the Claude apps, ChatGPT connects from OpenAI's servers, so the MCP URL must be a **public
  HTTPS** address — not `localhost`.
</Note>

## Codex

<Steps>
  <Step title="Add the server">
    Include `--oauth-resource` so the access token is audience-bound to the MCP resource:
    ```bash
    codex mcp add formbricks \
      --url https://app.formbricks.com/api/mcp \
      --oauth-resource https://app.formbricks.com/api/mcp
    ```
  </Step>
  <Step title="Authenticate">
    ```bash
    codex mcp login formbricks
    ```
    Codex opens the browser to Formbricks, registers itself, and you **approve** on the consent
    screen. For read-only access, restrict the scopes:
    ```bash
    codex mcp login formbricks --scopes surveys:read,workflows:read,feedbackRecords:read,responses:read,offline_access
    ```
    Scope groups are independent — request only the ones you need (for example
    `feedbackRecords:read,offline_access` for feedback data alone).
  </Step>
  <Step title="Verify">
    ```bash
    codex mcp list
    codex mcp get formbricks
    ```
  </Step>
</Steps>

The equivalent `~/.codex/config.toml` entry:

```toml
[mcp_servers.formbricks]
url = "https://app.formbricks.com/api/mcp"
oauth_resource = "https://app.formbricks.com/api/mcp"
```

## Manage and revoke access

Every client you authorize appears under **Settings → Account → Authorized Apps**
(`/account/settings/authorized-apps`), showing the client name, its organization & workspace access
(**All access**, **2 organizations**, **3 workspaces**, or **No workspaces** when everything it was
limited to is gone), its access level per category (such as **Surveys · Write** or **Responses · Read**;
**Custom** when the permissions in a category differ), and when it was connected and last changed. Only
organizations and workspaces you can still select count: one you lost access to, or an organization where
you are now only a billing member, isn't shown, and the next save removes it. A client connected twice, for
example from two machines, is listed twice, and each is edited and revoked on its own. A first-party client that connects without a
consent screen is listed too.

Click **Edit** to change what a client may do. It opens the same editor as the consent screen, filled in
with the client's current grant: choose **All access**, **Only selected organizations** or **Only selected
workspaces** (see [Organization & workspace access](/platform/mcp/overview#organization-workspace-access)),
and set each permission to **No access**, **Read** or **Write**, or
use **Read-only**, **Select all** or **Deselect all**. Levels above what the client asked for when you
connected it can't be chosen; to give more, reconnect it so it asks again. **Save changes** applies from
the client's next tool call, with the token it already holds, so there is no need to reconnect. Save stays
disabled while every permission is at No access, or while a selection has nothing picked: to end a client's
access, use Revoke. If a change that takes access away can't be applied right away, Save (and Allow on the
consent screen) fails with an error and nothing changes; try again.

Click **Revoke** to cut off a client's access: revoking deletes its grant, so its next call is
refused, even with an access token it still holds. It will need to be re-authorized to connect again.
Connecting, editing and revoking are all recorded in the audit log, with the whole grant before and after, under
each organization the grant reaches (every organization you belong to, for All access), so an owner of those
organizations finds them among their organization's entries. A grant that ends because your role or account
changed is recorded too, by the system.

Approving a client again with fewer scopes replaces what it was granted. Every earlier grant that
included a dropped scope stops refreshing, all of its tokens together, even ones the client had
already narrowed to the new scopes (for grants made before Formbricks 5.4, only the tokens that still
carry a dropped scope stop). The client gets `invalid_grant` and has to re-authorize, which issues
tokens within the new scopes. An access token it already holds keeps working until it expires, at
most 15 minutes later; one obtained with an authorization code issued before the change can start
that 15 minutes up to 10 minutes after it.

Tokens are short-lived by design: an access token lasts **15 minutes** and the client refreshes it
silently in the background for up to **30 days** (the refresh window). After that — or after you
revoke — the client re-runs the sign-in and consent flow. A client whose grant is missing (for example
one approved on an older server during an upgrade) is refused the same way and asks you to approve it
again. Approving the write scopes
(`surveys:write`, `workflows:write`, `feedbackRecords:write`, `responses:write`, `dashboards:write`) is
re-confirmed periodically for safety.

## Troubleshooting

<AccordionGroup>
  <Accordion title="claude.ai or ChatGPT says it couldn't register / connect">
    Custom connectors connect from the vendor's cloud, which can't reach `localhost` or a private
    network. Use a **public HTTPS** MCP URL (Formbricks Cloud, or a tunnel to a self-hosted instance),
    or connect a local server with **Claude Code** instead.

    If registration fails with `400 invalid_redirect_uri`, the client asked to register a callback
    Formbricks doesn't allow. Formbricks accepts local (`http://localhost`, `127.0.0.1`, `[::1]`)
    callbacks and the exact claude.ai and ChatGPT callbacks. To allow another hosted client, a
    self-hoster can add its exact callback with `MCP_DCR_ALLOWED_REDIRECT_URIS`.
  </Accordion>
  <Accordion title="invalid_client or a stale-registration error after reconnecting">
    The client cached a registration that no longer exists on the server (e.g. the server data was
    reset). Clear the client's stored credentials for the server and re-authenticate — in Claude Code,
    remove and re-add the server (`claude mcp remove formbricks` then `claude mcp add …`) and run
    `/mcp` again.
  </Accordion>
  <Accordion title="invalid_scope during sign-in">
    The client requested a scope it isn't registered for. Reconnect from scratch so it re-registers
    with the scopes the server advertises (`surveys:read`, `surveys:write`, `workflows:read`,
    `workflows:write`, `feedbackRecords:read`, `feedbackRecords:write`, `responses:read`,
    `responses:write`, `dashboards:read`, `dashboards:write`, `audience:read`, `offline_access`).
  </Accordion>
  <Accordion title="Stuck in a consent loop / keeps asking you to sign in">
    Usually a cookie or stale-session issue. Make sure you're signed in to Formbricks in the same
    browser the client opens, and that third-party-cookie blocking or a private window isn't
    discarding the session. If it persists, revoke the app under **Settings → Account → Authorized
    Apps**, clear the client's stored credentials for the server, and reconnect. Self-hosters: an
    incorrect base URL (see below) also causes repeated redirects.
  </Accordion>
  <Accordion title="A tool call fails even though you're connected">
    Scopes don't override your workspace role. Creating, editing, or deleting surveys or workflows
    requires `write` or `manage` permission on that workspace — ask a workspace owner/manager to grant
    it. `test_workflow` also needs `write`/`manage` even though it's a read-scoped dry-run, because it
    evaluates the live workflow definition. A `:write` tool likewise 403s if your token was only granted
    the matching `:read` scope; reconnect and approve write access.
  </Accordion>
  <Accordion title="A tool call is refused with “Not permitted”">
    The client's grant doesn't give the permission at the level the tool needs; the error names both,
    such as `Surveys: Write`. Raise it with **Edit** under **Authorized Apps**. When the error also says
    the client's OAuth token lacks a scope, the client didn't ask for that access when it connected:
    reconnect the client and approve the matching scope.
  </Accordion>
  <Accordion title="Self-hosted: the browser can't complete sign-in / redirects fail">
    OAuth discovery and redirects are built from your configured base URL. Serve Formbricks from a
    correct, public **HTTPS** origin and set `WEBAPP_URL` (and `BETTER_AUTH_URL`) to it. An
    `http://localhost` or mismatched origin breaks the flow for remote clients. See the
    [environment variables](/self-hosting/configuration/environment-variables) reference.

    If the Formbricks container or pod cannot resolve that public origin when it verifies a token, set
    `MCP_OAUTH_JWKS_URL` to the internal `/api/auth/jwks` endpoint. Keep `WEBAPP_URL` and your auth base
    URL public: the internal override is only used for the server-side signing-key fetch. On an instance
    that still configures the auth URL under its older name, that is the one that has to stay public.
    `/api/auth/jwks` is correct only when no custom application subpath is configured. If Formbricks is
    mounted at `/formbricks`, use the complete internal URL, such as
    `http://formbricks:3000/formbricks/api/auth/jwks`.
  </Accordion>
  <Accordion title="Self-hosted behind Cloudflare: the client can't connect, but the URL works in your browser">
    Only sign-in and consent happen in your browser. Discovery, registration, the token exchange and
    every tool call come straight from the client — for claude.ai and ChatGPT, from Anthropic's or
    OpenAI's servers. Cloudflare can treat that traffic as an AI agent or bot and block or challenge it
    while still letting your browser through. The client then gets a Cloudflare page instead of the JSON
    it expects, and reports what looks like an OAuth, registration or MCP error. So a URL that opens
    in your browser, or a consent screen that works, does not rule Cloudflare out.

    Check Cloudflare's **Security Events** for blocked or challenged requests to these paths (prefix
    each with your [custom subpath](/self-hosting/configuration/custom-subpath) if you use one):

    - `/.well-known/oauth-protected-resource`, `/.well-known/oauth-authorization-server`,
      `/.well-known/openid-configuration` and `/api/auth/.well-known/` — discovery
    - `/api/auth/oauth2/` — registration and tokens
    - `/api/mcp` — the MCP server itself

    Then let the client through without turning protection off for the whole site:

    - **AI bot policies:** under **Security → Settings → Configure AI bot policies**, set **Agent** to
      **Allow**. Agent covers AI tools acting for a person in real time, which is what an MCP client
      is. **Training** and **Search** can stay blocked. If you still use the older **Block AI bots**
      setting, check that too.
    - **Bot Fight Mode** can't be skipped for specific paths, so if it blocks the client, turn it off.
      **Super Bot Fight Mode** can: add a WAF custom rule with the **Skip** action for the paths above.
    - **WAF custom rules and Cloudflare Access:** make sure no Block, Managed Challenge or Access policy
      covers the paths above. An MCP client can't solve a challenge or sign in to Access.

    Formbricks also fetches its own signing keys from your public `/api/auth/jwks` to verify tokens.
    If Cloudflare challenges that request, sign-in succeeds but every call to `/api/mcp` is rejected
    with `401`, and Formbricks logs `MCP OAuth authentication failed` with `failureSource: "jwks_fetch"`.
    Set `MCP_OAUTH_JWKS_URL` to the internal endpoint so that fetch doesn't go through Cloudflare (see
    the entry above).
  </Accordion>
</AccordionGroup>

---

Need the tool schemas, response shapes, or the API-key fallback? See the
[MCP server technical handbook](/development/technical-handbook/mcp-server).

## API-key fallback

If your client cannot use OAuth, configure its HTTP headers to send `x-api-key` to your instance's
`/api/mcp` endpoint. [Create a scoped API key](/api-reference/generate-key) for the required tools.
Store it in the client's secret settings, not a committed configuration file. Tool access still depends
on scopes, workspace permissions and feature availability. Prefer OAuth where your client supports it.
