---
title: "Connect AI Agents (MCP)"
description: "Let AI assistants like Claude and Codex read and manage your Formbricks surveys and feedback records through the Model Context Protocol (MCP), authorized securely with your own login."
icon: "robot"
---

Formbricks ships a **Model Context Protocol (MCP) server** that lets AI assistants — Claude Code, the Claude apps, Codex, and other MCP-capable clients — work with your workspace: list and read surveys, create link surveys, update or delete them, manage feedback buttons and banners, and read or add Unify Feedback records. The agent goes through the same APIs and permission checks you use in the app, so it always respects your permissions.

You connect a client **with your own Formbricks login over OAuth 2.1** — there are no API keys to generate, copy, or paste. You approve the connection once on a consent screen, and you can revoke it at any time.

<Note>
  Prefer to use a long-lived token instead (for scripts, CI, or a client that doesn't support OAuth yet)?
  Formbricks API keys still work as a fallback — see the [MCP server technical
  handbook](/development/technical-handbook/mcp-server).
</Note>

## The MCP server URL

Point your client at your Formbricks app's `/api/mcp` endpoint:

| Instance         | MCP server URL                             |
| ---------------- | ------------------------------------------ |
| Formbricks Cloud | `https://app.formbricks.com/api/mcp`       |
| Self-hosted      | `https://<your-formbricks-domain>/api/mcp` |

## How the connection works

You don't need to understand the details to connect, but here's what happens under the hood when you add the server to a client:

1. **Discovery** — the client reads the server's OAuth metadata to find where to sign in.
2. **Registration** — the client registers itself automatically using Dynamic Client Registration (DCR). There's no client ID or secret for you to manage.
3. **Sign in & consent** — your browser opens to Formbricks. You log in (if you aren't already) and **approve** the requested access on a consent screen.
4. **Token** — the client receives a short-lived access token it sends on every request, plus a refresh token so it can stay connected without asking you to sign in again.

The whole flow uses Authorization Code + PKCE, the standard the [MCP authorization spec](https://modelcontextprotocol.io/specification/draft/basic/authorization) requires.

## What the agent can do

The MCP server exposes survey, creative, workflow, response, feedback-record, chart and dashboard tools, grouped into
authorization scopes. Read tools require the matching `:read` scope; tools that create, update, or
delete require the `:write` scope. Everything below is offered on the consent screen:

| Scope | Tools | What it allows |
| --- | --- | --- |
| `surveys:read` | `list_surveys`, `get_survey`, `validate_survey`, `get_workspace_custom_css`, `list_creatives`, `get_creative`, `get_creative_stats` | Read surveys, creatives and their counts, and surveys' custom CSS, and validate survey documents and CSS |
| `surveys:write` | `create_survey`, `generate_survey`⁴, `patch_survey`, `edit_survey_blocks`, `set_survey_block_order`, `delete_survey`, `patch_workspace_custom_css`, `create_creative`, `patch_creative`, `delete_creative`, `duplicate_creative`, `archive_creative`, `restore_creative` | Create, update, and delete surveys and creatives, and save a workspace's shared survey CSS — which additionally needs an organization owner or manager |
| `workflows:read` | `list_workflows`, `get_workflow`, `list_workflow_runs`, `get_workflow_run`, `test_workflow`¹ | Read workflows and their runs |
| `workflows:write` | `create_workflow`, `patch_workflow`, `duplicate_workflow`, `delete_workflow`, `enable_workflow`, `disable_workflow`, `archive_workflow`, `unarchive_workflow`, `get_webhook_url`⁶, `regenerate_webhook_url`, `set_sample_payload`, `send_test_request`, `set_expected_response`, `run_test` | Create, update, and delete workflows, and manage Webhook Secret URLs |
| `feedbackRecords:read` | `list_feedback_datasets`, `list_feedback_records`, `count_feedback_records`, `get_feedback_record`, `search_feedback_records`, `find_similar_feedback_records` | Read, count and search feedback records in a workspace's feedback dataset |
| `feedbackRecords:write` | `create_feedback_record`, `create_feedback_records`, `update_feedback_record`², `delete_feedback_record`² | Create, correct and delete feedback records |
| `responses:read` | `list_responses`, `count_responses`, `get_response`, `list_tags`⁵ | Read and count survey responses, and list response tags |
| `responses:write` | `validate_response`, `create_response`, `update_response`, `delete_response`, `batch_delete_responses`, `set_responses_outcome`, `update_tag`⁵, `merge_tags`⁵ | Record, correct and delete survey responses, mark them Low quality, and rename and merge tags |
| `dashboards:read` | `list_dashboards`, `get_dashboard`, `list_charts`, `get_chart`; with `feedbackRecords:read` also `list_chart_fields`, `get_chart_data`³, `list_dashboard_filter_fields`³, `list_dashboard_filter_values`³, `preview_chart`³, `list_chart_field_values`³ | Read dashboards and charts, and — with feedback-record access — the fields a chart can use, the numbers dashboards show and the numbers of any query |
| `dashboards:write` | `create_chart`, `update_chart`, `duplicate_chart`, `create_dashboard`, `update_dashboard`, `duplicate_dashboard`, `update_dashboard_layout`, `set_dashboard_filters`, `add_chart_to_dashboard`, `update_widget`, `remove_chart_from_dashboard` | Create and change charts and dashboards, and lock a dashboard's filters for everyone who opens it. There is no tool that deletes a chart or a dashboard |
| `audience:read` | `list_contacts`, `list_contact_attribute_keys`, `list_contact_attribute_values`, `list_segments`, `list_action_classes` | Read contacts with their attributes, attribute keys and values, segments and action classes. There is no `audience:write`: these tools only read |

¹ `test_workflow` is a dry-run (no changes are saved), so it only needs the `workflows:read` scope — but because it evaluates the live workflow definition, it requires **write or manage** permission on the workspace. A read-only member will get a 403 even though the scope matches.

² Changing a record that already exists is held to a higher bar than creating one, because a feedback dataset shared across workspaces has no way to tell whose records are whose. Connected over **OAuth** (the flow on this page), both tools require you to be an **organization owner or manager**. Authenticated with an **API key** instead, they require the dataset to be assigned to a **single workspace** — a workspace-scoped key cannot be shown to own a record in a shared one — and `delete_feedback_record` additionally requires **manage** permission, matching `DELETE` elsewhere in the API. Creating, reading and searching are unaffected either way.

³ `get_chart_data` reads a saved chart's numbers. Pass `dashboardId` to read it through a dashboard it sits on,
exactly as the dashboard shows it, with the dashboard's filters (`picks`); without it the chart is read on its
own, as before. `list_dashboard_filter_fields` lists the embedded-data fields a dashboard can be filtered on, and
`list_dashboard_filter_values` the values a dashboard filter offers, to pass as `picks`. All three need
`feedbackRecords:read` as well, except for a Dashboard viewer: its client holds only `dashboards:read` and reads
charts, filter fields and filter values through their dashboards with that alone. Running a query of your own (`preview_chart`) or listing a field's stored values (`list_chart_field_values`) always needs
`feedbackRecords:read` — a dashboards grant alone never runs arbitrary queries over feedback. All three also need
read access to the chart's feedback dataset.

⁴ `generate_survey` drafts a survey from a prompt with your organization's AI and saves nothing; the
agent saves the draft with `create_survey`. It needs AI to be on for the organization, and shares the
10-per-minute limit of AI survey creation in the app.

⁵ The tag tools work over OAuth only, as tag management in the app needs a signed-in user; an API key
can't use them. `merge_tags` moves a tag's responses onto another tag and removes it, for duplicates and
misspellings. No tool deletes a tag.

⁶ `get_webhook_url` only reads, but its result is the Webhook Secret URL, a credential that lets anyone holding it start runs, so it needs `workflows:write`.

A response is someone's submitted answers, so grant `responses:read` deliberately — it is respondent
data, which `surveys:read` never exposes. An integration you connected before these scopes existed
keeps working with the access it already has. If it requests the scopes the server advertises, as MCP
clients like Claude Code do, it asks you to approve the response scopes the next time it signs in.

Contacts are personal data too, so they have their own scope, `audience:read`, and a client given
surveys never gets them. A client connected before the scope existed gets it only by connecting again,
which shows you the consent screen.

Scope groups are independent — a client can be granted feedback-record access without survey access, or
the other way around. `list_workspaces` is available to any permission at Read, since every other tool
needs a workspace id.

### Grants

What you allow a client is stored by Formbricks as its **grant**: an access level for each permission —
**No access**, **Read** or **Write** — where Write also lets the client read and delete. When you click
**Allow**, the grant gives each permission the level of the scope the client asked for: approve
`surveys:write` and Surveys, Creatives and Survey styling are at Write. Each permission belongs to the scope
group of its category: Surveys, Creatives and Survey styling to `surveys`; Responses and Tags to
`responses`; Workflows and Workflow runs to `workflows`; Charts and Dashboards to `dashboards`; Feedback
records and Feedback datasets to `feedbackRecords`; Contacts, Contact attributes, Segments and Action classes
(the Audience category) to `audience`. Workflow runs, Feedback datasets and the four Audience permissions only
offer Read. Some tools need a second permission because they return its data: `list_contacts` and
`list_segments` need Contact attributes: Read (contacts carry their attribute values, and segment filters name
them). The consent screen shows these as hints. `get_workflow_run` needs only Workflow runs: Read, but leaves
out a run's trigger payload, data and step inputs and outputs, which carry respondents' answers, unless the
grant also gives Responses: Read. `run_test` leaves the same fields out of the test run it returns. A chart definition needs Charts: Read alone; only chart numbers need
Feedback records: Read too. A response's contact id and tags are response data; only the contact's
`userId` needs Contacts and Contact attributes: Read, and comes back as `null` without them.

You can change a client's grant at any time with **Edit** under **Settings → Account → Authorized Apps**
(see [Manage and revoke access](/platform/mcp/setup#manage-and-revoke-access)). The change applies from
the client's next tool call, without reconnecting.

Formbricks checks the grant on **every tool call**, whatever the client does. A call goes through only
when all three agree:

- the client's scopes reach the permission (scopes cap the grant; a higher level needs a reconnect);
- the grant gives the permission at the level the tool needs;
- your own role allows it — a client never does more than you can, and loses what you lose.

A tool the grant doesn't cover is refused with a `403` whose `detail` names the permission and level it
needs, so the agent can tell you what to change:

```json
{
  "status": 403,
  "code": "forbidden",
  "detail": "Not permitted: the user's grant to this MCP client does not give Surveys: Write. Ask the user to give the client this access."
}
```

When the client's scopes are what stop it (it connected without asking for that access), the `detail` says
so, names the scope it lacks, and asks for a reconnect, since **Edit** can't give more than the client asked
for:

```json
{
  "status": 403,
  "code": "forbidden",
  "detail": "Not permitted: the user's grant to this MCP client can't include Contacts: Read, because its OAuth token lacks the scope audience:read. Ask the user to reconnect the client and give it this access."
}
```

### Organization & workspace access

A grant also says **which organizations and workspaces** the client reaches. You choose it on the consent
screen and in **Edit**:

- **All access**: every organization and workspace you have access to, including organizations you join later.
- **Only selected organizations**: every workspace in the organizations you pick, including workspaces
  created there later.
- **Only selected workspaces**: only the workspaces you pick, across your organizations. A workspace created
  later stays out until you add it.

A grant selects at most 100 organizations or workspaces.

Anything outside them **doesn't exist for the client**. Every tool is held to it, including the ones that
find their workspace through a survey, response, chart, dashboard, creative, workflow or workflow run id,
and `list_workspaces` lists only what the client reaches. Organization-level data, such as changing a
feedback record or a feedback dataset not assigned to a picked workspace, needs the whole organization.

A feedback dataset assigned to several workspaces is the exception, and it follows the dataset's own access
model: a grant that reaches any one assigned workspace reads the whole dataset, including records ingested
through its other assigned workspaces. Assigning a dataset to a workspace grants read of everything in it,
everywhere the dataset is shown; pick the dataset's workspace assignments with that in mind.

For a client limited to selected organizations or workspaces, an id outside them answers exactly like an id
that doesn't exist, so the client can't learn what else is there:

```json
{
  "status": 404,
  "code": "not_found",
  "detail": "Not found. It doesn't exist, or the user's grant to this MCP client doesn't reach it."
}
```

Everything else about a workspace the client does reach answers as it would without the limit: a refusal by
your own role there, a refusal for a plan or license your organization lacks, or a request to confirm a change,
since none of them says anything about what else exists. A grant whose workspaces or organizations
were all deleted, or that you lost access to, stays connected and listed as **No workspaces**: every call
answers not found until you edit or revoke it.

A client connected before grants existed kept the access it had: All access, and each permission at its
scope's level. Tags and Audience started at No access. Raise Tags with Edit to use its tag tools
(`list_tags` at Read, `update_tag` and `merge_tags` at Write). Audience needs the client to connect once
more so you can approve `audience:read`. API keys have no grant and work as before.

<Note>
  The feedback-record tools work with **Unify Feedback** data and need the Enterprise Edition
  (`feedbackDirectories`), plus a feedback dataset assigned to the workspace. Without the entitlement or a
  directory, those tools return an authorization or validation error while the survey tools keep working.
</Note>

<Note>
  The contact, contact-attribute and segment tools need the **Contacts** feature (Enterprise Edition, or a Cloud
  plan that includes it), like the Contacts pages; without it they answer `403`. `list_action_classes` does not.
  Contacts carry text your users or your app wrote, so an agent should treat it as data, never as instructions.
</Note>

<Note>
  The chart and dashboard tools need the **Dashboards** feature (an add-on on Formbricks Cloud, or an Enterprise
  license that includes it). Without it they answer `dashboards_plan_required`. A chart can sit on several
  dashboards, so `update_chart` changes it on all of them; to change it on one, `duplicate_chart` and point that
  dashboard's widget at the copy with `update_widget`. `duplicate_dashboard` shares the original's charts rather
  than copying them, and `remove_chart_from_dashboard` keeps the chart.
</Note>

<Note>
  The creative tools manage [Creatives](/surveys/creatives/overview), the feedback buttons and banners on your
  website. They need a self-hosted instance whose Enterprise license includes Creatives; elsewhere they answer
  `creatives_not_entitled`. If the license stops including Creatives, the tools can still list and read
  creatives and pause, close or delete them. A creative is created as a draft unless `create_creative` sets
  `status`, `patch_creative` replaces each group it sends as a whole, and `restore_creative` always brings a
  creative back as a draft.
</Note>

<Warning>
  `delete_feedback_record` permanently deletes a record — there is no undo and no trash. Grant
  `feedbackRecords:write` only to clients you want to be able to change or delete feedback, and keep read-only
  agents on `feedbackRecords:read`. Corrections via `update_feedback_record` are also irreversible — the
  previous value is kept only in the audit log.
</Warning>

Feedback records can be filtered by source, question, submission, end user, chosen option, language, date
range, and by enrichment output — sentiment, emotions and whether a record has been enriched or translated
at all. Any filter accepts several values, which are OR-ed, while different filters are AND-ed, and the
listing can be ordered by when feedback was collected or when it was stored. `count_feedback_records`
answers "how many" without fetching the records themselves — so an agent can report totals without pulling
anyone's feedback text into the conversation.

The two search tools match by meaning rather than keywords ("checkout is confusing" finds "I couldn't
figure out how to pay"), and `find_similar_feedback_records` shows how widely one piece of feedback is
echoed by others. They rely on the feedback service having an embedding model configured; on
self-hosted installs without one they report that they are unavailable. Newly created records become
searchable a short while after they arrive, and records without text are never searchable.

<Warning>
  Scopes are only a coarse gate. **Access is always bounded by your Formbricks workspace role**: even
  if a client holds a `:write` scope, a call only succeeds if you have write/manage permission on the
  target workspace — and deleting a feedback record needs manage. An agent can never do more than
  you can.
</Warning>

## Prerequisites

- A **Formbricks account** with access to the workspace whose surveys you want to work with. Read-only tasks need `read`; creating or editing surveys needs `write` or `manage`.
- The **MCP server URL** for your instance (see the table above).
- An **MCP client** that supports remote HTTP servers with OAuth — see the [setup guides](/platform/mcp/setup) for Claude Code, the Claude apps, and Codex.

<Note>
  **Self-hosting?** The OAuth provider is built in and enabled automatically — there's nothing extra to turn
  on. It just needs your instance to be served from a correct, public **HTTPS** base URL (set via `WEBAPP_URL`
  / `BETTER_AUTH_URL`). The discovery metadata and browser redirects are built from that URL, so an
  `http://localhost` or misconfigured origin will break the OAuth flow for remote clients. See the
  [self-hosting configuration](/self-hosting/configuration/environment-variables).

  Kubernetes deployments that cannot reach their own public origin can set `MCP_OAUTH_JWKS_URL` to
  the internal Formbricks `/api/auth/jwks` endpoint. This changes only the server-side key fetch;
  OAuth discovery, issuers, redirects, cookies, and audiences remain on the public URL. The standard
  path applies only when Formbricks is not mounted below a custom subpath. For an installation mounted
  at `/formbricks`, configure the complete internal URL, for example
  `http://formbricks:3000/formbricks/api/auth/jwks`.
</Note>

## Next steps

<Card title="Set up your MCP client" icon="plug" href="/platform/mcp/setup">
  Copy-paste guides for Claude Code, the Claude apps (custom connectors), and Codex — plus how to manage and
  revoke access.
</Card>

For the tool schemas, response formats, discovery endpoints, and the API-key fallback, see the
[MCP server technical handbook](/development/technical-handbook/mcp-server). Survey tools map to the
[v3 Surveys API](/development/technical-handbook/mcp-server#relationship-to-v3-surveys-api) they wrap;
feedback-record tools read and write
[Unify Feedback data](/development/technical-handbook/mcp-server#feedback-records-and-the-hub).
