Skip to main content

CLI Authentication

Authenticate the LeanMCP CLI with your API key to access your projects and deployments.

Get Your API Key

  1. Go to LeanMCP Dashboard
  2. Navigate to SettingsAPI Keys
  3. Create a new API key with appropriate permissions
  4. Copy the API key (starts with airtrain_)

Login Command

leanmcp login
The CLI will prompt you interactively for your API key:
LeanMCP Login

? Enter your LeanMCP API key: airtrain_xxxx...

Validating API key...
API key validated successfully!
Logged in successfully!

Verify Authentication

Check if you’re logged in:
leanmcp whoami
Example Output:
LeanMCP Authentication Status

Logged in
  API Key: airtrain_2ef4da...
  API URL: https://api.leanmcp.com
  Last updated: 12/18/2025, 4:38:05 PM

Logout

Remove stored credentials:
leanmcp logout
Example Output:
Logged out successfully!

Credential Storage

The CLI stores your credentials securely in:
  • macOS/Linux: ~/.leanmcp/config.json
Keep your API key secure. Do not share it or commit it to version control.

Troubleshooting

Not Authenticated

Not authenticated
Run 'leanmcp login' to authenticate.
Solutions:
  • Run leanmcp login and enter your API key
  • Verify your API key is correct

API Key Invalid

API key validation failed
Please check your API key and try again.
Solutions:
  • Verify your API key is correct
  • Check if the API key has expired
  • Create a new API key in the dashboard

Next Steps

Project Management

Start creating and managing MCP projects