19 lines
497 B
JavaScript
19 lines
497 B
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Generate a secure random token for MCP Database Server authentication
|
|
*/
|
|
|
|
import { randomBytes } from 'crypto';
|
|
|
|
const bytes = parseInt(process.argv[2], 10) || 32;
|
|
const token = randomBytes(bytes).toString('hex');
|
|
|
|
console.log('Generated token:');
|
|
console.log(token);
|
|
console.log('');
|
|
console.log('Add to your environment:');
|
|
console.log(`export MCP_AUTH_TOKEN="${token}"`);
|
|
console.log('');
|
|
console.log('Or add to .env file:');
|
|
console.log(`MCP_AUTH_TOKEN=${token}`);
|