I’m excited to announce the release of M365 CLI, a modern command-line interface for Microsoft 365. Whether you’re using a work/school account or a personal Microsoft account (Outlook.com, Hotmail, Live), you can now manage Mail, Calendar, OneDrive, and SharePoint directly from your terminal.
Why M365 CLI?
While there are existing tools for Microsoft 365, this CLI was built with two primary audiences in mind:
1. AI Agents (Like OpenClaw)
The primary motivation behind this project was to give AI agents a reliable, script-friendly way to interact with Microsoft 365 on behalf of users. By supporting structured JSON output and natural language workflows, agents can now:
- Read, summarize, and reply to your emails.
- Manage your calendar events autonomously.
- Upload, download, and search files on OneDrive.
- Integrate M365 data into complex, multi-step agent pipelines.
2. Power Users
For developers and terminal enthusiasts, switching to a heavy GUI just to check an email or upload a file breaks focus. M365 CLI provides:
- Quick email triage straight from the command line.
- Script-friendly JSON output for building your own automations.
- Lightweight, fast access without the overhead of a browser tab.
Key Features
- 📧 Mail: List, read, send, and search emails (including attachments). It also includes a built-in phishing protection feature via a trusted senders whitelist.
- 📅 Calendar: Full event management (list, create, update, delete).
- 📁 OneDrive: Robust file operations (upload, download, search, share) with support for large file chunking.
- 🌐 SharePoint: Site and document management (work/school accounts only).
- 👤 Universal Support: Works seamlessly with both enterprise/school accounts and personal Microsoft accounts.
- 🔐 Secure: Uses OAuth 2.0 Device Code Flow authentication. Credentials are stored securely locally.
Getting Started
Installation is simple via npm:
npm install -g m365-cli
Quick Usage Examples
Login:
# Work or school account (default)
m365 login
# Personal Microsoft account
m365 login --account-type personal
Check your latest emails:
m365 mail list --top 5
See your upcoming week:
m365 calendar list --days 7
Browse your OneDrive:
m365 onedrive ls
AI Agent Skills Available
If you are using an AI agent framework like OpenClaw, the corresponding skills are already published and ready to use on ClawHub:
Open Source
M365 CLI is completely open-source under the MIT License. Check out the code, read the full documentation, and contribute on GitHub:
Give it a try and let me know how it fits into your workflow—whether you’re using it yourself or empowering your AI assistants!