Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 29, 2025

This PR implements a comprehensive MCP (Model Context Protocol) server integration for Mixcore CMS template management, enabling LLMs like Claude to programmatically create and manage theme templates.

Overview

The implementation adds MCP tools that wrap the existing Mixcore template API endpoints, allowing LLMs to interact with the CMS through the standardized Model Context Protocol. This enables natural language-driven template creation and management workflows.

Key Features

🔧 Complete Template Operations

  • List/Search Templates: Filter by theme, folder type, keywords with pagination support
  • CRUD Operations: Create, read, update, and delete templates with proper validation
  • Template Copying: Duplicate existing templates with automatic naming
  • Default Templates: Generate template scaffolds for different folder types
  • Theme Discovery: List available themes and folder types for reference

📋 API Coverage

The MCP tools provide complete coverage of the existing REST API endpoints:

GET    /api/v2/rest/mix-portal/mix-template           → GetTemplates
GET    /api/v2/rest/mix-portal/mix-template/{id}      → GetTemplateById  
POST   /api/v2/rest/mix-portal/mix-template           → CreateTemplate
PUT    /api/v2/rest/mix-portal/mix-template/{id}      → UpdateTemplate
DELETE /api/v2/rest/mix-portal/mix-template/{id}      → DeleteTemplate
GET    /api/v2/rest/mix-portal/mix-template/copy/{id} → CopyTemplate
GET    /api/v2/rest/mix-portal/mix-template/default   → GetDefaultTemplate
POST   /api/v2/rest/mix-portal/mix-template/filter    → FilterTemplates

🎯 LLM Integration Example

{
  "tool": "CreateTemplate",
  "arguments": {
    "fileName": "blog-layout",
    "extension": "cshtml", 
    "folderType": 0,
    "themeId": 1,
    "content": "<!DOCTYPE html>\n<html>...</html>",
    "styles": "<style>/* Modern blog styling */</style>"
  }
}

Implementation Details

New Files Added

  • MixTemplateTools.cs - Main MCP tool implementation with 10 template operations
  • MixTemplateTools.md - Comprehensive documentation and API mapping
  • MixTemplateTools_Examples.md - Real-world usage examples showing blog theme creation

Modified Files

  • StartupExtensions.cs - Registered the new MCP tool in the server configuration

Technical Approach

  • Follows existing patterns: Inherits from BaseMcpTool and uses consistent error handling
  • Database integration: Uses existing ViewModels and UnitOfWork patterns
  • Proper validation: Leverages existing Mixcore validation and business logic
  • Transaction support: Includes rollback capabilities for failed operations

Folder Types Supported

The implementation supports all Mixcore template folder types:

Value Type Description
0 Layouts Layout templates that define overall page structure
1 Pages Page templates for specific pages
2 Modules Module templates for specific functionality
3 Forms Form templates for user input
4 Edms Electronic Document Management System templates
5 Posts Post templates for blog/news content
6 Widgets Widget templates for reusable components
7 Masters Master templates for hierarchical structures

Benefits

  1. Natural Language Interface: LLMs can now create complete website themes through conversational instructions
  2. Programmatic Theme Development: Enables automated template generation and management workflows
  3. Consistency: Uses existing Mixcore infrastructure ensuring data integrity and security
  4. Extensibility: Foundation for additional MCP tools covering other CMS functionality

Validation

  • ✅ All 10 MCP tools implemented with proper attributes and error handling
  • ✅ Comprehensive documentation with real-world examples
  • ✅ Validation script confirms proper implementation patterns
  • ✅ Integration with existing Mixcore architecture verified

This implementation transforms Mixcore CMS into an LLM-friendly platform where AI assistants can create sophisticated website templates through natural language interactions.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 3 commits July 29, 2025 06:16
This commit fixes the style issues introduced in 52b545d according to the output
from dotnet-format.

Details: #786
@Copilot Copilot AI changed the title [WIP] fetch https://modelcontextprotocol.io/quickstart/server#c%23 fetch https://mixcore.net/swagger/index.html Develop the MCP server for Mixcore CMS to able to interact with the following Mixcore CMS's template. This will allow any LLM (eg. Claude) to crea... Implement MCP Server Tools for Mixcore CMS Template Management Jul 29, 2025
@Copilot Copilot AI requested a review from Smilefounder July 29, 2025 06:21
Copilot finished work on behalf of Smilefounder July 29, 2025 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants