LightCMS MCP API Reference

Complete reference for the LightCMS Model Context Protocol (MCP) server. Enable AI agents like Claude Code to manage your website through natural language conversations.

Overview

The LightCMS MCP server exposes 41 tools organized into these categories:

CategoryToolsDescription
Content12Create, edit, publish, version, and delete content
Templates5Define content structures with custom fields
Assets5Upload and manage images, documents, and files
Theme2Customize colors, fonts, header/footer
Site Config2Configure site-wide settings
Redirects4Manage URL redirects
Folders4Organize content into URL hierarchies
Collections5Group and display content by category
Search3Search content and perform bulk find/replace
Utility1Regenerate all static pages

Content Tools

list_content

List all content items with optional filters.

Parameters

NameTypeRequiredDescription
folder_idstringNoFilter by folder ID (MongoDB ObjectID)
categorystringNoFilter by content category
include_deletedbooleanNoInclude soft-deleted content

Returns: Array of content summaries with id, title, slug, full_path, category, published, deleted, updated_at, published_at.

get_content

Get a single content item by ID or path.

Parameters

NameTypeRequiredDescription
idstringNo*Content ID (MongoDB ObjectID)
pathstringNo*Content path (e.g., /about or /blog/my-post)

*One of id or path is required.

Returns: Complete content object including all field data.

create_content

Create a new content item.

Parameters

NameTypeRequiredDescription
template_idstringYesTemplate ID (MongoDB ObjectID)
titlestringYesContent title
slugstringYesURL slug for the content
dataobjectYesTemplate field values
folder_pathstringNoFolder path (e.g., /blog)
categorystringNoContent category for collections
meta_descriptionstringNoSEO meta description
og_imagestringNoOpen Graph image URL
use_headerbooleanNoInclude site header (default: true)
use_footerbooleanNoInclude site footer (default: true)
use_themebooleanNoApply site theme/layout (default: true)
raw_modebooleanNoUse raw HTML mode
publishedbooleanNoPublish immediately
version_commentstringNoOptional comment describing this version

Returns: { success, id, full_path, message }

Example

{
  "template_id": "6971098ad0761968133b8e43",
  "title": "My First Post",
  "slug": "my-first-post",
  "folder_path": "/blog",
  "category": "blog",
  "data": {
    "excerpt": "A brief introduction...",
    "content": "<p>Full article content here...</p>",
    "author": "Jane Doe"
  },
  "published": true,
  "version_comment": "Initial creation"
}

update_content

Update an existing content item. Creates a new version automatically.

Parameters

NameTypeRequiredDescription
idstringYesContent ID (MongoDB ObjectID)
template_idstringNoChange template
titlestringNoUpdate title
slugstringNoUpdate URL slug
folder_pathstringNoMove to different folder
categorystringNoUpdate category
meta_descriptionstringNoUpdate SEO description
og_imagestringNoUpdate Open Graph image
dataobjectNoUpdate field values
use_headerbooleanNoToggle site header
use_footerbooleanNoToggle site footer
use_themebooleanNoToggle theme
raw_modebooleanNoToggle raw HTML mode
version_commentstringNoOptional comment describing this version change

Only include fields you want to change.

Returns: { success, id, full_path, message }

publish_content

Publish a content item, making it visible on the public site.

Parameters

NameTypeRequiredDescription
idstringYesContent ID (MongoDB ObjectID)

Returns: Success message.

unpublish_content

Remove content from the public site (keeps it in the system).

Parameters

NameTypeRequiredDescription
idstringYesContent ID (MongoDB ObjectID)

Returns: Success message.

delete_content

Soft-delete a content item. Can be restored later.

Parameters

NameTypeRequiredDescription
idstringYesContent ID (MongoDB ObjectID)

Returns: Success message.

restore_content

Restore a soft-deleted content item.

Parameters

NameTypeRequiredDescription
idstringYesContent ID (MongoDB ObjectID)

Returns: Success message.

get_content_versions

Get version history for a content item.

Parameters

NameTypeRequiredDescription
content_idstringYesContent ID (MongoDB ObjectID)

Returns: Array of version summaries with version number, title, slug, full_path, published, comment (if any), created_at.

get_content_version

Get a specific version of a content item.

Parameters

NameTypeRequiredDescription
content_idstringYesContent ID (MongoDB ObjectID)
versionintegerYesVersion number

Returns: Complete content object at that version, including comment if any.

revert_to_version

Revert content to a previous version. Creates a new version with the old data.

Parameters

NameTypeRequiredDescription
content_idstringYesContent ID (MongoDB ObjectID)
versionintegerYesVersion number to revert to
version_commentstringNoOptional comment for the revert (e.g., "Reverted to v3")

Returns: Success message.

Template Tools

list_templates

List all available templates.

Parameters

None

Returns: Array of template summaries with id, name, slug, description, category, is_system, field_count.

get_template

Get a template by ID or slug.

Parameters

NameTypeRequiredDescription
idstringNo*Template ID (MongoDB ObjectID)
slugstringNo*Template slug

*One of id or slug is required.

Returns: Complete template including fields array and html_layout.

create_template

Create a new template.

Parameters

NameTypeRequiredDescription
namestringYesTemplate name
slugstringYesTemplate slug for URLs
fieldsarrayYesField definitions (see below)
html_layoutstringYesHTML with {{.FieldName}} placeholders
descriptionstringNoTemplate description
categorystringNoTemplate category

Field Definition

{
  "name": "field_name",
  "label": "Display Label",
  "type": "text|textarea|richtext|date|image|select",
  "required": true,
  "placeholder": "Placeholder text",
  "default": "Default value",
  "options": "option1,option2,option3"
}

Returns: { success, id, message }

update_template

Update an existing template. Changing html_layout regenerates all content using this template.

Parameters

NameTypeRequiredDescription
idstringYesTemplate ID (MongoDB ObjectID)
namestringNoUpdate name
slugstringNoUpdate slug
descriptionstringNoUpdate description
categorystringNoUpdate category
fieldsarrayNoUpdate field definitions
html_layoutstringNoUpdate HTML layout

Returns: { success, id, message }

delete_template

Delete a template. Cannot delete system templates or templates with existing content.

Parameters

NameTypeRequiredDescription
idstringYesTemplate ID (MongoDB ObjectID)

Returns: Success message.

Asset Tools

list_assets

List all assets in the library.

Parameters

NameTypeRequiredDescription
folderstringNoFilter by folder path (e.g., /images)

Returns: Array of asset summaries with id, filename, folder, serve_path, mime_type, size, description, created_at.

list_asset_folders

List all unique folder paths in the asset library.

Parameters

None

Returns: Array of folder path strings.

get_asset

Get asset metadata by ID or path.

Parameters

NameTypeRequiredDescription
idstringNo*Asset ID (MongoDB ObjectID)
pathstringNo*Asset serve path (e.g., /images/logo.png)

*One of id or path is required.

Returns: Asset metadata (not file content—use serve_path to access the file).

upload_asset

Upload a new asset.

Parameters

NameTypeRequiredDescription
filenamestringYesOriginal filename with extension
serve_pathstringYesURL path (e.g., /images/logo.png)
data_base64stringYesBase64-encoded file content
descriptionstringNoAsset description

Allowed file types: Images (jpg, png, gif, webp, svg, ico), Documents (pdf, doc, docx, txt, md), Web (css, js, json, xml, html), Fonts (woff, woff2, ttf, otf, eot)

Returns: { success, id, serve_path, mime_type, size, message }

delete_asset

Delete an asset.

Parameters

NameTypeRequiredDescription
idstringYesAsset ID (MongoDB ObjectID)

Returns: Success message.

Theme Tools

get_theme

Get current theme settings.

Parameters

None

Returns: Theme object with all settings: colors (primary_color, secondary_color, accent_color, background_color, text_color), typography (font_family, heading_font, border_radius), branding (site_name, site_tagline, logo_url), custom (custom_css, head_html, header_html, footer_html).

update_theme

Update theme settings. Changing header_html or footer_html regenerates all published content.

Parameters (all optional)

NameTypeDescription
primary_colorstringHex color (e.g., #6366f1)
secondary_colorstringHex color
accent_colorstringHex color
background_colorstringHex color
text_colorstringHex color
font_familystringCSS font (e.g., Inter, sans-serif)
heading_fontstringCSS font for headings
border_radiusstringCSS value (e.g., 12px)
site_namestringSite name
site_taglinestringSite tagline
logo_urlstringLogo image URL
custom_cssstringAdditional CSS
head_htmlstringCustom <head> HTML
header_htmlstringCustom header HTML
footer_htmlstringCustom footer HTML

Returns: Success message.

Site Config Tools

get_site_config

Get site configuration.

Parameters

None

Returns: Site config with title_template and title_template_no_title.

update_site_config

Update site configuration.

Parameters

NameTypeRequiredDescription
title_templatestringNoTitle template with {{title}} and {{site_name}}
title_template_no_titlestringNoTitle when page has no title

Example: "{{title}} | {{site_name}}"

Returns: Success message.

Redirect Tools

list_redirects

List all URL redirects.

Parameters

None

Returns: Array of redirects with id, from_path, to_path, status_code, description.

create_redirect

Create a new redirect.

Parameters

NameTypeRequiredDescription
from_pathstringYesSource path (e.g., /old-page)
to_pathstringYesDestination path or URL
status_codeintegerNo301 (permanent) or 302 (temporary). Default: 301
descriptionstringNoDescription/note

Returns: { success, id, message }

update_redirect

Update an existing redirect.

Parameters

NameTypeRequiredDescription
idstringYesRedirect ID (MongoDB ObjectID)
from_pathstringNoUpdate source path
to_pathstringNoUpdate destination
status_codeintegerNoUpdate status code
descriptionstringNoUpdate description

Returns: Success message.

delete_redirect

Delete a redirect.

Parameters

NameTypeRequiredDescription
idstringYesRedirect ID (MongoDB ObjectID)

Returns: Success message.

Folder Tools

list_folders

List all content folders.

Parameters

None

Returns: Array of folders with id, name, slug, path, parent_id.

create_folder

Create a new folder.

Parameters

NameTypeRequiredDescription
namestringYesDisplay name
slugstringYesURL segment
parent_idstringNoParent folder ID for nesting

Returns: { success, id, path, message }

get_folder

Get a folder by ID.

Parameters

NameTypeRequiredDescription
idstringYesFolder ID (MongoDB ObjectID)

Returns: Complete folder object.

delete_folder

Delete an empty folder.

Parameters

NameTypeRequiredDescription
idstringYesFolder ID (MongoDB ObjectID)

Cannot delete folders containing content or subfolders.

Returns: Success message.

Collection Tools

list_collections

List all content collections.

Parameters

None

Returns: Array of collections with id, name, slug, description, category, sort_field, sort_order, items_per_page.

create_collection

Create a new collection.

Parameters

NameTypeRequiredDescription
namestringYesCollection name
slugstringYesURL slug
descriptionstringNoDescription
categorystringNoContent category to include
sort_fieldstringNoField to sort by
sort_orderstringNoasc or desc
item_templatestringNoHTML template for each item
page_templatestringNoHTML template for collection page
items_per_pageintegerNoPagination size

Returns: { success, id, message }

get_collection

Get a collection by ID.

Parameters

NameTypeRequiredDescription
idstringYesCollection ID (MongoDB ObjectID)

Returns: Complete collection object.

update_collection

Update a collection.

Parameters

NameTypeRequiredDescription
idstringYesCollection ID (MongoDB ObjectID)
namestringNoUpdate name
slugstringNoUpdate slug
descriptionstringNoUpdate description
categorystringNoUpdate category filter
sort_fieldstringNoUpdate sort field
sort_orderstringNoUpdate sort order
item_templatestringNoUpdate item template
page_templatestringNoUpdate page template
items_per_pageintegerNoUpdate pagination

Returns: Success message.

delete_collection

Delete a collection. Does not delete the content in the collection.

Parameters

NameTypeRequiredDescription
idstringYesCollection ID (MongoDB ObjectID)

Returns: Success message.

Search Tools

search_content

Search across all content items by title or full text.

Parameters

NameTypeRequiredDescription
querystringYesSearch query string
search_typestringNoname (title only) or fulltext (all fields). Default: fulltext
include_deletedbooleanNoInclude soft-deleted content

Returns: Object with query, search_type, total count, and matches array. Each match includes id, title, full_path, template_name, published status, and matched_in (array of field names where match was found).

Example

{
  "query": "artificial intelligence",
  "search_type": "fulltext"
}

search_replace_preview

Preview search and replace results without making changes. Always use this before search_replace_execute to understand the impact.

Parameters

NameTypeRequiredDescription
searchstringYesText to search for
replacestringYesText to replace with

Returns: Object with search/replace terms, total_matches, affected_pages, published_pages, draft_pages, and matches array with details including match counts per field and sample excerpts.

Example

{
  "search": "http://example.com",
  "replace": "https://example.com"
}

search_replace_execute

⚠ WARNING: Destructive Operation

Execute search and replace across all content. This permanently modifies content. Always run search_replace_preview first to review what will be changed.

Parameters

NameTypeRequiredDescription
searchstringYesText to search for
replacestringYesText to replace with
version_commentstringNoComment for version history. Default: "Bulk search and replace: 'X' → 'Y'"

Returns: Object with success status, total_replacements, pages_updated, published_pages, version_comment, and updated_pages array with details.

Safety Notes:

  • Each modified content item gets a new version, so changes can be reverted
  • Preview your changes first with search_replace_preview
  • The operation searches in both titles and all content data fields
  • Published pages are automatically regenerated after replacement

Utility Tools

regenerate_all_content

Regenerate all published static HTML pages. Use after major theme or template changes.

Parameters

None

Returns: Success message with count of regenerated pages.

Common Workflows

Create a Blog

  1. Create a folder: create_folder with name "Blog", slug "blog"
  2. Create posts: create_content with folder_path "/blog", category "blog"
  3. Create collection: create_collection with category "blog" to list all posts

Update Site Branding

  1. Get current theme: get_theme
  2. Update colors/fonts: update_theme with new values
  3. Update header/footer HTML if needed (triggers regeneration)

Manage Content Versions

  1. List versions: get_content_versions
  2. View old version: get_content_version
  3. Restore if needed: revert_to_version

Set Up Redirects

  1. List existing: list_redirects
  2. Create redirect: create_redirect with from_path, to_path
  3. Use 301 for permanent moves, 302 for temporary

Bulk Update Links or Text

  1. Preview changes: search_replace_preview with search and replace terms
  2. Review affected pages and match counts carefully
  3. Execute changes: search_replace_execute (creates versions for rollback)
  4. If needed, revert individual pages: revert_to_version

← Back to LightCMS Documentation