1.5 KiB
1.5 KiB
MCP Gateway Home Manager Module
homeManagerModules.mcp-gateway exposes services.mcp-gateway and renders
~/.config/mcp-gateway/gateway.yaml from Nix options.
Import
home-manager.sharedModules = [
mcp-servers.homeManagerModules.mcp-gateway
];
Minimal example
services.mcp-gateway = {
enable = true;
server = {
host = "100.64.0.19";
port = 39401;
};
environmentFile = "/run/secrets/rendered/mcp_gateway_env";
auth.apiKeys.dev = {
key = "env:DEV_GATEWAY_KEY";
backends = [ "nixos" "fetch" ];
};
backends = {
nixos.command = "${pkgs.mcp-nixos}/bin/mcp-nixos";
fetch.command = "${pkgs.mcp-server-fetch}/bin/mcp-server-fetch";
};
};
services.mcp-gateway.url is read-only and resolves to
http://<server.host>:<server.port>/mcp, for use by MCP clients.
Backends
Backends are keyed by name and support:
commandfor stdio backends, orhttpUrlfor HTTP backendscwd,timeout,env,headerspassthrough,allowCleartextCredentialsresolveEnv = trueto wrap commands that read literal${env.VAR}placeholdersextraConfigfor fields not modelled by the module
API keys
API keys are keyed by client name. The key may use the gateway's env:VAR,
keychain:NAME, or oauth:PROVIDER indirection. Avoid literal secrets in the
Nix store.
Routing profiles
routingProfiles.<name> supports allowBackends, denyBackends,
allowTools, and denyTools. Set defaultRoutingProfile to the profile used
when a session has not selected one.