generate_secret
Generate cryptographic secrets using quantum noise for secure API keys, tokens, passwords, and UUIDs. Save directly to your OS-native vault to prevent plaintext leaks.
Instructions
Generate a cryptographic secret (quantum noise). Formats: hex, base64, alphanumeric, uuid, api-key, token, password. Optionally save directly to the keyring.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| format | No | Output format | api-key |
| length | No | Length in bytes or characters | |
| prefix | No | Prefix for api-key/token format | |
| saveAs | No | If provided, save the generated secret with this key name | |
| scope | No | Scope: global or project | global |
| projectPath | No | Project root path for project-scoped secrets |
Implementation Reference
- src/mcp/server.ts:526-560 (handler)The MCP tool definition for "generate_secret", including its input schema and handler function which calls `generateSecret` from `../core/noise.js`.
"generate_secret", "Generate a cryptographic secret (quantum noise). Formats: hex, base64, alphanumeric, uuid, api-key, token, password. Optionally save directly to the keyring.", { format: z .enum(["hex", "base64", "alphanumeric", "uuid", "api-key", "token", "password"]) .optional() .default("api-key") .describe("Output format"), length: z.number().optional().describe("Length in bytes or characters"), prefix: z.string().optional().describe("Prefix for api-key/token format"), saveAs: z.string().optional().describe("If provided, save the generated secret with this key name"), scope: scopeSchema.default("global"), projectPath: projectPathSchema, }, async (params) => { const secret = generateSecret({ format: params.format as NoiseFormat, length: params.length, prefix: params.prefix, }); if (params.saveAs) { setSecret(params.saveAs, secret, { ...opts(params), description: `Generated ${params.format} secret`, }); const entropy = estimateEntropy(secret); return text( `Generated and saved as "${params.saveAs}" (${params.format}, ~${entropy} bits entropy)`, ); } return text(secret); }, );