MyNixOS website logo
option

programs.mcp.servers.<name>.env

Environment variables set when spawning the MCP server. Each value is either a literal string or a file reference ({ file = "/path"; }).

File references behave differently depending on the consumer:

  • Clients that understand the {file:…} syntax (e.g. opencode) receive the path as a substitution token.
  • Other clients receive a generated wrapper script that reads the secret at startup instead.

Only valid for local servers.

Declarations
Type
attribute set of (string or (submodule))
Default
{ }
Example
{
  API_BASE_URL = "https://api.example.com";
  FORGEJO_ACCESS_TOKEN.file = "/run/secrets/forgejo_token";
}