Skip to main content
Glama

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

Related MCP server: DocGen MCP Server

šŸ—ļø 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.

-
security - not tested
-
license - not tested
-
quality - not tested

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/teampromptpioneers/mcptemplate'

If you have feedback or need assistance with the MCP directory API, please join our Discord server