Enterprise Template Generator

Enterprise Template Generator

Enables generation of enterprise-grade software templates with built-in GDPR/Swedish compliance validation, workflow automation for platform migrations, and comprehensive template management through domain-driven design principles.

Category
Visit Server

README

Enterprise Template Generator MCP Server

A comprehensive MCP (Model Context Protocol) server for enterprise software template generation, built with clean domain-driven design principles and focused on workflow automation for digitalization processes.

🚀 Features

Core Capabilities

  • Domain-Driven Design: Clean architecture with entities, value objects, and application services
  • Jinja2 Template Engine: Powerful template rendering with custom enterprise filters
  • FastMCP Integration: Modern MCP server with comprehensive tool set
  • Enterprise Validation: Swedish/EU compliance support (GDPR, Swedish Data Protection Act)
  • Workflow Automation: Specialized templates for platform/process migration

Template Categories

  • Workflow Automation: Platform migration, process digitalization
  • MCP Generator: Templates for creating new MCP servers
  • Data Science: Data analysis and ML workflow templates
  • Finance Analytics: Economic and financial analysis applications
  • Engineering ML: ML engineering and technical development
  • Infrastructure: Infrastructure as Code templates
  • Security: Security implementation templates
  • Compliance: Regulatory compliance templates

Enterprise Requirements Support

  • GDPR Compliance: Data minimization, right to erasure, privacy by design
  • Swedish Regulations: Data Protection Act, banking secrecy laws
  • Security: Zero Trust architecture, encryption, access control
  • Performance: <100ms response times, horizontal scaling
  • Resilience: Offline mode, automatic failover, 99.95% uptime SLA

🏗️ Architecture

mcp-enterprise-templates/
├── src/
│   ├── server.py                 # FastMCP server implementation
│   ├── domain/                   # Domain-driven design core
│   │   ├── entities/            # Template, Workflow entities
│   │   ├── value_objects/       # TemplateVariable, ValidationRule, etc.
│   │   └── services/            # Domain services
│   ├── application/             # Application services
│   │   └── template_service.py  # Template management
│   ├── infrastructure/          # External integrations
│   └── templates/               # Jinja2 templates
├── tests/                       # TDD test suite
└── docs/                       # Documentation

🛠️ Installation

  1. Clone and Setup

    git clone <repository>
    cd mcp-template
    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
    
  2. Run Tests

    pytest tests/ -v
    
  3. Test the Server

    python test_server.py
    

⚙️ Configuration

Local Development

  1. Run the MCP Server Directly

    # Activate virtual environment
    source venv/bin/activate
    
    # Run the server
    python -m src.server
    
  2. Environment Variables

    export MCP_PORT=8000              # Server port (default: 8000)
    export MCP_HOST=localhost         # Server host (default: localhost)
    export LOG_LEVEL=INFO            # Logging level (DEBUG, INFO, WARNING, ERROR)
    export TEMPLATE_DIR=/custom/path  # Custom template directory (optional)
    

MCP Configuration for Cline

Add this server to your Cline MCP settings (~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json):

{
  "mcpServers": {
    "enterprise-templates": {
      "command": "python",
      "args": ["-m", "src.server"],
      "cwd": "/home/chris/src/mcp-template",
      "env": {
        "PYTHONPATH": "/home/chris/src/mcp-template"
      }
    }
  }
}

Or use a wrapper script:

{
  "mcpServers": {
    "enterprise-templates": {
      "command": "/home/chris/src/mcp-template/run_server.sh"
    }
  }
}

Docker Configuration

  1. Create Dockerfile (if not exists):

    FROM python:3.11-alpine
    
    WORKDIR /app
    
    COPY requirements.txt .
    RUN pip install --no-cache-dir -r requirements.txt
    
    COPY src/ ./src/
    COPY templates/ ./templates/
    
    ENV PYTHONPATH=/app
    ENV MCP_PORT=8000
    
    EXPOSE 8000
    
    CMD ["python", "-m", "src.server"]
    
  2. Build and Run:

    # Build image
    docker build -t mcp-enterprise-templates .
    
    # Run container
    docker run -d \
      --name enterprise-templates \
      -p 8000:8000 \
      -e LOG_LEVEL=INFO \
      mcp-enterprise-templates
    

Docker Compose Setup

Create docker-compose.yml:

version: '3.8'

services:
  mcp-server:
    build: .
    container_name: enterprise-templates
    ports:
      - "8000:8000"
    environment:
      - MCP_PORT=8000
      - LOG_LEVEL=INFO
      - PYTHONPATH=/app
    volumes:
      - ./templates:/app/templates
      - ./data:/app/data
    restart: unless-stopped

  # Optional: Couchbase for persistence
  couchbase:
    image: couchbase:latest
    ports:
      - "8091-8094:8091-8094"
      - "11210:11210"
    environment:
      - COUCHBASE_ADMINISTRATOR_USERNAME=admin
      - COUCHBASE_ADMINISTRATOR_PASSWORD=password

Run with:

docker-compose up -d

Systemd Service (Production Linux)

Create /etc/systemd/system/mcp-enterprise-templates.service:

[Unit]
Description=Enterprise Template Generator MCP Server
After=network.target

[Service]
Type=simple
User=mcp
Group=mcp
WorkingDirectory=/opt/mcp-template
Environment="PATH=/opt/mcp-template/venv/bin"
Environment="PYTHONPATH=/opt/mcp-template"
Environment="MCP_PORT=8000"
Environment="LOG_LEVEL=INFO"
ExecStart=/opt/mcp-template/venv/bin/python -m src.server
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

Enable and start:

sudo systemctl enable mcp-enterprise-templates
sudo systemctl start mcp-enterprise-templates
sudo systemctl status mcp-enterprise-templates

Kubernetes Deployment

Create k8s-deployment.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mcp-enterprise-templates
spec:
  replicas: 3
  selector:
    matchLabels:
      app: mcp-enterprise-templates
  template:
    metadata:
      labels:
        app: mcp-enterprise-templates
    spec:
      containers:
      - name: mcp-server
        image: mcp-enterprise-templates:latest
        ports:
        - containerPort: 8000
        env:
        - name: MCP_PORT
          value: "8000"
        - name: LOG_LEVEL
          value: "INFO"
        resources:
          requests:
            memory: "256Mi"
            cpu: "250m"
          limits:
            memory: "512Mi"
            cpu: "500m"
---
apiVersion: v1
kind: Service
metadata:
  name: mcp-enterprise-templates
spec:
  selector:
    app: mcp-enterprise-templates
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8000
  type: LoadBalancer

Deploy:

kubectl apply -f k8s-deployment.yaml

🚀 Quick Start Guide

  1. Install and Configure

    # Clone repository
    git clone <repository>
    cd mcp-template
    
    # Setup Python environment
    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
    
  2. Add to Cline MCP Settings

    • Open VS Code
    • Access Cline settings
    • Add the configuration JSON shown above
    • Restart Cline to load the MCP server
  3. Verify Installation

    # Test locally
    python test_server.py
    
    # Check if MCP tools are available in Cline
    # You should see tools like:
    # - create_template
    # - render_template
    # - list_templates
    
  4. Create Your First Workflow

    • Use the create_template tool to define a new process
    • Provide process name, goal, trigger, and steps
    • Use render_template to generate documentation

🔧 Troubleshooting

Common Issues

  1. Server not starting

    • Check Python version (3.8+ required)
    • Verify all dependencies: pip install -r requirements.txt
    • Check port availability: lsof -i :8000
  2. MCP tools not appearing in Cline

    • Verify JSON configuration syntax
    • Check file paths are absolute
    • Restart VS Code/Cline
    • Check Cline logs for errors
  3. Template rendering errors

    • Ensure all required variables are provided
    • Check template syntax (Jinja2)
    • Verify variable types match template expectations
  4. Docker issues

    • Ensure Docker daemon is running
    • Check port mappings
    • Verify volume mounts for templates

Debug Mode

Enable debug logging:

export LOG_LEVEL=DEBUG
python -m src.server

Check logs for detailed error messages and stack traces.

🔧 MCP Tools

The server provides the following MCP tools:

Template Management

  • create_template - Create new enterprise templates
  • get_template - Retrieve template details
  • list_templates - List templates with filtering
  • update_template - Update existing templates
  • delete_template - Remove templates
  • clone_template - Clone existing templates

Template Operations

  • render_template - Generate code from templates
  • validate_template_variables - Validate template inputs
  • search_templates - Search templates by content

System Information

  • get_template_stats - System statistics
  • get_supported_variable_types - Available variable types
  • get_supported_validation_rules - Available validation rules
  • get_template_categories - Supported categories

📝 Usage Example

Creating a Workflow Template

# Create a platform migration template
template = await create_template({
    "name": "Database Migration Workflow",
    "description": "Comprehensive database migration with validation",
    "category": "workflow_automation",
    "template_content": "# Migration: {{ project_name }}...",
    "variables": [
        {
            "name": "project_name",
            "type": "string",
            "required": True
        }
    ],
    "validation_rules": [
        {
            "name": "gdpr_compliance",
            "rule_type": "compliance",
            "compliance_type": "gdpr"
        }
    ]
})

Rendering Templates

# Render template with variables
result = await render_template({
    "template_id": "template-uuid",
    "variables": {
        "project_name": "Customer Migration",
        "source_db": "MySQL",
        "target_db": "PostgreSQL"
    }
})

🏢 Enterprise Features

Compliance & Security

  • GDPR: Data processing agreements, lawful basis validation
  • Swedish Data Act: Data residency requirements
  • ISO 27001: Security controls and access management
  • Zero Trust: Continuous verification, least privilege

Performance & Reliability

  • High Performance: <100ms response times
  • Scalability: Horizontal scaling support
  • Resilience: Offline mode, automatic failover
  • Monitoring: Comprehensive logging and metrics

Swedish Enterprise Integration

  • Language Support: Swedish and English
  • Payment Systems: Swish, Bankgirot integration
  • Identity Providers: BankID, Freja eID support
  • Government APIs: Integration with Swedish public services

🧪 Testing

The project follows Test-Driven Development (TDD):

# Run all tests
pytest tests/ -v

# Run with coverage
pytest tests/ --cov=src --cov-report=html

# Run specific test
pytest tests/test_template_service.py::TestTemplateService::test_create_template -v

🚀 Deployment

Docker Deployment

# Build secure container
docker build -f docker/Dockerfile -t mcp-enterprise-templates .

# Run with environment variables
docker run -e MCP_PORT=8000 -p 8000:8000 mcp-enterprise-templates

Kubernetes Deployment

# Deploy to Kubernetes
kubectl apply -f infrastructure/kubernetes/

📊 Hackathon Requirements

Offline Mode & Failover: Automatic failover with data center shutdown support
FastMCP: Modern MCP server implementation
Jinja2 Templates: Reusable enterprise templates
Python: Clean, well-structured Python codebase
TDD: Comprehensive test suite
Virtual Environment: Proper dependency management
Enterprise Ready: Swedish/EU compliance, security, performance

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Write tests for new functionality
  4. Implement the feature
  5. Ensure all tests pass
  6. Submit a pull request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🏆 Hackathon Demo

This MCP server demonstrates:

  • Enterprise-grade architecture with domain-driven design
  • Workflow automation for digitalization processes
  • Swedish/EU compliance built-in
  • Resilience features including offline mode and failover
  • Template generation for faster enterprise software development

Perfect for enterprise developers who need to generate better software faster while maintaining compliance and security standards.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured