Overview
The Formbricks MCP server exposes a small v3 Surveys tool surface for AI agents. It runs inside the Formbricks web app at/api/mcp and reuses the same v3 Surveys API authentication, authorization,
rate limiting, response handling, and audit logging paths as the REST routes.
This page documents the current API-key MVP. OAuth-based MCP authorization is not part of the current
implementation.
Endpoint
Use the streamable HTTP MCP endpoint on the Formbricks app:POST requests, runs with the Next.js Node.js runtime, and sets private no-store
response headers. Browser-origin MCP requests must come from the configured public Formbricks origin.
Authentication
Authenticate with a Formbricks API key in a request header:api_key, x-api-key, access_token, token, and authorization case-insensitively.
API key permissions are enforced through the same workspace access checks as the v3 REST API:
| Tool | Minimum Workspace Permission |
|---|---|
list_surveys | read |
get_survey | read |
create_survey | write or manage |
validate_survey | write or manage when the validation request checks write access |
patch_survey | write or manage |
delete_survey | write or manage |
Local Setup
Start Formbricks and prepare the database:Codex Configuration
Store the API key in the shell environment:Claude Configuration
Claude Code
Set the API key:.mcp.json and keep the API key outside git:
FORMBRICKS_MCP_API_KEY is not set.
Claude Desktop
If the installed Claude Desktop build supports remote HTTP MCP server entries, add the same server definition to the Claude Desktop config file and restart Claude Desktop. macOS config path:Tool Responses
Tool results include bothstructuredContent and a text content item containing the same JSON string.
Successful results mirror the v3 REST response body and add requestId for correlation.
Errors are returned as MCP error tool results with a structured v3 problem payload:
Available Tools
list_surveys
Lists surveys in one workspace. The tool is read-only and idempotent. Input:get_survey
Gets one survey by ID. The tool is read-only and idempotent. Input:lang is optional. When supplied, it filters translatable survey fields to the requested language
codes or configured aliases.
create_survey
Creates a block-based link survey using the v3 survey document contract. The tool writes data and is not idempotent. Input:GET /api/v3/surveys/{surveyId} and includes the MCP
requestId.
validate_survey
Validates a create or patch payload without writing survey changes. The tool is read-only and idempotent, but create validation still checks workspace write access whenworkspaceId is present.
Create validation input:
200 with valid: false and structured invalid_params, matching
POST /api/v3/surveys/validate.
patch_survey
Updates a survey by ID using the v3 survey patch contract. The tool writes data, can be destructive, and is not idempotent. Omitted top-level fields are preserved. Provided top-level objects and arrays replace that whole subtree, so omitted nested entries inside a provided subtree can be removed. The patch tool does not deep-merge nested objects and does not implement JSON Patch.For agent workflows, fetch the current survey first, modify only the intended top-level fields, run
validate_survey with operation: "patch", and then submit the same patch with patch_survey.GET /api/v3/surveys/{surveyId} and includes the MCP
requestId.
delete_survey
Deletes one survey by ID. The tool is destructive, writes data, and is not idempotent. Input:204 No Content. The MCP tool result contains the requestId
so callers can correlate the audit trail:
Relationship To V3 Surveys API
The MCP server does not run custom survey database queries. Each tool calls the shared server-only v3 survey operations used by the REST routes:| MCP Tool | REST Contract |
|---|---|
list_surveys | GET /api/v3/surveys |
get_survey | GET /api/v3/surveys/{surveyId} |
create_survey | POST /api/v3/surveys |
validate_survey | POST /api/v3/surveys/validate |
patch_survey | PATCH /api/v3/surveys/{surveyId} |
delete_survey | DELETE /api/v3/surveys/{surveyId} |
docs/api-v3-reference/openapi.yml.
Limitations
- Authentication is API-key only. OAuth-based MCP authorization is a separate follow-up.
- The MCP server exposes only the v3 survey operations listed on this page.
- Tool coverage depends on the current v3 Surveys REST endpoint coverage.
create_surveycreates link surveys only. In-app survey creation and distribution settings are not part of the current v3 create operation.patch_surveyfollows the v3 PATCH contract: top-level partial document updates only, no JSON Patch, and no nested deep merge. Provided top-level objects and arrays replace their whole subtree and can remove omitted nested entries.validate_surveyvalidates payload shape and references; it does not create languages, survey versions, or surveys.- Query-string credentials are rejected; use headers for API keys.
- Large request bodies are rejected before the MCP handler using the same body-size policy as v3 APIs.
Implementation Files
apps/web/app/api/mcp/route.tsapps/web/modules/mcp/auth.tsapps/web/modules/mcp/server.tsapps/web/modules/mcp/tools/surveys.tsapps/web/modules/mcp/tools/schemas.tsapps/web/app/api/v3/surveys/lib/operations.ts