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 44 tools with natural-language prompt patterns:
Domain Management
How do I connect my custom domain myapp.ai to my deployment?
Is my domain myapp.ai fully set up and working correctly?
Add myapp.ai as a domain I want to use in Nexlayer
Can you check if my domain myapp.ai is pointing to Nexlayer correctly?
Deployment Lifecycle
What are the steps to go from code to a live app on Nexlayer?
Deploy my application so it's live at myapp.cloud.nexlayer.ai
Something seems off — can you show me what's happening inside my app?
Why did my deployment fail? Show me what went wrong during startup
This app is already running — can you attach it to my account?
Remove my app from Nexlayer completely
Configuration & Validation
What structure should my Nexlayer app configuration follow?
Before we deploy, can you check if everything is set up correctly?
Feedback
Send feedback that the deployment experience was confusing at the logs step
Status
Is my app healthy and running properly right now?
API Key Management
Create a new API key I can use for this app
Show me all the API keys I've created
Remove access for one of my API keys
Workspace Management
What workspaces or teams do I have access to?
Switch me into the workspace for this project
Skills
Make sure my environment has all the latest Nexlayer capabilities
What can you currently do with Nexlayer?
Have any Nexlayer capabilities been updated recently?
Explain how your deployment capability works in detail
Utilities
Can you add a simple status indicator so I can see what's happening with Nexlayer?
Debug — Proxy Lifecycle
I need to debug my app — can you set up a safe way to inspect it?
I'm done debugging — clean up anything temporary you created
Debug — Shell Sessions
Open a direct session into my running app so we can inspect it
Run a quick check inside the app to see what's going on
Close that debug session now
Do I have any active debug sessions open?
Debug — File Operations
Show me what's inside my app's log file
Update a file inside my app with this new configuration
Fix the configuration issue inside my app without redeploying
What files are currently inside my app?
Debug — Database
Can you check what data is currently in my database?
Debug — Pod Lifecycle
Restart my app to see if that fixes the issue
Restart everything cleanly for this app
Increase capacity — my app is getting more traffic
Give me a detailed breakdown of what's happening with my app
Debug — Network
Test something from inside my app's environment
Can you check if my internal services are talking to each other?
Show me everything running behind my app
Are my internal services resolving correctly?
Debug — Result Cache
That output was too big earlier — can you bring it back so I can review it?
Configuration 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.