Keeping secrets out of Git
Hardcoding an API token in .mcp.json or telling contributors to paste secrets into an untracked .env file is an accident waiting to happen. OpenLune keeps credentials out of your manifest, out of generated client configs, out of .openlune/, and out of review output.
Secrets are resolved only in memory at the exact moment a server launches or tools are installed.
Storing a secret
Section titled “Storing a secret”Use openlune secret set to save a credential in your operating system’s credential store (macOS Keychain, Linux Secret Service, or Windows Credential Manager):
openlune secret set tracker-tokenOpenLune prompts for the value with hidden terminal input—it intentionally refuses values passed as command-line arguments or piped from stdin, so credentials don’t end up in shell history.
Secrets are stored under the io.openlune.secrets service name for your OS user account, independent of any specific checkout or AI client. If you rotate a token, just run openlune secret set <name> again to replace it—you don’t need to re-run openlune apply or reinstall any tools.
To remove a stored credential:
openlune secret delete tracker-tokenWiring secrets into stdio MCP servers (envFrom)
Section titled “Wiring secrets into stdio MCP servers (envFrom)”Reference stored secrets—or environment variables—using envFrom on a stdio MCP server:
mcp: tracker: transport: stdio command: tracker-mcp envFrom: TRACKER_TOKEN: secret:tracker-tokenEach entry under envFrom maps a target variable name (what the MCP server expects to see in its environment) to one or more sources:
secret:<name>— Read<name>from the OS credential store.env:<VAR>— Read<VAR>from the environment the AI client (oropenlune apply, forinstall.envFrom) was launched from.
Ordered fallbacks
Section titled “Ordered fallbacks”You can pass a list of sources instead of a single string. OpenLune tries them in order and uses the first one that exists:
mcp: tracker: transport: stdio command: tracker-mcp envFrom: TRACKER_TOKEN: - secret:tracker-token - env:TRACKER_TOKENThis pattern works great for teams: developers using desktop apps (which don’t inherit shell exports) can store the token once in their OS keychain, while developers in CI or terminal sessions can just export TRACKER_TOKEN.
A few rules to keep in mind:
- No overlap with
env. A variable name cannot appear in bothenv(literal values) andenvFrom. - Presence checks without leaking values. After
openlune applyand duringopenlune verify, OpenLune checks whether requiredsecret:entries exist in your OS store and tells you the exactopenlune secret setcommand if one is missing—without printing or storing any secret values. - No
HOME,PATH, orMISE_*overrides on managed servers. For servers usinginstall.tools, those variables belong to OpenLune’s isolated environment and cannot be set viaenvorenvFrom.
Secrets needed during tool installation (install.envFrom)
Section titled “Secrets needed during tool installation (install.envFrom)”If downloading a managed MCP package requires registry credentials (like an internal npm or PyPI token), put envFrom inside install: rather than on the server itself:
mcp: internal-tools: transport: stdio command: internal-tools-mcp install: tools: - tool: node version: "24.22.3" - tool: npm:@acme/internal-tools-mcp version: "1.4.0" envFrom: NPM_TOKEN: [secret:acme-npm-token, env:NPM_TOKEN]install.envFrom resolves right before declared tools are installed during openlune apply (reading env: sources from the shell running openlune apply) and never leaks into the MCP server’s runtime environment.
HTTP MCP headers (headersFrom)
Section titled “HTTP MCP headers (headersFrom)”Remote http MCP servers connect directly from the AI client rather than going through openlune mcp run, so OpenLune cannot read your OS credential store on the client’s behalf. Instead, headersFrom writes each client’s native environment-variable reference into its config:
mcp: metrics: transport: http url: https://mcp.metrics.example/v1 headers: X-Team: platform headersFrom: Authorization: "Bearer ${env:METRICS_TOKEN}"Write every variable reference as ${env:NAME} inside headersFrom. Static headers belong in headers, which rejects ${ and $NAME so literal values are never accidentally expanded by a client.
Because clients differ in what they support for HTTP headers, here is how each one renders headersFrom:
| Client | How headersFrom is rendered |
|---|---|
| Claude Code, Copilot | Replaces ${env:NAME} with ${NAME} in header values |
| Grok Build | Keeps ${env:NAME} in header values |
| Codex | Supports whole-value headers ("${env:NAME}" via env_http_headers) and Authorization: "Bearer ${env:NAME}" (via bearer_token_env_var). Other mixed templates are omitted as a deviation. |
| Antigravity | Cannot read HTTP headers from environment variables yet; headers in headersFrom are omitted as a deviation. |