MCP Server
The ElmapiCMS MCP Server connects AI-powered editors and agents to your CMS instance through the Model Context Protocol. Install it in Cursor, Claude Code, or any MCP-compatible tool and manage your collections, fields, content, and assets through natural language.
What It Does
The MCP server gives AI agents direct access to the ElmapiCMS API. Instead of manually creating collections and entering content, you can ask your AI editor to do it for you:
- Create and manage collections — Define collections with fields, validations, and field groups
- Manage fields — Add, update, and reorder fields within any collection
- Create and edit content — Create, update, list, and soft-delete content entries
- Manage assets — Upload, list, and delete media files
- Schema-aware — AI agents can read field type documentation and collection guidelines as built-in MCP resources, so they understand your content structure
Installation
Install the MCP server globally from npm:
npm install -g @elmapicms/mcp-serverOr install it locally in a project:
npm install @elmapicms/mcp-serverYou need Node.js 18 or later installed on your machine.
Configuration
The server requires three environment variables:
| Variable | Description |
|---|---|
ELMAPI_API_URL | Base API URL (e.g., https://your-domain.com/api) |
ELMAPI_API_KEY | API token with the required abilities |
ELMAPI_PROJECT_ID | Project UUID |
You can generate an API token from your project's Settings > API Access page. Make sure the token has the abilities needed for the tools you want to use (see Token Abilities below).
Setting Up in Cursor
Add the following to your Cursor MCP settings file (~/.cursor/mcp.json):
{
"mcpServers": {
"elmapicms": {
"command": "npx",
"args": ["@elmapicms/mcp-server"],
"env": {
"ELMAPI_API_URL": "https://your-domain.com/api",
"ELMAPI_API_KEY": "your-api-key",
"ELMAPI_PROJECT_ID": "your-project-uuid"
}
}
}
}After saving, go to Settings > MCP in Cursor and click the refresh button to start the server.
Setting Up in Claude Code
Add the MCP server using the Claude Code CLI:
claude mcp add elmapicms \
-e ELMAPI_API_URL=https://your-domain.com/api \
-e ELMAPI_API_KEY=your-api-key \
-e ELMAPI_PROJECT_ID=your-project-uuid \
-- npx @elmapicms/mcp-serverAvailable Tools
The MCP server exposes 17 tools across five categories:
Project
| Tool | Description |
|---|---|
get_project | Get project information |
Collections
| Tool | Description |
|---|---|
list_collections | List all collections |
get_collection | Get a collection with its full field schema |
create_collection | Create a collection (with optional batch field creation) |
update_collection | Update a collection's name and slug |
reorder_collections | Reorder collections |
Fields
| Tool | Description |
|---|---|
create_field | Add a field to a collection |
update_field | Update a field |
reorder_fields | Reorder fields within a collection |
Content Entries
| Tool | Description |
|---|---|
list_entries | List entries with advanced where filtering (13 operators, OR groups, relation filtering), sorting, pagination, count, and first |
get_entry | Get a single content entry |
create_entry | Create a content entry |
update_entry | Update a content entry |
delete_entry | Soft-delete a content entry (moves to trash) |
Assets
| Tool | Description |
|---|---|
list_assets | List assets with pagination |
get_asset | Get an asset by UUID or filename |
upload_asset | Upload a file as an asset |
delete_asset | Delete an asset |
Advanced Queries
The list_entries tool supports powerful filtering through the where parameter. You can ask your AI editor to construct complex queries in natural language.
Supported operators: eq, lt, lte, gt, gte, not, like, in, not_in, null, not_null, between, not_between
Examples
Filter products under $50 that are in stock:
{
"where": {
"price": { "lt": 50 },
"in-stock": true
}
}OR group — find entries tagged "clearance" or related to a campaign:
{
"where": {
"or": [
{ "tags": "clearance" },
{ "campaign": { "name": "Summer Sale" } }
]
}
}Sort by price, paginate 12 per page:
{
"sort": "price:asc",
"paginate": 12
}Get just the count of matching entries:
{
"where": { "status": "published" },
"count": true
}The server includes a built-in Query Reference resource with complete documentation on all operators, relation filtering, sorting, and pagination options.
Built-in Resources
The server exposes three reference resources that AI agents can read for context. These help agents understand your CMS without needing prior knowledge of ElmapiCMS:
- Field Types Reference (
elmapicms://field-types) — Complete reference of all 16 field types, their options, validations, and common patterns. - Collections Guide (
elmapicms://collections-guide) — Guide for working with collections, singletons, reserved slugs, and best practices. - Query Reference (
elmapicms://query-reference) — Full documentation for content queries:wherefilters with 13 operators, OR groups, relation filtering, sorting, pagination, and examples.
Token Abilities
Your API token needs the appropriate abilities for the tools you want to use:
| Ability | Tools |
|---|---|
read | list/get collections, entries, assets |
create | create entries, upload assets |
update | update entries |
delete | delete entries, delete assets |
admin | create/update/reorder collections and fields |
For the best experience, create a token with all five abilities: read, create, update, delete, and admin.
Using Multiple Projects
Each MCP server instance connects to one project. To work with multiple projects at the same time, add separate entries in your MCP config:
{
"mcpServers": {
"elmapicms-blog": {
"command": "npx",
"args": ["@elmapicms/mcp-server"],
"env": {
"ELMAPI_API_URL": "https://your-domain.com/api",
"ELMAPI_API_KEY": "blog-project-api-key",
"ELMAPI_PROJECT_ID": "blog-project-uuid"
}
},
"elmapicms-store": {
"command": "npx",
"args": ["@elmapicms/mcp-server"],
"env": {
"ELMAPI_API_URL": "https://your-domain.com/api",
"ELMAPI_API_KEY": "store-project-api-key",
"ELMAPI_PROJECT_ID": "store-project-uuid"
}
}
}
}Example Workflow
Here is an example of what you can do with the MCP server in Cursor:
- Ask Cursor: "Create a Blog Posts collection with title, slug, content, featured image, and published fields"
- Cursor creates the collection and all fields with proper types, validations, and slug configuration
- Ask Cursor: "Create a sample blog post about getting started with headless CMS"
- Cursor creates the entry with generated content across all fields
- Ask Cursor: "Build a Next.js page that fetches and displays blog posts from ElmapiCMS"
- Cursor reads the collection schema and builds a fully typed frontend page
The AI agent handles the entire CMS setup while you focus on your frontend code.
Local Development
If your ElmapiCMS instance runs on a .test domain with a self-signed SSL certificate (e.g., via Laravel Herd), add NODE_TLS_REJECT_UNAUTHORIZED to your env config:
"env": {
"ELMAPI_API_URL": "https://myproject.test/api",
"ELMAPI_API_KEY": "your-api-key",
"ELMAPI_PROJECT_ID": "your-project-uuid",
"NODE_TLS_REJECT_UNAUTHORIZED": "0"
}Only use NODE_TLS_REJECT_UNAUTHORIZED=0 for local development. Do not use this in production.