Skip to content

Documentation

AI Integration & Local Knowledge Core

Guide to the high-performance hosted MCP Server, local RAG pipeline, and agentic content tools.

7/7/2026
18 min read Edit on GitHub
Note

Competitive comparisons based on publicly available documentation as of June 2026. Performance data self-measured via bun test tests/benchmarks/.

SveltyCMS 2026 leverages a fully implemented and hosted Model Context Protocol (MCP) server to provide AI agents with deep, real-time project knowledge — combined with a local WebMCP bridge for secure, draft-gated content management.

Tip

Status: Fully Implemented. Your AI integration is powered by the SveltyCMS Hosted Knowledge Core.

  • Hosted (Primary): https://mcp.sveltycms.com/mcp (Cloud-native agentic memory)
  • Real-time Tools: SSE-based live access to codebase, docs, and system schemas.
  • Local (RAG): Fallback for local environments using LanceDB.
  • WebMCP Bridge: Browser-based AI agent tools for content CRUD, navigation, and quality scoring.

SveltyCMS MCP vs Competitors

Based on publicly available documentation as of June 2026, SveltyCMS offers MCP capabilities that other headless CMS platforms are beginning to adopt.

Capability SveltyCMS PayloadCMS (new) Strapi (new) Directus (new)
Semantic vector search search_knowledge_base
Source code reading read_source_code
Project file tree get_file_tree, list_directory
Content CRUD via MCP ✅ WebMCP (7 tools, draft-gated) @payloadcms/plugin-mcp (granular) ✅ Collection/single-type
Content quality scoring score_content (AI Co-Pilot)
Generative UI layouts ✅ Agentic Dashboard via json-render-svelte
Enterprise awareness ✅ Trash recovery, DLQ, Yjs presence
Bulk AI translation /api/ai/translate-collection
Agentic automation tasks agentic_task operation in Automation Builder

| AI Widget Scaffolder | ✅ Generate 3-pillar widgets from config | ❌ | ❌ | ❌ | | Marketplace | ✅ Hosted marketplace.sveltycms.com + API client | ✅ Built-in marketplace | ❌ (GitHub only) | ⚠️ Marketplace | | Behavioral Learning | ✅ Server-side access pattern tracking + prefetch | ❌ | ❌ | ❌ |

| Security | ✅ Draft airgap + prompt injection shield + tarpit | ✅ API Key + granular opt-in | ❌ (just permissions) | ✅ OAuth flow | | Local inference (server) | ✅ Ollama + LanceDB | ❌ | ❌ | ❌ | | Browser inference (client) | ✅ LiteRT.js (WebGPU/XNNPACK) | ❌ | ❌ | ❌ | | Content similarity | ✅ Semantic index + collaborative filtering | ❌ | ❌ | ❌ | | Smart field defaults | ✅ Learns from recent entries per collection | ❌ | ❌ | ❌ | | Auto-Tagging (NPU) | ✅ Ollama NPU or keyword extraction | ❌ | ❌ | ❌ |

| Anomaly detection | ✅ Statistical z-score analysis | ❌ | ❌ | ❌ | | Adaptive UI reordering | ✅ Sorts sidebar by usage frequency | ❌ | ❌ | ❌ | | Smart scheduling | ✅ Suggests publish times from editor activity | ❌ | ❌ | ❌ | | SSE real-time | ✅ | ✅ | ✅ | ✅ |


1. Hosted MCP Server (mcp.sveltycms.com)

The hosted Knowledge Core provides absolute project context for remote AI agents (Claude, ChatGPT, etc.):

  • Full SSE Protocol: Uses standard Server-Sent Events for real-time tool access and discovery.
  • Project-Wide Search: Semantic search across the entire SveltyCMS ecosystem (Docs + Code).
  • Schema Awareness: Understands your specific collection schemas and widget configurations.
  • Read-Only Safety: Agents can study the codebase and docs but cannot modify data.

2. The Local Knowledge Core

This service acts as the “Long-term Memory” for SveltyCMS locally:

  • Hardware Accelerated Indexing: Uses local AI acceleration (e.g. NPU/GPU) to handle embeddings.
  • Deep Implementation Knowledge: Indexes src/, docs/, and package.json expert patterns.
  • Expert Discovery: Automatically syncs with llms-full.txt from Svelte 5, Native UI, and Valibot.

3. WebMCP Browser Bridge (Content CRUD)

The WebMCP plugin (src/plugins/webmcp/) enables browser-based AI agents to interact with CMS content through a secure, schema-aware API bridge. All tools enforce the Draft-by-Default Airgap.

Available WebMCP Tools

Tool Type Description
get_collections Read Returns all collections with schemas and field definitions
list_entries Read Paginated entry listing with sort, filter, and publication status
search_entries Read Full-text cross-collection search
get_entry Read Retrieve a single entry by collection and ID
create_entry Write Create entry (always forced to status: "draft")
update_entry Write Update entry (always forced to status: "draft", human review required)
delete_entry Write Soft-delete entry (moves to Trash, recoverable by admin, no permanent deletion)
score_content AI AI-powered content quality scoring (SEO, readability, completeness)

| navigate_to | Nav | Navigate to a specific admin path | | get_current_route | Nav | Returns current admin route and parameters |

Important

Draft-by-Default Airgap: All mutation tools (create_entry, update_entry) forcefully set status: "draft". The delete_entry tool only performs soft-deletes (never permanent=true). This ensures AI agents cannot publish or permanently destroy content without human review.

4. AI-Native Generative Layouts

SveltyCMS pushes beyond Chat-based AI into interactive generative layouts powered by json-render-svelte. When a user prompts the MCP Server or the local AI service to build a complex collection form or a custom dashboard view, the LLM outputs a structured JSON spec. This spec is then fed directly into our <Renderer> component, instantly generating a fully functional, state-bound Svelte 5 interface utilizing your exact widgets and plugins without touching the codebase.

Where Generative UI is Integrated:

  • Agentic Dashboard: The main dashboard features an “AI Dashboard Mode” that bypasses manual grid configuration. It now supports interactive re-prompting, allowing users to refine the layout in real-time. A live status indicator confirms connection to the hosted Knowledge Core at mcp.sveltycms.com.
  • Collection Builder: Translates schema configurations into live preview specs for immediate visual feedback of your custom fields using the same rendering engine.
  • AI Service: The robust local AIService directly integrates with Ollama…

Core Generative Components

SveltyCMS provides a suite of AI-native components registered in the sveltyRegistry:

  1. Layouts: VerticalLayout and HorizontalLayout for structural composition.
  2. Typography: Text widget for content rendering and AI snapshots.
  3. Controls: Smart control wrappers that bind AI-generated specs to the local component state.

5. AI Co-Pilot Capabilities

The AIService (src/services/core/ai-service.ts) provides schema-aware AI capabilities not commonly found in other CMS platforms:

Content Quality Scoring {#ai-copilot-scoring}

Evaluates content for SEO, readability, and completeness, returning actionable suggestions:

POST /api/ai/score
Content-Type: application/json

{
  "content": { "title": "...", "body": "..." },
  "collectionName": "blog-posts"
}

Response:

{
  "score": 78,
  "seoScore": 85,
  "readabilityScore": 72,
  "suggestions": ["Add meta description", "Shorten paragraph 3"]
}

Schema-Aware Field Suggestions

Given a collection name and description, suggests optimal widget types and field configurations:

POST /api/ai/suggest-fields
Content-Type: application/json

{
  "collectionName": "recipes",
  "description": "Cooking recipes with ingredients and instructions",
  "availableWidgets": ["InputText", "RichText", "ImageArray", "Tags"]
}

Per-Field AI Translation

Each translated field now has an inline ✨ AI Translate button for one-click field translation. Uses POST /api/ai/translate with caching (30min TTL), rate limiting (50/min/user), audit logging, and graceful degradation. Service at src/services/ai-translation.ts.

Bulk AI Content Localization

SveltyCMS also offers a bulk endpoint for translating entire collections:

POST /api/ai/translate-collection
Content-Type: application/json

{
  "collectionName": "blog-posts",
  "targetLanguages": ["de", "fr", "es"],
  "sourceLanguage": "en"
}

Response:

{
  "success": true,
  "jobId": "job_abc123",
  "message": "Bulk translation dispatched for blog-posts → [de, fr, es]"
}

The job runs in the background via the Job Queue Service, iterating through entries, identifying missing locales, and generating translations while respecting field-level constraints. Track progress via /api/system/jobs/{jobId}.


6. Agentic Automation Tasks

The Automation Builder now includes an Agentic Task operation type, enabling AI-powered content processing as part of event-driven workflows.

Supported Task Types

Task Type Description
summarize Generates a concise summary of the entry content
translate Translates content to a target language
enrich Rewrites content for clarity and quality
classify Classifies content into categories (news, tutorial, reference…)
generate_tags Generates descriptive tags for the content

Example: Auto-Tag on Publish

Create an automation that auto-generates tags whenever content is published:

  1. Trigger: entry:publish
  2. Operation: Agentic Task — generate_tags, Target Field: tags

The AI processes the entry content locally via Ollama (privacy-first) and writes the result back to the entry.


6b. AI Widget Scaffolder (Code Generation)

The Widget Scaffolder (src/services/intelligence/ai-codegen/widget-scaffolder.ts) generates complete SveltyCMS 3-pillar widgets from a configuration object. This directly closes the plugin ecosystem gap — instead of needing hundreds of community plugins, developers describe what they need and get production-ready code instantly.

What it generates

Pillar File Contents
Definition index.ts createWidget() with auto-inferred Valibot validators, GuiSchema, and type-safe props
Input Input.svelte Svelte 5 runes with $bindable props, Tailwind v4, WCAG 2.2 AA ARIA labels
Display Display.svelte Responsive rendering with graceful empty-state handling

Supported field types

text · number · richtext · select · toggle · color · media · date

Usage

import { generateWidget } from "@src/services/intelligence/ai-codegen/widget-scaffolder";

await generateWidget({
  name: "StarRating",
  label: "Star Rating",
  description: "A 5-star rating widget with half-star support",
  icon: "mdi:star",
  fields: [
    {
      name: "rating",
      label: "Rating",
      type: "number",
      required: true,
      min: 1,
      max: 5,
    },
    {
      name: "label",
      label: "Label",
      type: "text",
      placeholder: "e.g. Quality",
    },
  ],
});

// Output:
// src/widgets/core/star-rating/index.ts       ← Definition + Valibot schema
// src/widgets/core/star-rating/Input.svelte    ← Editor component
// src/widgets/core/star-rating/Display.svelte  ← Frontend renderer

LLM Integration

The scaffolder accepts structured configs, making it ideal for LLM-generated prompts:

User: "Create a testimonial carousel widget with name, role, quote, and avatar"

LLM generates WidgetScaffoldConfig

scaffoldWidget(config) → 3 production-ready files

This is how SveltyCMS closes the plugin ecosystem gap — generated custom code on demand instead of maintaining a marketplace.


6c. Behavioral Learning Engine

The Behavioral Learning Engine (src/services/intelligence/behavioral-learner.ts) tracks server-side access patterns to make the CMS smarter over time — zero client overhead, zero PII, zero latency.

How it works

  • Every page load in +layout.server.ts records collection and entry access
  • Exponential decay weighting (24h half-life) keeps scores current
  • In-memory Map operations only — sub-microsecond, no per-request I/O
  • Auto-persists to cache layer every 15 minutes, restores on startup

What it enables

All three integrations are active and wired:

Consumer API Description
Cache Warming getHotCollections() Pre-warms cache for most-accessed content on startup
Smart Prefetch predictNextPath() Adds <link rel="prefetch"> for likely next pages
Dashboard Order getHotCollections() Sorts widgets by actual usage frequency

See Behavioral Learning Architecture for full documentation.

n---

6d. Content Intelligence (Similarity, Defaults, Quality, Auto-Tagging)

The Content Intelligence service (src/services/intelligence/content-insights.ts) provides four AI-powered editorial assistants — all server-side, privacy-first, NPU-accelerated when Ollama is available:

Content Similarity Suggestions

When editing an entry, the system queries the semantic index for similar entries in the same collection — “Editors who worked on this also edited…” style recommendations.

import { findSimilarEntries } from "@src/services/intelligence/content-insights";

const similar = await findSimilarEntries("posts", "entry-abc123", 5);
// → [{ entryId: "def456", title: "Related Post", score: 0.82, reason: "Similar content" }]

Smart Field Defaults

Learns from the most recent entries in a collection to suggest default field values. For example, if 80% of recent blog posts have category: "technology", the field auto-suggests that value.

import { suggestFieldDefaults } from "@src/services/intelligence/content-insights";

const default_category = await suggestFieldDefaults("posts", "category");
// → { fieldName: "category", suggestedValue: "technology", confidence: 0.8, basedOn: 15 }

Content Quality Scoring {#content-quality-scoring-2}

Analyzes content across three dimensions — readability, completeness, and SEO — with specific, actionable suggestions:

import { scoreContentQuality } from "@src/services/intelligence/content-insights";

const quality = scoreContentQuality({
  title: "My Post",
  body: "...",
  description: "...",
  hasImage: true,
  hasTags: false,
});
// → { overall: 72, readability: 80, completeness: 65, seo: 70, suggestions: ["Add tags..."] }

Auto-Tagging

Generates tags from content analysis — uses Ollama NPU for intelligent tag extraction when available, keyword frequency analysis as fallback. See src/utils/auto-tag.ts for the save-integration wrapper.

import { generateTags } from "@src/services/intelligence/content-insights";

const tags = await generateTags(
  "A guide to headless CMS architecture and performance optimization",
);
// → [{ tag: "headless-cms", confidence: 0.9, source: "ai" }, { tag: "performance", confidence: 0.85, source: "ai" }]

6e. Anomaly Detection

The Anomaly Detector (src/services/intelligence/anomaly-detector.ts) uses statistical z-score analysis to flag unusual editorial patterns — no ML training data needed:

Detection Type Method Example
Edit spikes z-score > 2.5 on hourly edit rate Bulk content attack detection
Bulk changes z-score > 2.5 on average edit size Potential defacement
Deletion rate z-score > 2.5 on hourly deletions Mass deletion anomaly
Off-hours activity >3 collections edited at 22:00–06:00 Unauthorized access pattern
import {
  recordEdit,
  recordDeletion,
  detectAnomalies,
} from "@src/services/intelligence/anomaly-detector";

recordEdit("posts", 12500); // Called after each save
const anomalies = detectAnomalies(); // Run periodically or on-demand

6f. Adaptive UI & Smart Scheduling

Adaptive UI Reordering

The sidebar, dashboard widgets, and navigation items automatically reorder based on actual usage frequency — zero configuration. Powered by getAdaptiveUISortOrder() and reorderByUsage().

import { reorderByUsage } from "@src/utils/adaptive-ui.svelte";

const items = [
  { id: "posts", label: "Posts", path: "/en/posts" },
  { id: "pages", label: "Pages", path: "/en/pages" },
];
const reordered = reorderByUsage(items, tenantId);
// Posts (47x/week) appears before Pages (12x/week)

Smart Scheduling

Suggests optimal publish times based on editor activity patterns. Falls back to industry-standard recommendations (Tue-Thu, 8-10 AM) when insufficient behavioral data exists.

import { suggestPublishTimes } from "@src/services/intelligence/content-insights";

const times = suggestPublishTimes(tenantId);
// → [{ hour: 9, dayOfWeek: 2, confidence: 0.8, rationale: "Based on 5 active collections..." }]

7. Enterprise Awareness: Beyond Content

The SveltyCMS Knowledge Core understands the CMS’s own operational infrastructure, enabling AI agents to assist with high-level administrative and maintenance tasks.

7.1 Trash & Recovery Logic

The MCP server indexes the Soft Delete “Mangle-on-Delete” patterns.

  • AI Tooling: Agents can help locate “lost” content by querying the Trash Bin via semantic search, even if the original slug was mangled (e.g., my-post_DELETED_1742332800).
  • Context: The AI understands that items in the trash are isolated from production APIs but restorable to their original state.

7.2 Durable Webhook & DLQ Monitoring

The Knowledge Core provides real-time visibility into the system’s integration health.

  • Poison Pill Detection: AI agents can analyze failed webhook payloads in the Dead-Letter Queue (DLQ) and suggest fixes for 4xx errors (e.g., “The destination API rejected this JSON because the ‘title’ field was too long”).
  • Retry Strategy: The AI can recommend manual retries for transient 5xx errors based on the high-resolution operation timing bubbled up through the DB adapters.

7.3 Collaboration & State Handshaking

The AI Assistant is aware of the binary Yjs collaboration state.

  • Presence Awareness: The AI understands which users are currently editing which documents via the SSE-based yjs:sync stream.
  • Conflict Resolution: When multiple users edit a complex document, the AI can analyze the Yjs state vector to explain how a specific merge was mathematically resolved.

8. Security & Agentic Boundaries

To ensure enterprise stability while maintaining high agency, SveltyCMS implements several autonomous defense layers:

  • Draft-by-Default Airgap: All content created or modified via the WebMCP tools is forcefully set to status: "draft". This ensures that even if an AI agent is compromised or follows a malformed instruction, it cannot publish directly to the live site without administrative review.
  • Soft-Delete Only: The delete_entry WebMCP tool only performs soft-deletes. Permanent deletion is not exposed to AI agents — items go to Trash and are recoverable by admins.
  • Prompt Injection Shielding: High-sensitivity AI widgets (like AIEnrichment) wrap all user-provided data in <user_data> tags. The system prompt explicitly commands the LLM to treat this data as passive information and ignore any “Ignore previous instructions” payloads.
  • Tarpit Trap: Automated AI crawlers attempting to scrape sensitive system files are identified via honeypot routes and trapped in a high-latency tarpit, effectively slowing down automated reconnaissance attacks.

⌨️ Keyboard Shortcuts (Efficiency)

The AI Assistant is built for power users. Use the following shortcuts from anywhere in the CMS:

Shortcut Action
Mod + J Toggle Assistant: Open or close the AI collaboration panel.
Mod + J (when open) Focus Input: Jump directly to the chat input field.
Alt + 1 Switch to Activity: View the real-time system event stream.
Alt + 2 Switch to Chat: Return to the AI Assistant conversation.
Escape Close: Dismiss the panel instantly.

Usage for Developers

Background Sync

To keep the knowledge base always up-to-date, run the sync service:

bun run sync-service.ts

Online Context Server (Recommended)

Add this to your MCP configuration (e.g., claude_desktop_config.json):

{
  "mcpServers": {
    "sveltycms": {
      "url": "https://mcp.sveltycms.com/mcp"
    }
  }
}

Local Executor Integration

If running the local core directly:

"command": "bun",
"args": ["run", "./mpc-server/index.ts"]

Available Hosted MCP Tools

Once connected, your AI agent can use these read-only tools to explore the SveltyCMS codebase and documentation:

Tool Description Parameters
search_knowledge_base Semantic search across SveltyCMS docs and code via neural vector similarity. query (string), category (code|docs|meta|external), limit (number)
read_source_code Read the full content of any source file from the SveltyCMS project. filePath (string, e.g., src/widgets/index.ts)
list_directory List files and folders in a given directory. dirPath (string, relative directory path)
get_file_tree Get a recursive tree of the project structure up to a specified depth. depth (number, default: 3)
search_code Fast text/regex search across all project files. Finds component imports, function references, and symbol usage. pattern (string), includePattern (string, optional), caseSensitive (boolean, optional), maxResults (number, optional)

All tools are completely read-only — your agent can explore and learn, but cannot modify, delete, or create anything. Sensitive paths like .git, node_modules, and .env are automatically blocked.

AI API Reference

All endpoints require authentication. Admin role required for translate-collection.

Endpoint Method Description
/api/chat POST Real-time chat with AI Assistant (+ EventBus dispatch)
/api/ai/enrich POST Text enrichment (summarize, SEO, tags)
/api/ai/score POST Content quality scoring
/api/ai/suggest-fields POST Schema-aware field suggestions
/api/ai/generate-layout POST Generative UI layout spec
/api/ai/translate-collection POST Bulk collection translation (background)

Deployment & Updates

The SveltyCMS MCP server follows a “Local Build, Remote Host” model:

  1. Local Build: The MCP server is built and bundled on your local development machine using bun run build:mcp (or equivalent build process).
  2. Upload: The resulting bundle/knowledge core is then uploaded to https://mcp.sveltycms.com (or your private hosted instance).
  3. Consumption: AI Agents (like Antigravity or Claude) connect to the hosted endpoint to obtain the most recent project context, regardless of where they are running.

This ensures that the sensitive build process remains local, while the structured agentic knowledge is globally accessible exactly when needed.


Implementation Files

Service File NPU
Behavioral Learner src/services/intelligence/behavioral-learner.ts
Embedding Service src/services/intelligence/embedding-service.ts ✅ Ollama
Semantic Index src/services/intelligence/semantic-index.ts ✅ via embedding
Widget Scaffolder src/services/intelligence/ai-codegen/widget-scaffolder.ts
Marketplace Client src/services/intelligence/marketplace-client.ts
System Monitor src/utils/system-monitor.ts
Rate Limiter src/hooks/handle-rate-limit.ts
Global Search src/utils/global-search-index.ts ✅ via semantic

Related

aimcpragnpulancedbwebmcpagentic
Was this page helpful?