Environment Variables
Manage environment variables for your deployed Lambda functions directly from the CLI.Overview
Theleanmcp env command provides a complete set of tools for managing environment variables on your running Lambda deployments. Changes are applied immediately (causing a cold start on next invocation).
List Environment Variables
View all environment variables for your deployment:Options
Examples
Set Environment Variable
Add or update an environment variable:Options
Examples
Get Environment Variable
Retrieve a specific environment variable:Options
Examples
Remove Environment Variable
Delete an environment variable:Options
Examples
Pull Environment Variables
Download environment variables to a local.env file:
Options
Examples
Push Environment Variables
Upload environment variables from a local.env file:
Options
Examples
Full Workflow Example
Complete workflow for managing environment variables:Protected Variables
The following variables are protected and cannot be modified: AWS Reserved:AWS_*(all AWS-prefixed variables)
PORTAWS_LWA_PORTAWS_LWA_INVOKE_MODEAWS_LWA_READINESS_CHECK_MIN_UNHEALTHY_STATUS
These variables are automatically managed by AWS Lambda and the Lambda Web Adapter. Attempting to modify them will result in them being skipped with a warning.
Troubleshooting
Not Authenticated
leanmcp login and enter your API key.
No Deployment Found
leanmcp deploy .
Variable Name Validation
File Not Found
.env file exists or specify a different file with --file.
Parse Error
.env file uses KEY=VALUE format (one per line).
Next Steps
Deploy Projects
Deploy your MCP server to the cloud
Monitor Deployments
View deployment status and logs

