Skip to content

MCP server

The Envlet MCP server lets a coding agent create projects, import dotenv files, create agent and CI identities, set variable policy, and link a Git repository. It uses the Envlet REST API and does not run a model on Envlet infrastructure.

The server uses stdio. Protocol messages use stdout, and human-readable status messages use stderr.

Add Envlet as a user MCP server:

Terminal window
claude mcp add --scope user envlet -- npx -y @envlet/cli mcp

Start Claude Code in the repository that you want to migrate. The MCP server uses that Git repository as its working directory.

Add this server to your Cursor MCP configuration:

{
"mcpServers": {
"envlet": {
"command": "npx",
"args": ["-y", "@envlet/cli", "mcp"]
}
}
}

Open the target repository in Cursor before you run the migration.

Add this server to ~/.codex/config.toml:

[mcp_servers.envlet]
command = "npx"
args = ["-y", "@envlet/cli", "mcp"]

Start Codex in the target repository.

Run the migrate prompt from your MCP client. The prompt signs you in when needed, creates or finds a project named after the repository directory, and ensures development, staging, and production environments exist.

The agent finds dotenv files and asks once for the environment mapping. import_env_file reads each confirmed file inside the MCP process. The file path must be relative to the Git root, and the resolved file must stay inside that root. Each import can contain up to 200 variables and uses one atomic transaction with a 30-second database timeout. Dotenv values do not enter MCP arguments or results.

The prompt can create a CI identity for the provider configured in the repository and an agent identity for Claude Code, Cursor, or Codex. Before create_token mints a production agent token, it withholds every current variable and marks the grant to withhold variables created later. Set allowAll to true only to leave an existing policy unchanged or to add no restrictions to a new grant. The migration prompt does not set it. The agent asks for an explicit allowlist and changes only those variable names to shared.

The prompt also updates applicable start scripts to use envlet run --. It prints variable names that can be removed from other secret stores without printing their values.

The optional repository prompt argument labels the repository in the runbook. Start the MCP server in that repository because repository tools use the server working directory.

  • sign_in: Start device sign-in and continue polling in the background.
  • sign_in_status: Return pending, signed_in, or expired from the active poll and stored credential.
  • whoami: Show current token metadata and stored credential status.
  • list_projects: List projects in the active organization.
  • create_project: Create a project.
  • list_environments: List environments for a project.
  • create_environment: Create an environment.
  • ensure_project_for_repo: Find or create the repository project and ensure the three standard environments.
  • link_repo: Write the selected project and environment to .envlet.
  • list_variable_names: List variable metadata without values.
  • import_env_file: Create or update as many as 200 variables from a repository dotenv file in one atomic transaction with a 30-second database timeout.
  • set_variable: Create or update one variable. Use valueFile for a secret stored in a repository file. Use value only for a non-secret value.
  • list_identities: List human, agent, CI, and share identities.
  • create_identity: Create an agent or CI identity.
  • create_token: Create a scoped token and write it to a protected local file. A production agent grant withholds current and future variables by default. allowAll preserves an existing policy and adds no restrictions to a new grant.
  • set_policy: Set a variable to shared, overridden, or withheld for an identity. Use valueFile for a secret override. Use value only for a non-secret override.

create_token writes the one-time raw token to ~/.envlet/tokens/ with file mode 0600. Its MCP result contains the token ID, file path, expiry, and commands that send the file to supported secret stores through standard input. The result does not contain the raw token. If the file write fails, the server revokes the new token. If revocation also fails, the tool returns the token ID and tells you to revoke it in the dashboard. If token creation times out or its response is lost, the server checks recent matching tokens and revokes one exact match before it reports the error.

Use a returned command without reading or printing the file. Envlet stores only the token digest and cannot show the raw token again.