We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/dcpurnell/m365calender-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
#!/usr/bin/env node
import { AuthManager, AuthConfig } from "./auth.js";
import { CalendarMcpServer } from "./server.js";
async function main(): Promise<void> {
const clientId = process.env.M365_CLIENT_ID;
const tenantId = process.env.M365_TENANT_ID;
if (!clientId) {
console.error(
"Error: M365_CLIENT_ID environment variable is required.\n" +
"Set it to your Azure AD app registration client ID.\n" +
"See README.md for setup instructions."
);
process.exit(1);
}
const config: AuthConfig = {
clientId,
tenantId,
};
const auth = new AuthManager(config);
const args = process.argv.slice(2);
if (args.includes("--login")) {
await auth.login();
return;
}
if (args.includes("--logout")) {
await auth.logout();
return;
}
if (args.includes("--check-auth")) {
const isAuth = await auth.isAuthenticated();
console.error(isAuth ? "Authenticated" : "Not authenticated");
process.exit(isAuth ? 0 : 1);
}
// Verify we can authenticate before starting the server
const isAuth = await auth.isAuthenticated();
if (!isAuth) {
console.error(
"Not authenticated. Run with --login flag first, or set up credentials.\n" +
"Usage: m365calendar-mcp --login"
);
process.exit(1);
}
const server = new CalendarMcpServer(auth);
await server.start();
}
main().catch((error) => {
console.error("Fatal error:", error);
process.exit(1);
});