Skip to content

LimbicNode42/mc-pea

Repository files navigation

MC-PEA Project

Overview

MC-PEA provides a comprehensive implementation and testing framework for MCP (Model Context Protocol) servers, with production-ready authentication and database integrations. The project includes reference implementations, development templates, and extensive validation tools.

Project Structure

mc-pea/
β”œβ”€β”€ πŸ“š Documentation
β”‚   β”œβ”€β”€ README.md                    # This file
β”‚   β”œβ”€β”€ MCP_MASTER_REFERENCE.md     # Master reference for all MCP development
β”‚   β”œβ”€β”€ docs/
β”‚   β”‚   β”œβ”€β”€ PROJECT_STRUCTURE.md    # Detailed project structure
β”‚   β”‚   β”œβ”€β”€ REQUIREMENTS.md         # Project requirements
β”‚   β”‚   └── archive/                # Historical documentation
β”‚   
β”œβ”€β”€ πŸ—οΈ Implementation
β”‚   β”œβ”€β”€ mcp-servers/                # Production MCP servers
β”‚   β”‚   β”œβ”€β”€ auth-mcp-server/        # Authentication server (Keycloak + Infisical)
β”‚   β”‚   └── db-mcp-server/          # Database server (PostgreSQL)
β”‚   β”‚
β”‚   └── templates/                  # Development templates
β”‚       └── mcp-server-template/    # Canonical template for new servers
β”‚
β”œβ”€β”€ βœ… Testing & Validation
β”‚   β”œβ”€β”€ tests/                      # All test and validation scripts
β”‚   β”‚   β”œβ”€β”€ test-auth-mcp-with-session.js  # Primary MCP SDK validation
β”‚   β”‚   β”œβ”€β”€ test-database-mcp.js    # Database server testing
β”‚   β”‚   β”œβ”€β”€ test-architecture-aware-mcp.js # Architecture testing
β”‚   β”‚   └── validate-*.js           # Various validation scripts
β”‚   β”‚
β”‚   └── debug/                      # Debug and investigation scripts
β”‚
β”œβ”€β”€ πŸ”§ Configuration
β”‚   β”œβ”€β”€ config/                     # MCP client configurations
β”‚   β”œβ”€β”€ .vscode/                    # VS Code MCP Inspector config
β”‚   β”œβ”€β”€ .env.example               # Environment template
β”‚   └── package.json               # Project dependencies
β”‚
└── πŸ“ Examples
    β”œβ”€β”€ examples/                   # Demo scripts and integrations
    └── setup-everything.sh        # Quick setup script

πŸš€ Quick Start

1. Environment Setup

# Clone and configure
git clone <repository>
cd mc-pea
cp .env.example .env
# Edit .env with your configuration

2. Start Auth MCP Server

cd mcp-servers/auth-mcp-server
npm install
npm run build
npm start

3. Validate Implementation

# From project root
cd tests
node test-auth-mcp-with-session.js

4. Create New MCP Server

# Copy template
cp -r templates/mcp-server-template my-new-server
cd my-new-server

# Configure and build
cp .env.example .env
npm install
npm run build
npm run test

🎯 Key Features

  • βœ… Production-Ready Servers: Authentication and database MCP servers
  • βœ… Canonical Templates: Clean, validated patterns for new development
  • βœ… Comprehensive Testing: MCP SDK client validation and testing suite
  • βœ… Docker Deployment: Production containerization with security
  • βœ… Authentication Integration: Keycloak and Infisical support
  • βœ… Session Management: Proper MCP session and state handling
  • βœ… Development Guardrails: AI assistant instructions and protocol compliance

πŸ—οΈ Architecture

MCP Protocol Implementation

  • Transport: StreamableHTTPServerTransport for HTTP-based communication
  • Authentication: API key validation via HTTP headers
  • Session Management: UUID-based session tracking with isolated state
  • Registration: Dynamic tool/resource registration using SDK methods

Server Types

  • Stateful Servers: Database operations with persistent connections
  • Stateless Servers: Authentication and utility operations
  • Template Server: Minimal example with all patterns

πŸ›‘οΈ Development Guidelines

For AI Assistants

CRITICAL: Read templates/mcp-server-template/prompts/ai-assistant-instructions.md

Key requirements:

  • Use MCP SDK transports only (never custom HTTP)
  • Use server.registerTool() for tool registration
  • Validate with MCP SDK client
  • Follow canonical template patterns

For Human Developers

  1. Start with template: Copy templates/mcp-server-template/
  2. Follow patterns: Use existing implementations as reference
  3. Validate thoroughly: Use all test scripts
  4. Deploy with Docker: Production-ready containerization included

πŸ“‹ Validation Workflow

# 1. Template validation
node tests/validate-template.js

# 2. Server implementation
npm run build
npm start

# 3. MCP SDK client testing
node tests/test-auth-mcp-with-session.js

# 4. Architecture-aware testing
node tests/test-architecture-aware-mcp.js

πŸ”— Essential References

  • MCP_MASTER_REFERENCE.md - Master index and quick reference
  • templates/mcp-server-template/ - Canonical implementation patterns
  • mcp-servers/auth-mcp-server/ - Production reference implementation
  • tests/test-auth-mcp-with-session.js - Validated client patterns

πŸ“Š Project Status

COMPLETED βœ…:

  • Production auth and database MCP servers
  • Complete template system with validation
  • Comprehensive testing and validation suite
  • Development guardrails and documentation
  • Docker deployment configurations

READY FOR USE πŸš€:

  • Copy templates for new MCP servers
  • Use validation scripts for any MCP implementation
  • Deploy with provided Docker configurations
  • Follow established patterns for protocol compliance

πŸš€ Vision

Transform frontend applications into full-stack applications by automatically generating production-ready backends that handle:

  • Form data processing and validation
  • Database operations (PostgreSQL)
  • File storage management (NAS CDN)
  • RESTful API endpoints
  • Deployment automation

🎯 Key Features

  • Frontend Analysis: Parse React, Vue, Angular, and other frontend frameworks to understand data requirements
  • Backend Generation: Create Golang services with proper architecture and best practices
  • Database Integration: Automatic PostgreSQL schema generation and migrations
  • File Storage: NAS CDN integration for media and document handling
  • Git Integration: Automatic repository creation and management
  • Continuous Updates: Keep backends in sync as frontends evolve

πŸ—οΈ Architecture

Frontend Repository β†’ [Analysis Engine] β†’ Backend Specification β†’ [Generator] β†’ Golang Backend
                                      ↓
                              Database Schema + File Storage Config
                                      ↓
                                [Deployment] β†’ Production Environment

πŸ“‹ Current Status

🚧 In Planning Phase - See REQUIREMENTS.md for detailed specifications

🀝 Contributing

This project is in the early planning stages. Contributions to requirements gathering, architecture design, and implementation are welcome!

οΏ½ Quick Start (Docker-Free)

For rapid local development without Docker hassles:

Option 1: Node.js MCP Servers (Recommended)

# Most MCP servers are Node.js/TypeScript - no containers needed
npm install -g @modelcontextprotocol/server-filesystem
npm install -g @modelcontextprotocol/server-github
# Run directly on your machine

Option 2: Python Virtual Environments

# Many servers available as Python packages
pip install mcp-server-postgres
pip install mcp-server-keycloak  # When we build it
# Native execution, no virtualization

Option 3: Windows Subsystem for Linux (WSL2)

# Lightweight Linux environment
wsl --install
# Better than Docker Desktop for development

Cross-Service Communication

  • HTTP APIs: Direct service-to-service calls
  • Shared File System: Use Windows file sharing for data exchange
  • Local Database: PostgreSQL/Redis running as Windows services
  • Message Queues: Use local Redis for async communication

πŸ” Auth MCP Server Validation

This repository includes an Auth MCP Server template that provides Keycloak and Infisical integration. To validate the deployed server:

Prerequisites

  1. Create a .env file with your configuration:
cp .env.example .env
# Edit .env with your actual values:
# AUTH_MCP_URL="https://your-auth-server.com/mcp"
# AUTH_MCP_API_KEY="your-api-key"

Validation Options

Option 1: Quick Node.js Validation

node validate-auth-mcp-simple.js

Option 2: Bash Script Validation

chmod +x validate-auth-mcp.sh
./validate-auth-mcp.sh

Option 3: Manual cURL Tests

# Load environment variables
source .env

# Test health endpoint (no auth)
curl "${AUTH_MCP_URL%/mcp*}/health"

# Test unauthenticated request (should return 401)
curl -X POST -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"initialize","id":1}' \
  "$AUTH_MCP_URL"

# Test authenticated request (should work)
curl -X POST -H "Content-Type: application/json" \
  -H "API_KEY: $AUTH_MCP_API_KEY" \
  -d '{"jsonrpc":"2.0","method":"initialize","id":1,"params":{"protocolVersion":"1.0","capabilities":{}}}' \
  "$AUTH_MCP_URL"

MCP Inspector Configuration

For development with MCP Inspector, use the environment-based config:

# Copy the environment-based MCP config
cp .vscode/mcp-env.json .vscode/mcp.json
# Ensure AUTH_MCP_API_KEY is in your environment

πŸ€– AI/Copilot Guardrails

This project includes comprehensive AI assistant guardrails through VS Code Copilot custom modes and instructions:

πŸ“ Copilot Configuration (.github/)

.github/
β”œβ”€β”€ copilot-instructions.md     # Repository-wide AI guidelines
β”œβ”€β”€ chatmodes/                  # Custom chat modes for specific workflows
β”‚   β”œβ”€β”€ mcp-server-development.chatmode.md  # Creating MCP servers
β”‚   β”œβ”€β”€ mcp-server-validation.chatmode.md   # Testing and validation
β”‚   └── mcp-troubleshooting.chatmode.md     # Debugging and fixes
β”œβ”€β”€ instructions/               # Domain-specific coding standards
β”‚   β”œβ”€β”€ instructions.instructions.md        # General project standards
β”‚   β”œβ”€β”€ mcp-server-architecture.instructions.md  # Submodule architecture
β”‚   └── mcp-protocol-compliance.instructions.md  # Protocol requirements
└── prompts/                    # Reusable prompt templates
    β”œβ”€β”€ create-mcp-server.prompt.md         # Server creation workflow
    β”œβ”€β”€ validate-mcp-server.prompt.md       # Validation procedures
    └── debug-mcp-server.prompt.md          # Debugging assistance

🎯 Specialized Chat Modes

  • MCP Server Development: Comprehensive development mode with template enforcement and validation workflows
  • MCP Server Validation: Testing and compliance checking with systematic validation procedures
  • MCP Troubleshooting: Systematic debugging with guided troubleshooting and proven solutions

πŸ›‘οΈ AI Development Guardrails

Critical Context: The Model Context Protocol (MCP) is NOT in AI training data. The guardrails ensure:

  1. Template Compliance: Always reference templates/mcp-server-template/ for canonical patterns
  2. Protocol Adherence: Mandatory use of MCP SDK transports and proper tool registration
  3. Validation Requirements: All servers must pass MCP SDK client testing
  4. Security Standards: Integration with Keycloak and Infisical, proper input validation
  5. Submodule Architecture: Each server in mcp-servers/ is independent with own tests and docs

These guardrails prevent common MCP development mistakes and ensure all AI-assisted development follows proven patterns from the working reference implementations.

οΏ½πŸ“„ License

MIT License - Feel free to use this for your own projects!


"Bridging the gap between frontend dreams and backend reality"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors