# .env parse

`env-parse` · version 1.0.0 · Versions & config · free, no key needed

Parse a strict dotenv-subset document into ordered key/value entries.

**Use when you need to: env parse · parse dotenv subset · parse env file text.**

## Supported

- env parse
- parse dotenv subset
- parse env file text

## Not supported

- export prefix
- variable expansion
- multiline quoted values
- INI sections
- read files

## Behavior

- text is split on CRLF, CR, or LF with the JSONL line splitter; a trailing empty segment after a final newline is ignored.
- Empty lines are ignored. A line whose first character is # is a comment; leading whitespace is not stripped.
- Each remaining line is KEY=VALUE where KEY matches [A-Za-z_][A-Za-z0-9_]*. The export prefix is rejected.
- Unquoted VALUE is the remainder of the line, including spaces, with no inline-comment stripping.
- A VALUE that starts with " or ' must be a well-formed quoted value; otherwise the line is rejected.
- Double-quoted values allow only \\ \" \n \t escapes. Single-quoted values have no escapes and cannot contain a quote.
- Duplicate keys are rejected. Output entries are in first-seen order. env is a null-prototype map of those pairs.

## Input

- `text` (string, required): max length 256000

## Output

- `entries` (array of object, required): max items 5000
- `env` (object, required)

## Limits

- max input bytes: 256000
- max lines: 5000

## Example

Request input:

```json
{
  "text": "# greeting\nNAME=Ada\nCITY=\"Tel Aviv\"\nNOTE='שלום'\nFLAG=\nPATH_EXTRA=bin/app:./scripts\n"
}
```

Response:

```json
{
  "result": {
    "entries": [
      {
        "key": "NAME",
        "value": "Ada"
      },
      {
        "key": "CITY",
        "value": "Tel Aviv"
      },
      {
        "key": "NOTE",
        "value": "שלום"
      },
      {
        "key": "FLAG",
        "value": ""
      },
      {
        "key": "PATH_EXTRA",
        "value": "bin/app:./scripts"
      }
    ],
    "env": {
      "NAME": "Ada",
      "CITY": "Tel Aviv",
      "NOTE": "שלום",
      "FLAG": "",
      "PATH_EXTRA": "bin/app:./scripts"
    }
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "env-parse",
  "version": "1.0.0",
  "input": {
    "text": "# greeting\nNAME=Ada\nCITY=\"Tel Aviv\"\nNOTE='שלום'\nFLAG=\nPATH_EXTRA=bin/app:./scripts\n"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/env-parse/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"text":"# greeting\nNAME=Ada\nCITY=\"Tel Aviv\"\nNOTE='\''שלום'\''\nFLAG=\nPATH_EXTRA=bin/app:./scripts\n"}'
```

The machine-readable contract is at [/v1/tools/env-parse/versions/1.0.0](/v1/tools/env-parse/versions/1.0.0).

### CLI

```sh
node cli.mjs run env-parse 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [.env stringify](/tools/env-stringify): Serialize unique env key/value entries to a canonical dotenv-subset document.
- [.env merge](/tools/env-merge): Overlay two dotenv-subset documents, replacing left values and appending right-only keys.
- [SemVer compare](/tools/semver-compare): Compare two strict Semantic Versions by precedence.
- [SemVer filter](/tools/semver-filter): Filter strict versions that satisfy a range, preserving original order and strings.
- [SemVer satisfies](/tools/semver-satisfies): Test whether a strict version satisfies a semver range.
- [SemVer sort](/tools/semver-sort): Sort strict valid Semantic Versions in ascending precedence order.
