Nexlayer/nexlayer-mcp
If you are the rightful owner of nexlayer-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Nexlayer MCP Server is a Model Context Protocol server designed to facilitate the deployment and management of applications on the Nexlayer cloud platform using AI agents.
Nexlayer MCP Server
A Model Context Protocol (MCP) server that provides tools for deploying and managing applications on the Nexlayer cloud platform through AI agents.
Features
This MCP server provides 12 essential tools for complete application deployment workflows with AI agent optimization:
Core Deployment Tools
nexlayer_deploy
- Final deployment step (requires prepared YAML with container images)nexlayer_extend_deployment
- Extend deployment duration using session tokennexlayer_claim_deployment
- Claim ownership of a deploymentnexlayer_get_schema
- Get current YAML schema with LLM-friendly examples and validationnexlayer_add_deployment_reservation
- Reserve application names to prevent conflictsnexlayer_remove_deployment_reservation
- Release reserved application namesnexlayer_get_reservations
- List all active deployment reservationsnexlayer_feedback
- Send feedback to Nexlayer team
Repository Analysis Tools
nexlayer_clone_repo
- Clone GitHub repositories for analysis
Container Building Tools
nexlayer_build_images
- Build container images using Kaniko and push to Google Artifact Registry
File Generation Tools
nexlayer_generate_intelligent_dockerfiles
- AI-powered Dockerfile generation with framework detectionnexlayer_generate_intelligent_yaml
- Schema-driven YAML configuration generation
Advanced Features
- Schema-Driven YAML Generation: Automatically fetches and uses current Nexlayer schema
- Dockerfile Overwrite Protection: Automatically skips existing Dockerfiles
- Google Artifact Registry Integration: Built-in authentication and image pushing
- Multi-Framework Support: Detects and optimizes for Node.js, Python, Java, Go, React, Next.js
- AI Agent Optimization: Automatic agent detection and capability-based tool selection
- Comprehensive Logging: Structured logging with session tracking and performance monitoring
- HTTP Transport Support: Direct API access via HTTP endpoints
- Prompt System: 5 comprehensive prompts for deployment guidance
Quick Start
Installation
npm install nexlayer-mcp
Basic Usage
# Start the MCP server
npx nexlayer-mcp
# Or with HTTP transport
HTTP_TRANSPORT=true npx nexlayer-mcp
# With bearer token authentication
HTTP_TRANSPORT=true BEARER_TOKEN=your-secret-token npx nexlayer-mcp
Bearer Token Authentication
When HTTP transport is enabled, you can secure the API endpoints with bearer token authentication:
# Set environment variables
export HTTP_TRANSPORT=true
export BEARER_TOKEN=your-secret-token
# Start server with authentication
npx nexlayer-mcp
API Usage with Authentication:
# All /api endpoints require the Bearer token
curl -H "Authorization: Bearer your-secret-token" \
http://localhost:3000/api/tools
# Health check (no authentication required)
curl http://localhost:3000/health
Error Responses:
401 Unauthorized
: Missing or invalid Authorization header403 Forbidden
: Invalid Bearer token
Configuration
Add to your MCP client configuration:
{
"mcpServers": {
"nexlayer": {
"command": "npx",
"args": ["nexlayer-mcp@latest"]
}
}
}
Tool Reference
Core Deployment Tools
nexlayer_deploy
Deploy prepared YAML configuration to Nexlayer platform.
Parameters:
yamlContent
(string, required): Complete Nexlayer YAML configurationsessionToken
(string, optional): Nexlayer session token
Example:
await nexlayer_deploy({
yamlContent: "apiVersion: v1\nkind: Pod\n...",
sessionToken: "abc123"
});
nexlayer_extend_deployment
Extend an existing deployment's duration.
Parameters:
sessionToken
(string, required): Session token from original deploymentapplicationName
(string, required): Name of the application
nexlayer_claim_deployment
Take ownership of a deployment.
Parameters:
sessionToken
(string, required): Session token from deploymentapplicationName
(string, required): Name of the application
nexlayer_get_schema
Get current Nexlayer YAML schema for configuration validation.
Parameters: None
Repository Analysis Tools
nexlayer_clone_repo
Clone a GitHub repository for analysis and deployment.
Parameters:
repoUrl
(string, required): GitHub repository URLverbose
(boolean, optional): Enable verbose logging
Example:
await nexlayer_clone_repo({
repoUrl: "https://github.com/username/repo",
verbose: true
});
Container Building Tools
nexlayer_build_images
Build and push container images using Kaniko.
Parameters:
repoPath
(string, required): Path to repository with Dockerfilesverbose
(boolean, optional): Enable verbose build loggingtimeout
(number, optional): Build timeout in milliseconds (default: 300000)
File Generation Tools
nexlayer_generate_intelligent_dockerfiles
Generate optimized Dockerfiles for repository services.
Parameters:
repoPath
(string, required): Local repository path to analyzeoutputPath
(string, optional): Custom output directory for Dockerfilesoptimizations
(object, optional): Build optimization settings
nexlayer_generate_intelligent_yaml
Generate optimized Nexlayer YAML configuration.
Parameters:
applicationName
(string, required): Application namerepositoryAnalysis
(object, optional): Repository analysis databuiltImages
(array, optional): Images built with nexlayer_build_imagesenvironmentVariables
(object, optional): Environment variables to includeoptimizations
(object, optional): Deployment optimizations
Deployment Workflow
Manual 5-Step Process
-
Clone Repository
const cloneResult = await nexlayer_clone_repo({ repoUrl: "https://github.com/username/repo" });
-
Generate Dockerfiles
const dockerfileResult = await nexlayer_generate_intelligent_dockerfiles({ repoPath: "/tmp/repo-abc123" });
-
Build Images
const buildResult = await nexlayer_build_images({ repoPath: "/tmp/repo-abc123" });
-
Generate YAML
const yamlResult = await nexlayer_generate_intelligent_yaml({ applicationName: "my-app", builtImages: buildResult.images });
-
Deploy
const deployResult = await nexlayer_deploy({ yamlContent: yamlResult.content });
Management Operations
Extend Deployment
await nexlayer_extend_deployment({
sessionToken: "abc123",
applicationName: "my-app"
});
Claim Deployment
await nexlayer_claim_deployment({
sessionToken: "abc123",
applicationName: "my-app"
});
Get Schema
const schema = await nexlayer_get_schema();
Advanced Configuration
Environment Variables
HTTP_TRANSPORT
: Enable HTTP transport (default: false)WEBSOCKET_ENABLED
: Enable WebSocket transport (default: true)NODE_ENV
: Environment mode (development/production)
Google Artifact Registry Authentication
The server includes built-in GAR authentication support:
# Set service account credentials
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
export GCP_PROJECT_ID=your-project-id
# Run with authentication
docker run -e GOOGLE_APPLICATION_CREDENTIALS -e GCP_PROJECT_ID nexlayer-mcp
Development
Project Structure
src/
āāā server.ts # MCP server initialization and agent detection
āāā tools/ # Modular tool implementations
ā āāā registry.ts # Centralized tool registration system
ā āāā core.ts # Deployment lifecycle tools (8 tools)
ā āāā analysis.ts # Repository analysis tools (1 tool)
ā āāā kaniko.ts # Container building tools (1 tool)
ā āāā generator.ts # File generation tools (2 tools)
āāā services/ # External service integrations
āāā utils/ # Logging, tracing, and utilities
āāā prompts/ # AI agent guidance prompts
āāā agent/ # AI agent detection and optimization
Adding New Tools
- Define Tool Interface in
types/nexlayer.ts
- Implement Tool Logic in appropriate module
- Add Zod Schema for parameter validation
- Register Tool in module's
registerTools()
method
Testing
# Run test suite
npm test
# Test specific tool
npm run test:tools
# Test HTTP transport
npm run test:http
Troubleshooting
Common Issues
-
"Kaniko executor not found"
- Ensure Kaniko is properly installed
- Check
/kaniko/executor
path exists
-
"Repository clone failed"
- Verify repository URL is correct
- Check repository is public or accessible
- Ensure network connectivity
-
"Build failed"
- Check Dockerfiles exist in repository
- Verify Kaniko executor is available
- Check registry access and authentication
-
"Deployment failed"
- Validate YAML configuration
- Check image URLs are accessible
- Verify session token is valid
Debug Mode
Enable verbose logging:
await nexlayer_clone_repo({
repoUrl: "https://github.com/username/repo",
verbose: true
});
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
License
ISC License - see LICENSE file for details.
Support
- Documentation:
- Issues: GitHub Issues
- Feedback: Use
nexlayer_feedback
tool