Skip to main content

Set Up Freeform MCPNew in 5.19+

Freeform 5.19 adds tools to Craft CMS's Model Context Protocol (MCP) server. A connected client can inspect forms, make permitted edits, preview notifications, and report on submissions. Start with a staging or local Craft project while learning the workflow.

Choose Where to Start

Where you're startingWhat to do
A new projectSet up Craft and install Freeform, then prepare the Craft account.
A Craft and Freeform projectPrepare Freeform and the Craft account, then choose how the client connects.
Craft's authenticated MCP server runningConnect an AI client with the Authorization Endpoint URL. Check that the project is running Freeform 5.19 and the account has Freeform permissions.
An AI client ready to connectAsk your Craft administrator for the authenticated endpoint and a Craft login, or connect locally if the client can run PHP in the Craft project.
An AI provider account or a Freeform AI integrationChoose how your AI service is used, then connect the client and test its Freeform access.

Prepare Freeform and the Craft Account

1

Install or Update Freeform

Install or update to Freeform 5.19 on Craft CMS 5.12.x with PHP 8.2 or later. Complete the plugin installation and any pending Craft migrations. See Installing & Updating.

2

Check the Craft Account

Sign in to the Craft control panel with the account the client will use. Confirm that the account can open Freeform and access the site and form you want to work with.

3

Grant Freeform Permissions

Grant permissions for the intended workflow. Form inspection requires Forms access and permission to manage the target form. Form creation requires Create Forms. Submission queries use submission access and per-form read permissions. Notification, integration, and Activity Log tools have additional checks. Freeform MCP permissions

4

Choose a Site

If Site-Aware Forms is enabled, use a site the account can edit and that the form is available on. Shared form changes may require access to every site using the form. With Site-Aware Forms disabled, use the primary site. Limited Users restrictions still apply.

You can leave both Freeform MCP settings at their defaults for setup. Destructive field changes require control panel approval, and individual submission answers are disabled.

Choose How Your AI Service Is Used

The AI client is the app or agent where you enter a prompt. It uses its configured AI service for the conversation and connects separately to Craft MCP to run Freeform tools. Set up the client's model access through that client. Depending on the client, this can mean signing in to its hosted service or configuring a provider and model in its settings. The Freeform MCP connection itself requires no model API key. Craft authenticates it using a Craft login over HTTP or the account selected by the local command.

If you want AI generation inside Freeform's control panel, configure an AI integration in Freeform → Integrations. For example, authorize SolspaceAI or set up OpenAI or Anthropic with provider credentials and a model. Then open Freeform → Forms → Add new form → Create with AI and choose the enabled integration. This Pro workflow supports text prompts and, with compatible models, PDFs and images. A form created there is available to connected MCP clients with the appropriate form and site permissions. Create Forms with AI

Set Up Authenticated HTTP

Use HTTP when the client connects to a running Craft site and supports MCP with OAuth. The client needs network access to the Craft URL.

1

Generate OAuth Signing Keys

From the Craft project root, generate OAuth signing keys if the project does not already have them.

php craft oauth/generate-keys
2

Enable the Authenticated Server

In the Craft control panel, go to Settings → MCP → Authenticated and enable the authenticated server. Save the setting in an environment where Craft allows admin changes. Craft MCP settings

3

Copy the Authorization Endpoint

Copy the full Authorization Endpoint URL. A typical default is https://forms.example.com/admin/mcp/auth. Use the actual path shown by Craft, especially if your control panel trigger or domain is customized. Craft's authenticated server

4

Authorize the Client

Add that URL to your client. When the browser opens, sign in as the intended Craft account and authorize the connection. Choose Read only for inspection and reports or Read and write for creating forms, updating them, or requesting field change reviews. Craft applies both the OAuth scope and the account's current permissions. Craft MCP access levels

Set Up a Local Connection

Use a local connection when your AI client can run PHP in your Craft project. The client launches the Craft MCP server and exchanges messages with it through standard input and output (stdio).

1

Choose the Craft User

Replace form-editor with an active Craft username, user ID, or email address. The selected account's permissions govern each tool call.

php craft mcp/serve --user=form-editor
2

Configure the Client's Launch Command

Configure the client to start the command above from the Craft project root or pass the full path to the project's craft executable. If the client has separate command and argument settings, use php for the command and craft, mcp/serve, and --user=form-editor as arguments.

For a containerized project, run the command where Craft's PHP runtime and project environment are available. Restart the process after changing the selected user's permissions. Craft's local MCP server

Connect an AI Client

Choose your client below for setup instructions. Hosted clients connect to Craft's HTTPS Authorization Endpoint. Clients that can run PHP in your Craft project can also start a local MCP server.

Using another app? See Other MCP Clients.

ChatGPT on the Web

Use Craft's authenticated HTTP connection with an HTTPS Authorization Endpoint that ChatGPT can reach. Your ChatGPT workspace must allow custom MCP servers.

1

Add Freeform as a Plugin

Open Plugins in ChatGPT on the web. Select +, then Add custom MCP server. Name it Freeform, enter Craft's Authorization Endpoint, and choose OAuth. If prompted for a registration method, select Dynamic Client Registration (DCR), which Craft supports.

2

Create and Connect the Plugin

Review the connection details, create and install the plugin, then complete Craft sign-in when prompted. Choose Read only to try the examples under Verify the Connection.

3

Try a Freeform Prompt

Type @ in the composer and choose Freeform. Ask “Use Freeform to list the Craft sites I can edit and show their handles.”

Add a custom MCP server in ChatGPT


Codex

In the desktop app, open Settings → MCP servers → Add server. Choose Streamable HTTP and enter Craft's Authorization Endpoint, or choose STDIO and enter the local launch command. Save the server and restart when prompted. For HTTP, choose Authenticate if the server asks you to sign in.

In the Codex CLI, register an authenticated HTTP connection with your Craft Authorization Endpoint.

codex mcp add freeform --url https://forms.example.com/admin/mcp/auth

If you still need to authorize the connection, run codex mcp login freeform and sign in to Craft. For a local connection instead, use the command below with your Craft project path and username.

codex mcp add freeform-local -- php /path/to/project/craft mcp/serve --user=form-editor

Use codex mcp list to check the configuration or /mcp in an active Codex session to see the connected server. MCP in Codex


Claude Code

For authenticated HTTP, register the Authorization Endpoint and run /mcp in Claude Code to connect and authorize it.

claude mcp add --transport http freeform https://forms.example.com/admin/mcp/auth

For a local connection, register the PHP command. Replace the example path and username with those for your Craft project.

claude mcp add --transport stdio freeform-local -- php /path/to/project/craft mcp/serve --user=form-editor

Use /mcp to check the connection and its tools. Claude Code MCP documentation


VS Code with Copilot

1

Add an MCP Server

Enter a Copilot chat session, run Chat: Open Customizations, open MCP Servers, and add a server.

2

Enter the Endpoint or Local Command

For authenticated HTTP, choose HTTP and paste Craft's Authorization Endpoint. For a local server, choose Command (stdio) and enter the command above with your Craft project path and username.

3

Save the Server

Name the server freeform and choose the configuration destination for your session, such as Global → Copilot Global for a personal connection.

4

Check the Tool Picker

Complete Craft authorization if the HTTP connection prompts for it and check that the server is available in the session's tool picker. VS Code MCP documentation


Gemini CLI

Run these commands from the project where you use Gemini CLI. For authenticated HTTP, register Craft's Authorization Endpoint.

gemini mcp add --transport http freeform https://forms.example.com/admin/mcp/auth

Start Gemini CLI and run /mcp auth freeform if it asks you to authorize the connection. Complete Craft sign-in in the browser.

For a local connection, register the launch command with your Craft project path and username.

gemini mcp add --transport stdio freeform-local php /path/to/project/craft mcp/serve -- --user=form-editor

In an active Gemini CLI session, use /mcp list to see whether the server is connected. Gemini CLI MCP documentation


OpenAI Responses API

For a custom application using MCP in the Responses API, set OPENAI_API_KEY for the OpenAI JavaScript SDK and obtain the user's access token through Craft's OAuth flow. Pass Craft's reachable Authorization Endpoint as server_url and the Craft token as authorization. This example limits the request to listing editable sites. Handle any tool approval request before reading the result.

import OpenAI from 'openai';

const client = new OpenAI();
const response = await client.responses.create({
model: 'gpt-6.2-astra',
input: 'Use Freeform to list the Craft sites I can edit and show their handles.',
tools: [{
type: 'mcp',
server_label: 'freeform',
server_url: 'https://forms.example.com/admin/mcp/auth',
authorization: process.env.CRAFT_MCP_ACCESS_TOKEN,
allowed_tools: ['freeform.sites.list'],
}],
});

console.log(response.output);

Other MCP Clients

Open your Craft Authorization Endpoint in a browser for client setup instructions. For a hosted client, check that your account or workspace allows custom OAuth MCP servers and that its execution environment can reach the Craft URL. For a local client, use the launch command if it supports stdio. Connecting clients to Craft

Verify the Connection

Names like freeform.forms.list identify the MCP tools your client calls. Ask in plain language and let the client select the tools. If your client shows tool activity, use the names below to check which tool it ran.

1

List Editable Sites

In the client, ask “Use Freeform MCP to list the Craft sites I can edit. Show the site handles.” The client should call freeform.sites.list and return your permitted sites. With Site-Aware Forms disabled, expect the primary site.

2

List Available Forms

Ask “On my primary site, list the Freeform forms I can manage and show their handles.” The client should call freeform.forms.list with the selected site handle.

3

Inspect a Form

Ask “Read the layout for the contact form on that site. Show the page numbers, row order, and required fields.” Use a real form from the previous result. Compare the output from freeform.forms.get with the form in the builder.

When the read checks pass, try the form building and reporting examples. If you are testing write access, start by creating a form with a new handle in a staging or local project. See the Tools Reference for the permissions each tool needs.

Troubleshooting

SymptomWhat to check
OAuth sign-in never startsUse the Authorization Endpoint, confirm OAuth keys are configured, and check that the client can reach that URL from where it runs.
Craft tools appear but Freeform tools are missingVerify Freeform 5.19 is installed and enabled. Check the active Craft account for control panel access, Freeform access, and the relevant Forms or Submissions permissions. Refresh discovery or reconnect after making changes.
Read tools work but edits are unavailableFor HTTP, check the granted scope. If Craft reuses an existing read-only grant, revoke it under My Account → Tokens where available, then authorize the client with Read and write. Check Create Forms and the relevant form and site permissions.
The site or form is unavailableUse the exact handles returned by discovery. Use the primary site when Site-Aware Forms is disabled. Check site assignment, form permissions, and whether the form is archived.
The local server exits or fails to startRun PHP in the Craft project's environment. Verify the command path and the account passed to --user, then inspect the client's server output.
Counts work but answers are unavailableCheck Allow MCP clients to read submission answers and select eligible fields returned by freeform.submissions.forms.