// Auth launcher for ESM environment
import { initializeAuth } from './src/auth/microsoft-graph-auth.ts';
const config = {
// Your registered Azure App
clientId: '7631e9cc-e337-459e-bce0-9e7d9d00ff99', // OneDrive MCP App
tenantId: 'common', // personal + business accounts
scopes: [
'User.Read',
'Files.ReadWrite.All',
'Notes.ReadWrite.All',
'offline_access'
]
};
async function main() {
console.log('š§ OneDrive/SharePoint MCP Server - Authentication');
console.log('='.repeat(50));
const auth = initializeAuth(config);
console.log('\nš Starting authentication...\n');
const tokenInfo = await auth.authenticate();
console.log('\nā
Authentication successful!');
console.log(`š¤ User: ${tokenInfo.account.username}`);
console.log(`š Name: ${tokenInfo.account.name || 'N/A'}`);
console.log(`ā° Expires: ${tokenInfo.expiresOn.toLocaleString()}`);
console.log('\nš You can now use OneNote tools!');
}
main().catch(err => {
console.error('ā Authentication failed:', err.message);
process.exit(1);
});