Skip to content

AI agents and MCP

View markdown

KDIGI CMS is an AI-native CMS: a Model Context Protocol server is built in at POST /api/mcp, so AI agents (Claude Code, Codex, Cursor, VS Code, OMP, …) read, write, schedule, publish and SEO-check content directly in the CMS. The agent works as the user who owns the API key: same role, same assigned sites, exactly as when that person signs in to the admin.

The MCP server and the kcms CLI ship in KDIGI CMS 1.2.0. The public demo account cannot create an API key, so try it on a self-hosted install.

GroupTools
Identity, siteswhoami, list_sites, get_site
Find and readsearch_content, get_content (Markdown body, SEO, updatedAt)
Writecreate_post, create_page (draft by default), update_post, update_page
Publishset_status: publish, unpublish, schedule with a future publishedAt
Undotrash_content, restore_from_trash, list_versions, restore_version
Categories, tagslist_taxonomies, create_taxonomy
Mediasearch_media, import_media_from_url, update_media_alt
SEOseo_audit, get_seo_report (the same scorer as the admin)
Otherlist_shortcodes, get_content_urls

Plus the resource kcms://guide/content (Markdown, shortcode and SEO rules) and two prompts, write-post and refresh-seo.

Give each agent or person its own account with the lowest role that does the job: an author only creates drafts, an editor can publish and schedule. Avoid super-admin keys.

  1. A super admin opens Users, creates the account (e.g. ai-writer@example.com) and picks the role and sites.
  2. Open that account, tick Enable API Key, copy the key and Save.
  3. Put the key in an environment variable where the agent runs: export KCMS_API_KEY=change-me.

API-key sessions are restricted on every REST, GraphQL and MCP route: they cannot change the account's email, password, API key, role or sites, cannot create users and cannot delete permanently (only move to the trash). If a key leaks, untick Enable API Key.

The quickest path is the kcms CLI: it writes the right config file for each tool and never copies the key into it.

Terminal window
npm install -g @kdigi/kcms-cli
export KCMS_API_KEY=change-me
kcms setup claude-code --url https://cms.example.com --write --with-skill

Replace claude-code with codex, cursor, vscode, omp or json. Drop --write to only print the config. --with-skill also installs the agent skill that teaches a safe editorial workflow: read before editing, draft first, publish only when asked.

To configure it yourself, for example Claude Code's .mcp.json:

{
"mcpServers": {
"kdigi": {
"type": "http",
"url": "https://cms.example.com/api/mcp",
"headers": { "Authorization": "Bearer ${KCMS_API_KEY}" }
}
}
}

Configs for Codex, Cursor, VS Code, OMP and the stdio bridge (kcms mcp) for stdio-only tools are in the AI integration reference.

  • Drafts first. New documents are drafts; drafts have no public URL, so the agent returns an admin link for you to review.
  • No overwriting someone's fresh edit. Every update carries expectedUpdatedAt from the last read; if someone saved in between, the call fails with conflict and changes nothing.
  • Admin edit locks are respected. If an editor has the document open, the agent gets locked and never steals the lock.
  • Right role, right site. An author cannot publish; sites the key is not a member of are invisible.
  • Undoable. Trash and version history work as in the admin.
  • Logged. Each tool call writes one agent-op log line (tool, user, site, document, outcome), never bodies or keys.

kcms is also a command-line tool: fetch a post as a Markdown file with frontmatter, edit it in your usual editor and push it back.

Terminal window
kcms login --url https://cms.example.com
kcms posts get my-post -o my-post.md
kcms posts update my-post.md
kcms media upload ./cover.webp --alt "Cover"
kcms seo audit
  • The MCP server is on by default; set MCP_ENABLED=false to turn it off (the route answers 404). See configuration.
  • Give /api/mcp at least a 30-second proxy timeout and a rate limit at the reverse proxy (the CMS has none).
  • Use HTTPS only: the key travels in a header.
  • ChatGPT and Claude.ai on the web require OAuth, which is not supported yet; use the desktop/CLI tools above or the stdio bridge.

Full tool list, error handling and connection tests: AI integration reference. What each role may do: Roles and permissions.