# Environment variables

Each app has a set of environment variables. Your coding agent sets them with the MCP tool `env`, and reads their names with the MCP tool `env_names`. No call returns a value.

## Set the variables

The MCP tool `env` takes the `app_id` and `variables`, a flat object of strings. It replaces the whole set: names you leave out are removed.

With the CLI, send one JSON object on standard input:

```
astris env --app <id>
```

The new values apply at the next deploy or restart.

## Read the names

```
astris env --app <id> --names
```

It prints one name per line and never a value. The MCP tool `env_names` gives the same.

## Rules

- A name starts with a letter or `_`, and holds only letters, digits and `_`.
- Each value is a string with no line break.
- A set has at most 200 names.
- The request body is at most 64 KB.

A body that breaks a rule is refused with [bad_request](/docs/errors/bad_request). An account with no plan is refused with [upgrade_required](/docs/errors/upgrade_required). The CLI refuses input that is not one JSON object and sends nothing.

## Keep secrets out of your repository

Put keys and passwords in environment variables, not in your files. The [pre-flight check](/docs/errors/preflight) refuses a repository with a key in it.
