@172ai/containers-mcp-server 1.8.4 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +393 -0
- package/package.json +2 -9
package/README.md
CHANGED
|
@@ -363,6 +363,399 @@ This provides detailed information about:
|
|
|
363
363
|
- Error details and stack traces
|
|
364
364
|
- Performance metrics
|
|
365
365
|
|
|
366
|
+
## 🏭 Production Deployment Guide
|
|
367
|
+
|
|
368
|
+
### Resource Allocation
|
|
369
|
+
|
|
370
|
+
The platform supports configurable CPU and memory resources for optimal performance:
|
|
371
|
+
|
|
372
|
+
#### CPU Options
|
|
373
|
+
- **1 vCPU**: Light workloads, simple web services, development
|
|
374
|
+
- **2 vCPUs**: Web applications, small databases, API services
|
|
375
|
+
- **4 vCPUs**: Heavy web apps, medium databases, data processing
|
|
376
|
+
- **8 vCPUs**: Large databases, intensive processing, high-traffic apps
|
|
377
|
+
|
|
378
|
+
#### Memory Options
|
|
379
|
+
- **1Gi**: Lightweight services, static sites, simple APIs
|
|
380
|
+
- **2Gi**: Web applications, small databases, moderate traffic
|
|
381
|
+
- **4Gi**: Medium databases, data processing, higher traffic
|
|
382
|
+
- **8Gi**: Large databases, memory-intensive apps, high traffic
|
|
383
|
+
- **16Gi**: Enterprise databases, big data processing, heavy workloads
|
|
384
|
+
|
|
385
|
+
#### Resource Sizing Guidelines
|
|
386
|
+
|
|
387
|
+
**Web Applications:**
|
|
388
|
+
```bash
|
|
389
|
+
# Small/Medium (< 1000 users)
|
|
390
|
+
start_execution({
|
|
391
|
+
containerId: "your-container-id",
|
|
392
|
+
cpu: "2",
|
|
393
|
+
memory: "2Gi",
|
|
394
|
+
durationDays: 7
|
|
395
|
+
})
|
|
396
|
+
|
|
397
|
+
# Large (1000+ users)
|
|
398
|
+
start_execution({
|
|
399
|
+
containerId: "your-container-id",
|
|
400
|
+
cpu: "4",
|
|
401
|
+
memory: "8Gi",
|
|
402
|
+
durationDays: 30
|
|
403
|
+
})
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
**Database Workloads:**
|
|
407
|
+
```bash
|
|
408
|
+
# PostgreSQL/MySQL
|
|
409
|
+
start_execution({
|
|
410
|
+
containerId: "your-db-container",
|
|
411
|
+
cpu: "4",
|
|
412
|
+
memory: "8Gi",
|
|
413
|
+
durationDays: 30
|
|
414
|
+
})
|
|
415
|
+
|
|
416
|
+
# MongoDB/Elasticsearch
|
|
417
|
+
start_execution({
|
|
418
|
+
containerId: "your-nosql-container",
|
|
419
|
+
cpu: "8",
|
|
420
|
+
memory: "16Gi",
|
|
421
|
+
durationDays: 30
|
|
422
|
+
})
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
**Workflow Automation (n8n, Zapier alternatives):**
|
|
426
|
+
```bash
|
|
427
|
+
start_execution({
|
|
428
|
+
containerId: "workflow-container",
|
|
429
|
+
cpu: "4",
|
|
430
|
+
memory: "8Gi",
|
|
431
|
+
durationDays: 30,
|
|
432
|
+
envVars: {
|
|
433
|
+
DB_TYPE: "sqlite",
|
|
434
|
+
DB_SQLITE_DATABASE: "/home/node/.n8n/database.sqlite",
|
|
435
|
+
N8N_BASIC_AUTH_ACTIVE: "true",
|
|
436
|
+
N8N_BASIC_AUTH_USER: "admin",
|
|
437
|
+
N8N_BASIC_AUTH_PASSWORD: "secure-password"
|
|
438
|
+
}
|
|
439
|
+
})
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### Performance Optimization
|
|
443
|
+
|
|
444
|
+
#### Resource Planning
|
|
445
|
+
1. **Start Conservative**: Begin with 2 CPU / 2Gi memory
|
|
446
|
+
2. **Monitor Metrics**: Use `get_container_metrics` to track utilization
|
|
447
|
+
3. **Scale Gradually**: Increase resources based on actual usage patterns
|
|
448
|
+
4. **Cost Optimization**: Right-size resources to avoid over-provisioning
|
|
449
|
+
|
|
450
|
+
#### Common Optimization Patterns
|
|
451
|
+
```bash
|
|
452
|
+
# Development/Testing
|
|
453
|
+
cpu: "1", memory: "1Gi"
|
|
454
|
+
|
|
455
|
+
# Production Web Apps
|
|
456
|
+
cpu: "2-4", memory: "2Gi-4Gi"
|
|
457
|
+
|
|
458
|
+
# Production Databases
|
|
459
|
+
cpu: "4-8", memory: "8Gi-16Gi"
|
|
460
|
+
|
|
461
|
+
# Data Processing/ETL
|
|
462
|
+
cpu: "8", memory: "16Gi"
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### Environment Variable Management
|
|
466
|
+
|
|
467
|
+
#### Production Environment Setup
|
|
468
|
+
```bash
|
|
469
|
+
# Security
|
|
470
|
+
NODE_ENV=production
|
|
471
|
+
API_TIMEOUT=30000
|
|
472
|
+
RATE_LIMIT_PER_MINUTE=1000
|
|
473
|
+
|
|
474
|
+
# Database Configuration
|
|
475
|
+
DB_TYPE=sqlite
|
|
476
|
+
DB_SQLITE_DATABASE=/app/data/database.sqlite
|
|
477
|
+
DB_SQLITE_POOL_SIZE=10
|
|
478
|
+
DB_SQLITE_ENABLE_WAL=true
|
|
479
|
+
|
|
480
|
+
# Application Specific
|
|
481
|
+
N8N_BASIC_AUTH_ACTIVE=true
|
|
482
|
+
N8N_HOST=0.0.0.0
|
|
483
|
+
N8N_PORT=5678
|
|
484
|
+
N8N_PROTOCOL=http
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
#### Environment Variable Best Practices
|
|
488
|
+
1. **Never hardcode secrets** in Dockerfiles
|
|
489
|
+
2. **Use .env files** for local development
|
|
490
|
+
3. **Override at runtime** using start_execution envVars
|
|
491
|
+
4. **Validate critical vars** in application startup
|
|
492
|
+
5. **Document required variables** in your container description
|
|
493
|
+
|
|
494
|
+
## 📚 Application Deployment Examples
|
|
495
|
+
|
|
496
|
+
### Example 1: n8n Workflow Automation
|
|
497
|
+
|
|
498
|
+
Complete production deployment for n8n workflow automation platform:
|
|
499
|
+
|
|
500
|
+
```javascript
|
|
501
|
+
// 1. Create the container with comprehensive Dockerfile
|
|
502
|
+
const container = await create_container({
|
|
503
|
+
name: "n8n-workflow-automation",
|
|
504
|
+
description: "Production n8n workflow automation with SQLite persistence",
|
|
505
|
+
dockerfile: `FROM n8nio/n8n:latest
|
|
506
|
+
|
|
507
|
+
# Set up data directory with proper permissions
|
|
508
|
+
USER root
|
|
509
|
+
RUN mkdir -p /home/node/.n8n && chown -R node:node /home/node/.n8n
|
|
510
|
+
USER node
|
|
511
|
+
|
|
512
|
+
# Production environment configuration
|
|
513
|
+
ENV NODE_ENV=production
|
|
514
|
+
ENV DB_TYPE=sqlite
|
|
515
|
+
ENV DB_SQLITE_DATABASE=/home/node/.n8n/database.sqlite
|
|
516
|
+
ENV DB_SQLITE_POOL_SIZE=10
|
|
517
|
+
ENV DB_SQLITE_ENABLE_WAL=true
|
|
518
|
+
ENV N8N_BASIC_AUTH_ACTIVE=true
|
|
519
|
+
ENV N8N_HOST=0.0.0.0
|
|
520
|
+
ENV N8N_PORT=5678
|
|
521
|
+
|
|
522
|
+
# Health check
|
|
523
|
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \\
|
|
524
|
+
CMD curl -f http://localhost:5678/healthz || exit 1
|
|
525
|
+
|
|
526
|
+
EXPOSE 5678
|
|
527
|
+
CMD ["n8n", "start"]`,
|
|
528
|
+
tags: ["workflow-automation", "n8n", "production"],
|
|
529
|
+
envVars: [
|
|
530
|
+
{ key: "N8N_BASIC_AUTH_USER", value: "admin" },
|
|
531
|
+
{ key: "N8N_BASIC_AUTH_PASSWORD", value: "secure-password-change-me" }
|
|
532
|
+
]
|
|
533
|
+
})
|
|
534
|
+
|
|
535
|
+
// 2. Build the container
|
|
536
|
+
await build_container({ containerId: container.id })
|
|
537
|
+
|
|
538
|
+
// 3. Start with production resources
|
|
539
|
+
await start_execution({
|
|
540
|
+
containerId: container.id,
|
|
541
|
+
cpu: "4",
|
|
542
|
+
memory: "8Gi",
|
|
543
|
+
durationDays: 30
|
|
544
|
+
})
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
### Example 2: PostgreSQL Database
|
|
548
|
+
|
|
549
|
+
```javascript
|
|
550
|
+
const dbContainer = await create_container({
|
|
551
|
+
name: "postgresql-production",
|
|
552
|
+
description: "Production PostgreSQL database with persistent storage",
|
|
553
|
+
dockerfile: `FROM postgres:15-alpine
|
|
554
|
+
|
|
555
|
+
# Install extensions
|
|
556
|
+
RUN apk add --no-cache postgresql-contrib
|
|
557
|
+
|
|
558
|
+
# Configuration
|
|
559
|
+
ENV POSTGRES_DB=myapp
|
|
560
|
+
ENV POSTGRES_USER=appuser
|
|
561
|
+
ENV PGDATA=/var/lib/postgresql/data/pgdata
|
|
562
|
+
|
|
563
|
+
# Optimization for production
|
|
564
|
+
RUN echo "shared_preload_libraries = 'pg_stat_statements'" >> /usr/share/postgresql/postgresql.conf.sample
|
|
565
|
+
RUN echo "max_connections = 200" >> /usr/share/postgresql/postgresql.conf.sample
|
|
566
|
+
RUN echo "shared_buffers = 256MB" >> /usr/share/postgresql/postgresql.conf.sample
|
|
567
|
+
|
|
568
|
+
EXPOSE 5432`,
|
|
569
|
+
envVars: [
|
|
570
|
+
{ key: "POSTGRES_PASSWORD", value: "secure-db-password" }
|
|
571
|
+
]
|
|
572
|
+
})
|
|
573
|
+
|
|
574
|
+
await start_execution({
|
|
575
|
+
containerId: dbContainer.id,
|
|
576
|
+
cpu: "4",
|
|
577
|
+
memory: "8Gi",
|
|
578
|
+
durationDays: 30
|
|
579
|
+
})
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
### Example 3: Node.js Web Application
|
|
583
|
+
|
|
584
|
+
```javascript
|
|
585
|
+
const webAppContainer = await create_container({
|
|
586
|
+
name: "nodejs-web-app",
|
|
587
|
+
description: "Production Node.js web application with monitoring",
|
|
588
|
+
dockerfile: `FROM node:18-alpine
|
|
589
|
+
|
|
590
|
+
WORKDIR /app
|
|
591
|
+
|
|
592
|
+
# Copy package files
|
|
593
|
+
COPY package*.json ./
|
|
594
|
+
RUN npm ci --only=production
|
|
595
|
+
|
|
596
|
+
# Copy application code
|
|
597
|
+
COPY . .
|
|
598
|
+
|
|
599
|
+
# Security: run as non-root user
|
|
600
|
+
RUN addgroup -g 1001 -S nodejs
|
|
601
|
+
RUN adduser -S nodejs -u 1001
|
|
602
|
+
RUN chown -R nodejs:nodejs /app
|
|
603
|
+
USER nodejs
|
|
604
|
+
|
|
605
|
+
# Environment setup
|
|
606
|
+
ENV NODE_ENV=production
|
|
607
|
+
ENV PORT=3000
|
|
608
|
+
|
|
609
|
+
# Health check
|
|
610
|
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \\
|
|
611
|
+
CMD curl -f http://localhost:3000/health || exit 1
|
|
612
|
+
|
|
613
|
+
EXPOSE 3000
|
|
614
|
+
CMD ["npm", "start"]`,
|
|
615
|
+
tags: ["nodejs", "web-app", "production"]
|
|
616
|
+
})
|
|
617
|
+
|
|
618
|
+
await start_execution({
|
|
619
|
+
containerId: webAppContainer.id,
|
|
620
|
+
cpu: "2",
|
|
621
|
+
memory: "4Gi",
|
|
622
|
+
durationDays: 14
|
|
623
|
+
})
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
## 🔧 Troubleshooting Guide
|
|
627
|
+
|
|
628
|
+
### Common Deployment Issues
|
|
629
|
+
|
|
630
|
+
#### Container Fails to Start
|
|
631
|
+
**Symptoms**: Container status shows "failed" or "stopped"
|
|
632
|
+
**Solutions**:
|
|
633
|
+
1. Check build logs: `get_build_logs({ containerId, buildLogId })`
|
|
634
|
+
2. Verify Dockerfile syntax and base image availability
|
|
635
|
+
3. Ensure EXPOSE ports match application ports
|
|
636
|
+
4. Check for missing dependencies or environment variables
|
|
637
|
+
|
|
638
|
+
```bash
|
|
639
|
+
# Debug container startup
|
|
640
|
+
get_execution_logs({
|
|
641
|
+
executionId: "your-execution-id",
|
|
642
|
+
lines: 100,
|
|
643
|
+
severity: ["ERROR", "WARNING"]
|
|
644
|
+
})
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
#### Resource Allocation Problems
|
|
648
|
+
**Symptoms**: Application runs slowly or crashes with OOM errors
|
|
649
|
+
**Solutions**:
|
|
650
|
+
1. Monitor current usage: `get_container_metrics({ containerId })`
|
|
651
|
+
2. Increase memory allocation if utilization > 80%
|
|
652
|
+
3. Add CPU resources if utilization consistently > 70%
|
|
653
|
+
4. Check for memory leaks in application code
|
|
654
|
+
|
|
655
|
+
```javascript
|
|
656
|
+
// Upgrade resources for running container
|
|
657
|
+
await stop_execution({ containerId })
|
|
658
|
+
await start_execution({
|
|
659
|
+
containerId,
|
|
660
|
+
cpu: "4", // Increased from 2
|
|
661
|
+
memory: "8Gi", // Increased from 4Gi
|
|
662
|
+
durationDays: 30
|
|
663
|
+
})
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
#### Environment Variable Issues
|
|
667
|
+
**Symptoms**: Application configuration errors, database connection failures
|
|
668
|
+
**Solutions**:
|
|
669
|
+
1. Verify environment variables in Dockerfile
|
|
670
|
+
2. Check runtime override in start_execution
|
|
671
|
+
3. Ensure sensitive values aren't hardcoded
|
|
672
|
+
4. Validate variable formats and required values
|
|
673
|
+
|
|
674
|
+
```javascript
|
|
675
|
+
// Correct environment variable setup
|
|
676
|
+
await start_execution({
|
|
677
|
+
containerId: "your-container",
|
|
678
|
+
envVars: {
|
|
679
|
+
DATABASE_URL: "sqlite:///app/data/db.sqlite",
|
|
680
|
+
NODE_ENV: "production",
|
|
681
|
+
PORT: "8080"
|
|
682
|
+
}
|
|
683
|
+
})
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
#### Performance Optimization Issues
|
|
687
|
+
**Symptoms**: Slow response times, high resource usage, timeout errors
|
|
688
|
+
**Solutions**:
|
|
689
|
+
1. **CPU Bottlenecks**:
|
|
690
|
+
- Monitor CPU metrics regularly
|
|
691
|
+
- Increase CPU allocation
|
|
692
|
+
- Optimize application code (async operations, caching)
|
|
693
|
+
|
|
694
|
+
2. **Memory Issues**:
|
|
695
|
+
- Check for memory leaks
|
|
696
|
+
- Increase memory allocation
|
|
697
|
+
- Implement proper garbage collection
|
|
698
|
+
|
|
699
|
+
3. **I/O Bottlenecks**:
|
|
700
|
+
- Use connection pooling for databases
|
|
701
|
+
- Implement caching strategies
|
|
702
|
+
- Optimize database queries
|
|
703
|
+
|
|
704
|
+
#### Network and Connectivity Issues
|
|
705
|
+
**Symptoms**: Cannot access container, API timeouts, connection refused
|
|
706
|
+
**Solutions**:
|
|
707
|
+
1. Verify container is running: `get_execution_status({ containerId })`
|
|
708
|
+
2. Check exposed ports match application ports
|
|
709
|
+
3. Ensure health checks are properly configured
|
|
710
|
+
4. Verify firewall and security group settings
|
|
711
|
+
|
|
712
|
+
```dockerfile
|
|
713
|
+
# Correct port configuration
|
|
714
|
+
EXPOSE 8080
|
|
715
|
+
HEALTHCHECK --interval=30s CMD curl -f http://localhost:8080/health
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
### Debug Mode and Logging
|
|
719
|
+
|
|
720
|
+
Enable comprehensive debugging:
|
|
721
|
+
```bash
|
|
722
|
+
# Server-side debugging
|
|
723
|
+
LOG_LEVEL=debug containers-mcp-server
|
|
724
|
+
|
|
725
|
+
# Container-specific logging
|
|
726
|
+
get_runtime_logs({
|
|
727
|
+
executionId: "your-execution-id",
|
|
728
|
+
lines: 500,
|
|
729
|
+
severity: ["DEBUG", "INFO", "WARNING", "ERROR"]
|
|
730
|
+
})
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
### Performance Monitoring
|
|
734
|
+
|
|
735
|
+
Monitor container performance:
|
|
736
|
+
```javascript
|
|
737
|
+
// Get real-time metrics
|
|
738
|
+
const metrics = await get_container_metrics({ containerId })
|
|
739
|
+
|
|
740
|
+
// Check key indicators:
|
|
741
|
+
// - CPU utilization < 70% for optimal performance
|
|
742
|
+
// - Memory utilization < 80% to avoid OOM
|
|
743
|
+
// - Request rate trends for scaling decisions
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
### Getting Help
|
|
747
|
+
|
|
748
|
+
1. **Check this troubleshooting guide** for common solutions
|
|
749
|
+
2. **Enable debug logging** for detailed error information
|
|
750
|
+
3. **Monitor metrics** to identify performance bottlenecks
|
|
751
|
+
4. **Review execution logs** for application-specific errors
|
|
752
|
+
5. **Check resource allocation** against application requirements
|
|
753
|
+
|
|
754
|
+
For persistent issues:
|
|
755
|
+
- Include container ID, execution ID, and error logs
|
|
756
|
+
- Provide steps to reproduce the issue
|
|
757
|
+
- Share relevant configuration (Dockerfile, environment variables)
|
|
758
|
+
|
|
366
759
|
## Security
|
|
367
760
|
|
|
368
761
|
### Best Practices
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@172ai/containers-mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "MCP server for 172.ai container management platform - enables AI assistants to manage containers, builds, and files with comprehensive workflow prompts",
|
|
5
5
|
"main": "dist/cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -70,14 +70,7 @@
|
|
|
70
70
|
"LICENSE",
|
|
71
71
|
".env.example"
|
|
72
72
|
],
|
|
73
|
-
"
|
|
74
|
-
"type": "git",
|
|
75
|
-
"url": "https://github.com/172ai/containers-mcp-server.git"
|
|
76
|
-
},
|
|
77
|
-
"bugs": {
|
|
78
|
-
"url": "https://github.com/172ai/containers-mcp-server/issues"
|
|
79
|
-
},
|
|
80
|
-
"homepage": "https://github.com/172ai/containers-mcp-server#readme",
|
|
73
|
+
"homepage": "https://172.ai",
|
|
81
74
|
"publishConfig": {
|
|
82
75
|
"access": "public"
|
|
83
76
|
}
|