Integrating MCP into Payload CMS: Architecture and Deployment
A practical account of an embedded Payload CMS MCP server: components, request flow, Vercel deployment, permissions, health checks, and rollback.
Background and goals
The content team needs authorized MCP clients to read and maintain posts, pages, and categories while continuing to use the CMS data model and editorial workflow. MCP credentials limit the capabilities available to each client. In this project, MCP runs inside the Payload CMS admin application rather than as a separate content service. Client operations and the admin interface work with the same content data; the public website remains a separately deployed application that reads published content.
This article describes the implementation and deployment process confirmed in the current codebase. Its examples use roles and generic labels without real domains, addresses, accounts, or credentials.
Overall architecture
The MCP plugin is registered when the CMS starts, and Payload's API routing hosts its HTTP endpoint. A client sends a protected Bearer credential. The plugin verifies the credential and exposes tools according to that credential's capability settings. Tools use Payload's data access layer instead of a separate direct database interface.
Component responsibilities
| Component | Current responsibility |
|---|---|
| CMS admin application | Hosts Payload, the MCP plugin, and API routes; deploys separately from the public website. |
| MCP plugin | Handles protocol requests, credential verification, capability filtering, and native tools derived from Payload models. |
| Native collection tools | Allow authorized reads and mutations of posts, pages, tags, and series; expose media as read-only through MCP. |
| Global configuration tools | Provide authorized reads and updates of site-wide configuration. |
| Custom workflow tools | Support post and page drafts and publication, page structure and SEO updates, and selected interface-label translation tasks. |
| Data and presentation layer | Stores CMS documents in a database and media in object storage; the public website reads published content. |
Native capabilities and custom tools form two control layers: code determines which operations exist, while each MCP credential determines which operations its client can use. Credentials with write access should enable only the capabilities needed for their task.
Request path and data flow
- The client sends a POST request to the CMS MCP endpoint with a protected Bearer credential.
- The plugin verifies the credential and reads its associated user and per-operation capability settings. Invalid credentials cannot invoke tools.
- The client invokes a native or custom workflow tool. Native input shapes come from Payload models; custom tools validate their own arguments.
- The tool reads or writes CMS documents through Payload. The storage adapter handles media files; the current MCP configuration does not allow media writes.
- After a published document changes, the CMS makes a best-effort request to invalidate the public website's related cache. A failed notification does not undo the content save, so the public page still needs checking.
A post appears in the Technical section through its primary tag relationship. Technical is not a separate post collection. The post must have the correct primary tag and be published for the section rules to place it on the public website.
Deployment topology and steps
The CMS admin application and public website share a code repository but deploy as separate Vercel projects. MCP is deployed with the admin application and handles requests in its platform-managed runtime. The repository has no Dockerfile, Compose configuration, or persistent process dedicated to MCP.
Preview and production deployments follow the same logical topology and load their respective environment configuration.
A normal release can follow this sequence:
- Pin compatible versions of Payload, its MCP plugin, and application dependencies. Install dependencies, then run the admin application's tests, type checks, and build.
- Configure database access, CMS signing, media storage, and cross-application notification values for the target environment in the deployment platform. Keep actual values only in the controlled configuration system.
- Have CI pull the target environment configuration, build the admin application, and deploy the resulting artifact. The current repository triggers preview deployment from a designated branch and production deployment from release events.
- In preview, use a minimally privileged test credential to check the connection, tool list, a read-only query, and a controlled write. Check public-site reads and cache invalidation.
- After production deployment, repeat read-only functional checks and inspect the affected public content.
For local development, run pnpm dev:admin from the repository root. To inspect the admin application locally in production mode, build it first and then run its start script. Production does not require a separate MCP process or a custom container start command.
Configuration management
The admin application code registers MCP collections, globals, and custom tools. The CMS stores which capabilities each MCP credential may use. When adding a native capability or a tool, review existing credential permissions rather than assuming an upgrade will grant or revoke access automatically.
Inject sensitive database, signing, media-storage, and cross-application notification values through environment configuration. The repository should contain only variable categories and example templates. Never place real values in an article, command example, client configuration, or log. Admin API functions currently have a 60-second execution limit, so longer work needs a different execution design.
Health checks and observability
The current repository has no dedicated MCP health-check endpoint. After deployment, use an authorized client to initialize the protocol session, list the expected tools, and complete a read-only query. A “method not allowed” response to an ordinary GET request is expected and is not a useful health probe.
Verbose plugin logging is currently disabled. Build logs, platform function logs, CMS errors, and the public website's content result can help trace a failure; the code does not define a dedicated MCP metrics or tracing dashboard. Logs should contain only necessary status and error details, never request credentials or complete sensitive payloads.
Upgrades and rollback
Before an upgrade, check compatibility between Payload and its MCP plugin and commit the lockfile with version changes. In preview, verify the tool list, credential permissions, content reads and writes, and public-site cache invalidation before deploying to production. If data structures change, prepare a backup and validate migrations; reverting code does not restore data automatically.
If a new version fails, disable the affected credentials' write capabilities and redeploy the last verified admin application version. Then recheck the tool list, existing documents, and public pages. Content changes already made will not be reversed by an application rollback and must be reviewed document by document.
Common issues
| Symptom | Check first |
|---|---|
| Request rejected | Is the credential valid, is the client using the intended environment, and is its associated user still available? |
| Connection works but a tool is missing | Is the capability registered in code and enabled for this credential? |
| Opening the endpoint in a browser shows a method error | MCP clients use protocol POST requests; GET is not a functional probe. |
| A write succeeds but the public page still shows old content | Is the post published, is its primary tag correct, and did cross-application cache invalidation succeed? |
| A call times out | Check the platform function limit and operation duration; do not put long-running background work in a synchronous request. |
| MCP cannot upload or modify media | The current configuration allows media reads only; use the authorized CMS media workflow for uploads. |
Security considerations
Create separate credentials for distinct purposes, enable the minimum required tools, and regularly review, rotate, and revoke credentials. Preview and production should use their respective credentials and data connections. Validate client input against each tool's contract. For writes and publication, read the target first, confirm the scope of change, and read it back afterward. Custom tools form their own authorization boundary; review server-side access control, input limits, and logs whenever they change.
This article omits real deployment addresses, machine and network identifiers, accounts, credential values, and internal file paths. Actual operations should follow controlled configuration and deployment records.