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
访问服务器

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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选