A Microservice Control Plane (MCP) server built with Node.js and Express, deployed on AWS using Docker, Kubernetes (EKS), and Terraform. This server provides centralized health checks and control endpoints for your microservices, ensuring high availability, scalability, and easy integration into existing architectures.
- Introduction
- Features
- Technology Stack
- Prerequisites
- Running the Project
- Setup and Installation
- Project Structure
- Environment Variables
- What to Expect
- Deployment Guide
- API Endpoints
- Configuration
- Monitoring & Logging
- CI/CD Integration
- Troubleshooting
- Contributing
The MCP Server offers a lightweight control plane for monitoring and managing microservices. It runs as a containerized Node.js application on an EKS cluster behind an AWS Application Load Balancer (ALB). It simplifies service health checks, centralized configuration, and orchestrated deployments.
- Health Endpoints: Readiness and liveness probes out of the box.
- ConfigMap Integration: Centralized configuration via Kubernetes ConfigMap.
- Automated Container Workflow: Build, tag, and publish Docker images to ECR.
- Infrastructure as Code: Provision EKS, networking, and IAM with Terraform.
- Secure Ingress: TLS termination via AWS ALB with ACM certificates.
- Extensible API: Easily add custom control-plane endpoints.
- Node.js (v18+) & ES Modules
- Express.js
- Dotenv
- Babel
- Docker & Docker Compose
- AWS ECR & AWS CLI
- Amazon EKS & kubectl
- Terraform
- GitHub Actions (optional)
- AWS Account with permissions for ECR, EKS, IAM, ACM.
- Local Tools: Node.js, npm, Docker, AWS CLI, kubectl, Terraform.
- DNS: A domain or subdomain for ALB Ingress if using HTTPS.
- IAM Roles: For EC2 nodes and CI/CD pipelines.
git clone https://github.com/ssupshub/mcp-server.git
cd mcp-server
npm install
npm run dev- Access:
http://localhost:3000
docker build -t mcp-server .
docker run -d -p 3000:3000 --env-file .env mcp-server- Access:
http://<server-ip>:3000
sudo apt update && sudo apt install -y docker.io git
git clone https://github.com/ssupshub/mcp-server.git
cd mcp-server
docker build -t mcp-server .
docker run -d -p 3000:3000 --env-file .env mcp-server- Access via EC2 public DNS or Elastic IP
version: "3.8"
services:
mcp-server:
build: .
ports:
- "3000:3000"
env_file:
- .envdocker-compose up --build -d# Ensure image is pushed to ECR or Docker Hub
kubectl apply -f k8s/namespace.yaml
kubectl apply -f k8s/configmap.yaml
kubectl apply -f k8s/deployment.yaml
kubectl apply -f k8s/service.yaml
kubectl apply -f k8s/ingress.yaml- Minikube:
minikube service mcp-service -n mcp - EKS: Use ALB DNS name
- Clone Repo
git clone https://github.com/ssupshub/mcp-server.git
cd mcp-server- Install Dependencies
npm install- Configure Environment
cp .env.example .env
# Update PORT, DB_URI, LOG_LEVEL- Build for Production
npm run buildmcp-server/
├── .dockerignore
├── .gitignore
├── Dockerfile
├── docker-compose.yml (optional)
├── package.json
├── .env.example
├── README.md
├── scripts/
│ ├── deploy.sh
│ └── setup-acm.md
├── src/
│ ├── index.js
│ ├── config/
│ │ └── config.js
│ ├── controllers/
│ │ └── mcpController.js
│ └── routes/
│ └── mcpRoutes.js
├── dist/ (build output)
├── k8s/
│ ├── namespace.yaml
│ ├── configmap.yaml
│ ├── deployment.yaml
│ ├── service.yaml
│ └── ingress.yaml
└── terraform/
├── main.tf
├── variables.tf
└── outputs.tf
| Key | Description | Default |
|---|---|---|
| PORT | HTTP port | 3000 |
| LOG_LEVEL | Application log verbosity | info |
| DB_URI | MongoDB connection string | mongodb://localhost:27017/mcp |
- Rapid health checks with minimal latency
- High availability via multiple replicas
- Zero-downtime rolling updates
- Centralized control-plane for microservices
- Authenticate & Build Image
aws ecr get-login-password --region $AWS_REGION \
| docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com
npm run build
docker build -t $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/mcp-server:latest .- Push to ECR
docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/mcp-server:latest- Terraform Provision
cd terraform
terraform init
terraform apply- Kubernetes Deploy
kubectl apply -f k8s/namespace.yaml
kubectl apply -f k8s/configmap.yaml
kubectl apply -f k8s/deployment.yaml
kubectl apply -f k8s/service.yaml
kubectl apply -f k8s/ingress.yaml- Verify
kubectl get pods,svc,ingress -n mcp-
GET /api/health
{ "status": "UP", "uptime": 123.45 } -
Extend by adding endpoints in
src/controllers
- Local:
.envfile - Production: Kubernetes ConfigMap & Secrets
- Use Prometheus for metrics
- Visualize with Grafana
- Aggregate logs with Fluentd into EFK
Example GitHub Actions workflow:
name: CI/CD Pipeline
on: [push]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '18'
- run: npm install && npm run build
- run: |
aws ecr get-login-password --region ${{ secrets.AWS_REGION }} \
| docker login --username AWS --password-stdin ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com
- run: docker build -t ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/mcp-server:latest .
- run: docker push ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/mcp-server:latest
- run: kubectl apply -f k8s/namespace.yaml
- run: kubectl apply -f k8s/configmap.yaml
- run: kubectl apply -f k8s/deployment.yaml
- run: kubectl apply -f k8s/service.yaml
- run: kubectl apply -f k8s/ingress.yaml
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG }}- Pods Crash:
kubectl logs <pod> -n mcp - ImagePullBackOff: Verify ECR repo & IAM policy
- Ingress Issues: Check ALB logs & DNS
- Fork the repo
- Create a feature branch (
git checkout -b feature/xyz) - Implement changes and tests
- Open a Pull Request