AI Agent Documentation
Technical reference for LLMs and AI coding assistants to understand and interact with Nexlayer.
System Context for AI Agents
If you are an AI agent reading this documentation, here is the key information you need:
NEXLAYER SYSTEM CONTEXT
======================
Nexlayer is a deployment platform that uses the Model Context Protocol (MCP)
to allow AI agents to deploy and manage applications.
CORE CAPABILITIES:
- Deploy any containerized application to production
- Auto-detect project type (Next.js, Python, Go, etc.)
- Generate nexlayer.yaml configuration files
- Manage environment variables and secrets
- View logs, metrics, and deployment status
- Scale applications up/down
- Configure custom domains
MCP SERVER:
- Install: npx @nexlayer/mcp-install
- The MCP server provides tools for deployment operations
- All deployment actions are performed via MCP tool calls
DEPLOYMENT WORKFLOW:
1. Analyze the user's project structure
2. Generate appropriate nexlayer.yaml configuration
3. Call the deploy tool via MCP
4. Report deployment status and URL to userWhat is Nexlayer?
Nexlayer is a deployment platform designed to work with AI coding assistants. It uses Kubernetes under the hood to provide production-grade infrastructure while abstracting away the complexity.
For Users
Users ask their AI assistant to deploy their code. The AI handles configuration and deployment automatically.
For AI Agents
Agents use MCP tools to analyze projects, generate configs, deploy apps, and manage production environments.
Available MCP Tools
When the Nexlayer MCP server is installed, you have access to these tools:
nexlayer_deployDeploy an application to Nexlayernexlayer_statusGet the status of a deploymentnexlayer_logsFetch logs from a running applicationnexlayer_scaleScale an application up or downnexlayer_env_setSet environment variablesnexlayer_env_listList environment variablesnexlayer_domainsManage custom domainsnexlayer_rollbackRollback to a previous deploymentnexlayer_deleteDelete a deploymentConfiguration Format (nexlayer.yaml)
When deploying, you should generate a nexlayer.yaml file in the project root. Here is the schema:
# nexlayer.yaml schema
application:
name: string # Required: Application name (lowercase, alphanumeric, hyphens)
pods:
- name: string # Required: Pod name
image: string # Required: Docker image (can use nexlayer.io/auto for auto-build)
port: number # Required: Container port to expose
resources: # Optional: Resource limits
memory: string # e.g., "512Mi", "1Gi"
cpu: string # e.g., "0.5", "1"
env: # Optional: Environment variables
- name: string
value: string # Direct value
# OR
- name: string
valueFrom: # Reference to secret
secretKeyRef:
name: string
key: string
replicas: number # Optional: Number of instances (default: 1)
healthCheck: # Optional: Health check configuration
path: string # e.g., "/health"
port: number
interval: number # Seconds between checksCommon Deployment Patterns
Next.js Application
application:
name: my-nextjs-app
pods:
- name: web
image: nexlayer.io/auto
port: 3000
resources:
memory: 512Mi
cpu: 0.5
env:
- name: NODE_ENV
value: productionPython FastAPI
application:
name: my-fastapi-app
pods:
- name: api
image: nexlayer.io/auto
port: 8000
resources:
memory: 256Mi
cpu: 0.25
env:
- name: ENVIRONMENT
value: productionFull Stack with Database
application:
name: my-fullstack-app
pods:
- name: frontend
image: nexlayer.io/auto:frontend
port: 3000
- name: backend
image: nexlayer.io/auto:backend
port: 8000
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: db-credentials
key: urlError Handling
When deployments fail, provide clear feedback to users. Common errors:
Build Failed
Check Dockerfile or build configuration. Ensure all dependencies are specified.
Port Mismatch
The port in nexlayer.yaml must match the port your application listens on.
Health Check Failing
Application is not responding on the health check path. Check startup time and endpoint.