Microsoft Graph API integration for OpenClaw agents - manage email, calendar, and tasks
Project description
OfficeClaw
Microsoft Graph API integration for OpenClaw agents — manage email, calendar, and tasks.
Overview
OfficeClaw is an OpenClaw skill that enables AI agents to interact with personal Microsoft accounts through the Microsoft Graph API. Agents can read/write emails, manage calendar events, and handle tasks — all through natural language commands.
- 📧 Email — Read inbox, send emails with attachments, search, mark read/unread, archive
- 📅 Calendar — View events, create meetings, update, accept/decline
- ✅ Tasks — Manage Microsoft To Do lists, create/complete/reopen tasks
Quick Start
Installation
pip install officeclaw
Setup (One-Time)
Quick start: OfficeClaw ships with a default app registration — just run
officeclaw auth loginand go. No Azure setup needed.Advanced: Want full control? Create your own Azure App Registration (free, ~5 minutes) and set
OFFICECLAW_CLIENT_IDin your.env. See Microsoft's guide or follow the steps below.
1. Create an Azure App Registration
-
Go to entra.microsoft.com → App registrations → New registration
-
Name:
officeclaw(or anything you like) -
Supported account types: Personal Microsoft accounts only
-
Redirect URI: leave blank (not needed for device code flow)
-
Click Register
-
Copy the Application (client) ID — this is your
OFFICECLAW_CLIENT_ID -
Go to Authentication → Advanced settings → Allow public client flows → Yes → Save
-
Go to API permissions → Add permission → Microsoft Graph → Delegated permissions. Choose based on your needs:
Read-only (safest):
Mail.Read,Calendars.Read,Tasks.ReadWrite*
Full access (all features including send/delete):
Mail.Read,Mail.ReadWrite,Mail.SendCalendars.Read,Calendars.ReadWriteTasks.ReadWrite
*Tasks.ReadWrite is the minimum available scope for Microsoft To Do — there is no read-only option.
Least privilege: Only grant the permissions you actually need. If you only want to read emails and calendar, skip
Mail.ReadWrite,Mail.Send, andCalendars.ReadWrite. OfficeClaw will gracefully error on commands that require missing permissions.
2. Configure Environment
Create a .env file:
OFFICECLAW_CLIENT_ID=your-client-id-here
# Capability gates (disabled by default for safety)
# OFFICECLAW_ENABLE_SEND=true # Allow sending/replying/forwarding emails
# OFFICECLAW_ENABLE_DELETE=true # Allow deleting emails, events, and tasks
No client secret needed for device code flow. Write operations (send, delete) are disabled by default — enable only what you need.
3. Authenticate
officeclaw auth login
This displays a URL and code. Open the URL in a browser, enter the code, and sign in with your Microsoft account. Tokens are stored securely in ~/.officeclaw/token_cache.json (permissions 600).
Usage
# List recent emails
officeclaw mail list --limit 10
# Send an email with attachment
officeclaw mail send --to user@example.com --subject "Report" --body "See attached" --attachment report.pdf
# Search emails
officeclaw mail search --query "from:boss@example.com"
# View calendar
officeclaw calendar list --start 2026-02-01 --end 2026-02-28
# Create a calendar event
officeclaw calendar create --subject "Team Meeting" --start "2026-02-15T10:00:00" --end "2026-02-15T11:00:00" --location "Conference Room"
# List task lists
officeclaw tasks list-lists
# Create a task
officeclaw tasks create --list-id <id> --title "Review report" --due-date "2026-02-20"
# JSON output (for agents)
officeclaw --json mail list
For OpenClaw Agents
Install as a skill:
clawhub install officeclaw
Once installed, OpenClaw agents can use OfficeClaw through natural language:
User: "Show me today's calendar"
Agent: You have 3 events today:
• 9:00 AM — Team standup
• 2:00 PM — Client call
• 4:00 PM — Project review
User: "Send an email to john@example.com about tomorrow's meeting"
Agent: Email sent to john@example.com ✓
User: "Mark 'finish report' as done"
Agent: Task completed ✓
See skill/SKILL.md for the full skill manifest.
Commands
Authentication
| Command | Description |
|---|---|
officeclaw auth login |
Authenticate via device code flow |
officeclaw auth status |
Show authentication status |
officeclaw auth logout |
Clear stored tokens |
| Command | Description |
|---|---|
officeclaw mail list |
List messages |
officeclaw mail list --unread |
List unread messages only |
officeclaw mail get <id> |
Get message details |
officeclaw mail send --to <email> --subject <subj> --body <body> |
Send email |
officeclaw mail send ... --attachment <file> |
Send email with attachment |
officeclaw mail search --query <query> |
Search emails |
officeclaw mail archive <id> |
Archive a message |
officeclaw mail mark-read <id> |
Mark as read |
Calendar
| Command | Description |
|---|---|
officeclaw calendar list --start <date> --end <date> |
List events |
officeclaw calendar get <id> |
Get event details |
officeclaw calendar create --subject <subj> --start <dt> --end <dt> |
Create event |
officeclaw calendar update <id> --subject <subj> |
Update event |
officeclaw calendar delete <id> |
Delete event |
Tasks
| Command | Description |
|---|---|
officeclaw tasks list-lists |
List task lists |
officeclaw tasks list --list-id <id> |
List tasks |
officeclaw tasks list --list-id <id> --status active |
Active tasks only |
officeclaw tasks create --list-id <id> --title <title> |
Create task |
officeclaw tasks complete --list-id <id> --task-id <id> |
Complete task |
officeclaw tasks reopen --list-id <id> --task-id <id> |
Reopen task |
Configuration
Environment variables (or .env file):
| Variable | Required | Description |
|---|---|---|
OFFICECLAW_CLIENT_ID |
No | Azure app client ID (uses built-in default if not set) |
OFFICECLAW_CLIENT_SECRET |
No | Only for confidential client (auth code) flow. Not needed for device code flow. |
OFFICECLAW_TENANT_ID |
No | Tenant ID (default: consumers) |
OFFICECLAW_SCOPES |
No | Override default Graph API scopes |
OFFICECLAW_TOKEN_CACHE_DIR |
No | Token cache directory (default: ~/.officeclaw) |
OFFICECLAW_ENABLE_SEND |
No | Set true to allow send/reply/forward emails (default: disabled) |
OFFICECLAW_ENABLE_DELETE |
No | Set true to allow deleting emails, events, tasks (default: disabled) |
Security & Privacy
- Write operations disabled by default — Send, reply, forward, and delete are all blocked unless explicitly enabled via
OFFICECLAW_ENABLE_SENDandOFFICECLAW_ENABLE_DELETEenvironment variables. This prevents accidental or unauthorised write actions. - No client secret required — Uses device code flow (public client) by default
- Least-privilege permissions — You choose which Graph API scopes to grant — read-only is sufficient for most use cases. See the setup guide above.
- Tokens stored securely —
~/.officeclaw/token_cache.jsonwith 600 file permissions - No data storage — OfficeClaw passes data through, never stores email/calendar content
- No telemetry — No usage data collected
- Your own Azure app — Each user creates their own Azure app registration with their own client ID — no shared credentials
Development
# Clone and install
git clone https://github.com/danielithomas/officeclaw.git
cd officeclaw
pip install -e ".[dev]"
# Run tests
pytest
# Lint & format
ruff check src/ tests/
black --check src/ tests/
License
Apache License 2.0 — see LICENSE
Links
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file officeclaw-1.0.3.tar.gz.
File metadata
- Download URL: officeclaw-1.0.3.tar.gz
- Upload date:
- Size: 1.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f00c3a88dcb6da6b21c34680c2814f888fdc5fb7c1ff63d61015b9235c87dac
|
|
| MD5 |
080461b8a23b620f322782b26224ac2d
|
|
| BLAKE2b-256 |
306cb96a1ac039ec7a9395f67df5af4ac66a9bfd36e9cc5ae8b9c941f91b610c
|
Provenance
The following attestation bundles were made for officeclaw-1.0.3.tar.gz:
Publisher:
publish.yml on danielithomas/officeclaw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
officeclaw-1.0.3.tar.gz -
Subject digest:
2f00c3a88dcb6da6b21c34680c2814f888fdc5fb7c1ff63d61015b9235c87dac - Sigstore transparency entry: 1005480495
- Sigstore integration time:
-
Permalink:
danielithomas/officeclaw@6056be4fd5d2470e9f8aed7927c26d91ec9a8e43 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/danielithomas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6056be4fd5d2470e9f8aed7927c26d91ec9a8e43 -
Trigger Event:
push
-
Statement type:
File details
Details for the file officeclaw-1.0.3-py3-none-any.whl.
File metadata
- Download URL: officeclaw-1.0.3-py3-none-any.whl
- Upload date:
- Size: 33.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
543ef996bedfc5d7e5a43ed5bd89950421bbf0cc730809efec78271cf09030fb
|
|
| MD5 |
bde904bf0a6a94302eb3ef4915761b83
|
|
| BLAKE2b-256 |
e4177c602bfc38887b021efd3cd0b507239ef5a5b7a17cfcba4b47c260587750
|
Provenance
The following attestation bundles were made for officeclaw-1.0.3-py3-none-any.whl:
Publisher:
publish.yml on danielithomas/officeclaw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
officeclaw-1.0.3-py3-none-any.whl -
Subject digest:
543ef996bedfc5d7e5a43ed5bd89950421bbf0cc730809efec78271cf09030fb - Sigstore transparency entry: 1005480496
- Sigstore integration time:
-
Permalink:
danielithomas/officeclaw@6056be4fd5d2470e9f8aed7927c26d91ec9a8e43 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/danielithomas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6056be4fd5d2470e9f8aed7927c26d91ec9a8e43 -
Trigger Event:
push
-
Statement type: