Use passwordCommand to manage secrets
mainThe passwordCommand option is a secure way to integrate with password managers (like pass or gh auth) to retrieve sensitive credentials at runtime. This is handled via a wrapper regardless of the server's flavor.
There are two ways to specify it:
As a string: The command must output in
KEY=VALUEformat. Example:"pass mcp-server"(assumingpassoutputsTOKEN=xyz).As an attribute set: Keys are the target environment variable names, and values are lists of strings representing the command to run to get the value.
Example (Attribute Set):
passwordCommand = {
GITHUB_PERSONAL_ACCESS_TOKEN = [ "gh" "auth" "token" ];
};programs.github.passwordCommand = {
GITHUB_PERSONAL_ACCESS_TOKEN = [
"gh"
"auth"
"token"
];
};