Microsoft OneDrive CLI
for cmdhub.
OneDrive files, folders, metadata, trash, and sharing permissions through Microsoft Graph.
cmdhub get msdrive
data_object Agent Contract
Agents should start with auth/status and discovery commands, inspect schemas before composition, and treat commands marked as mutating as state-changing operations.
Output
Use human output for normal reads, `--json` for scripting or complete structured fields, and `--jsonl` for upstream pipe inputs.
Auth
Microsoft OAuth. Used for OneDrive files, folders, and permissions.
Refs
Prefer list/search, then short refs or piped JSONL. Use `resolve` to inspect cached refs.
Schemas
Use `msdrive schema` and `catalog.json` to inspect fields, flags, examples, and side effects.
Auth scopes
offline_accessUser.ReadFiles.ReadWriteOptional scope bundles
With msdrive auth login --scope-set shared
Files.ReadWriteFiles.ReadWrite.AllSites.ReadWrite.Allterminal Command Reference
Generated from source. Global flags apply to all commands.
Global Flags
--json
bool
Emit JSON machine output--jsonl
bool
Emit JSONL records for piping--output, -o
string
Compatibility output mode: json|jsonl. Prefer --json or --jsonl--view
string = summary
View mode: summary|full--profile
string = default
Config/auth profile--config
string
Config path override--quiet, -q
bool
Suppress non-essential diagnostics--debug
bool
Enable debug diagnostics--limit
int = 50
Maximum items to emit--page-size
int = 50
Requested upstream page size--cursor
string
Continuation cursor--no-paginate
bool
Fetch only one page--version, -v
bool
Print version informationmsdrive activity
List OneDrive item activitymsdrive activity list
List recent item activity--file
string
File selectormsdrive auth
Manage Microsoft OneDrive authenticationmsdrive auth login
Authenticate with Microsoft OneDrive--browser
bool
Use browser loopback OAuth with PKCE instead of device-code OAuth--scope-set
string = default
Microsoft Graph scope set to request: default or sharedmsdrive auth logout
Remove stored credentialsmsdrive auth refresh
Refresh stored tokenmsdrive auth status
Show auth statusmsdrive auth whoami
Show current OneDrive identitymsdrive capabilities
Describe capabilities--section
string
Show one capability section: scopes, schemas, or commandsmsdrive change
List OneDrive delta changesmsdrive change list
List drive or folder changes--drive
string
Drive selector--folder
string
Folder selectormsdrive config
Inspect local configurationmsdrive config explain
Explain resolved configurationmsdrive doctor
Run msdrive diagnosticsmsdrive drive
Manage visible Microsoft drivesmsdrive drive get
Get drive metadata--drive
string
Drive selectormsdrive drive list
List visible drivesmsdrive drive quota
Show drive quota--drive
string
Drive selectormsdrive drive use
Select the default drive for this profile--drive
string
Drive selectormsdrive file
Manage OneDrive filesmsdrive file copy
Copy a file--conflict
string = fail
Conflict behavior: fail, rename, or replace--file
string
File selector--folder
string
Destination folder selector--name
string
Copied file namemsdrive file delete
Permanently delete a file--all
bool
Confirm batch permanent deletion--dry-run
bool
Preview permanent deletion without deleting--file
string
File selector--yes
bool
Confirm permanent deletionmsdrive file download
Download file bytes--file
string
File selector--out
string
Output path. Omit to print content.msdrive file export
Export a Microsoft Office file--file
string
File selector--mime-type
string = pdf
Export format or MIME type--out
string
Output path. Omit to print content.msdrive file get
Get file metadata--file
string
File selectormsdrive file list
List files--created-after
string
Filter items created on or after RFC3339 or YYYY-MM-DD--created-before
string
Filter items created on or before RFC3339 or YYYY-MM-DD--drive
string
Drive selector--folder
string
Folder selector--has-link
bool
Only show items with sharing links--modified-after
string
Filter items modified on or after RFC3339 or YYYY-MM-DD--modified-before
string
Filter items modified on or before RFC3339 or YYYY-MM-DD--owned-by
string
Filter by owner class: me or other--query
string
Name/full-text query--shared
bool
Only show shared items--trashed
bool
Include trashed files--type
string
Filter by type: file, folder, package, image, video, audio, office, or pdfmsdrive file move
Move a file to another folder--file
string
File selector--folder
string
Destination folder selector--name
string
Optional new file namemsdrive file preview
Create a file preview URL--file
string
File selectormsdrive file replace
Replace file content--file
string
File selector--mime-type
string
Content MIME type--path
string
Replacement local file pathmsdrive file search
Search files by name or text--created-after
string
Filter items created on or after RFC3339 or YYYY-MM-DD--created-before
string
Filter items created on or before RFC3339 or YYYY-MM-DD--drive
string
Drive selector--folder
string
Folder selector--has-link
bool
Only show items with sharing links--modified-after
string
Filter items modified on or after RFC3339 or YYYY-MM-DD--modified-before
string
Filter items modified on or before RFC3339 or YYYY-MM-DD--owned-by
string
Filter by owner class: me or other--query
string
Name/full-text query--shared
bool
Only show shared items--trashed
bool
Include trashed files--type
string
Filter by type: file, folder, package, image, video, audio, office, or pdfmsdrive file trash
Move a file to trash--all
bool
Confirm batch trash--dry-run
bool
Preview trash without changing files--file
string
File selectormsdrive file untrash
Restore a file from trash--all
bool
Confirm batch untrash--dry-run
bool
Preview restore without changing files--file
string
File selectormsdrive file update
Update file metadata or parents--add-parent
stringSlice = []
Folder selector to add as parent--description
string
New description--file
string
File selector--name
string
New file name--remove-parent
stringSlice = []
Folder selector to remove as parent--starred
bool
Set starredmsdrive file upload
Upload a local file--conflict
string = rename
Conflict behavior: fail, rename, or replace--description
string
File description--folder
string
Parent folder selector--mime-type
string
Content MIME type--name
string
OneDrive file name--path
string
Local file pathmsdrive folder
Manage OneDrive foldersmsdrive folder copy
Copy a folder--conflict
string = fail
Conflict behavior: fail, rename, or replace--folder
string
Folder selector--name
string
Copied folder name--parent
string
Destination parent folder selectormsdrive folder create
Create a folder--description
string
Folder description--name
string
Folder name--parent
string
Parent folder selectormsdrive folder delete
delete a folder--all
bool
Confirm batch operation--dry-run
bool
Preview operation without changing folders--folder
string
Folder selector--yes
bool
Confirm permanent deletionmsdrive folder get
Get folder metadatamsdrive folder list
List folders--created-after
string
Filter items created on or after RFC3339 or YYYY-MM-DD--created-before
string
Filter items created on or before RFC3339 or YYYY-MM-DD--drive
string
Drive selector--folder
string
Parent folder selector--has-link
bool
Only show items with sharing links--modified-after
string
Filter items modified on or after RFC3339 or YYYY-MM-DD--modified-before
string
Filter items modified on or before RFC3339 or YYYY-MM-DD--owned-by
string
Filter by owner class: me or other--query
string
Folder name query--shared
bool
Only show shared items--trashed
bool
Include trashed folders--type
string
Filter by type: file, folder, package, image, video, audio, office, or pdfmsdrive folder move
Move a folder--folder
string
Folder selector--name
string
Optional new folder name--parent
string
Destination parent folder selectormsdrive folder search
Search folders by name--created-after
string
Filter items created on or after RFC3339 or YYYY-MM-DD--created-before
string
Filter items created on or before RFC3339 or YYYY-MM-DD--drive
string
Drive selector--folder
string
Parent folder selector--has-link
bool
Only show items with sharing links--modified-after
string
Filter items modified on or after RFC3339 or YYYY-MM-DD--modified-before
string
Filter items modified on or before RFC3339 or YYYY-MM-DD--owned-by
string
Filter by owner class: me or other--query
string
Folder name query--shared
bool
Only show shared items--trashed
bool
Include trashed folders--type
string
Filter by type: file, folder, package, image, video, audio, office, or pdfmsdrive folder trash
trash a folder--all
bool
Confirm batch operation--dry-run
bool
Preview operation without changing folders--folder
string
Folder selectormsdrive folder untrash
untrash a folder--all
bool
Confirm batch operation--dry-run
bool
Preview operation without changing folders--folder
string
Folder selectormsdrive folder update
Update folder metadata--description
string
New folder description--folder
string
Folder selector--name
string
New folder namemsdrive link
Manage OneDrive sharing linksmsdrive link create
Create a sharing link--expires-at
string
Link expiration time, for example +7d or 2026-06-20T15:04:05Z--file
string
File selector--password
bool
Request a password-protected link when supported--role
string = reader
Link role: reader|writer--scope
string = anonymous
Link scope: users|organization|anonymous--yes
bool
Confirm sharing link creationmsdrive link list
List sharing links--file
string
File selectormsdrive link remove
Remove a sharing link--dry-run
bool
Preview sharing link removal without changing permissions--file
string
File selector--link
string
Link selector--yes
bool
Confirm sharing link removalmsdrive mcp
Run the MCP serverRun a stdio Model Context Protocol server for this adapter.
The server exposes read-only resource commands by default. Mutating commands are listed only when explicitly allowed with –allow and remain gated by the command contract safety class.
--allow
stringArray = []
Allow mutating command keys such as gmail.message.archive or gmail.message.label.*--allow-dangerous
bool
Allow --allow wildcards to include destructive or sends_external commands--concurrency
int
Maximum concurrent MCP subprocesses--max-output
int64 = 0
Maximum stdout/stderr bytes captured per MCP command--print-config
bool
Print MCP tool configuration and exit--timeout
duration = 0s
Per-command MCP subprocess timeout, for example 45s or 2mmsdrive permission
Manage OneDrive permissionsmsdrive permission add
Add a permission--allow-discovery
bool
Allow public/domain discovery--domain
string
Domain for domain permission--email
string
Email address for user/group permission--file
string
File selector--role
string = reader
Permission role: reader|writer--type
string = anyone
Permission type: user|group|domain|anyone--yes
bool
Confirm broad anyone/domain sharingmsdrive permission list
List file permissions--file
string
File selectormsdrive permission remove
Remove a permission--all
bool
Confirm batch permission removal--dry-run
bool
Preview permission removal without changing permissions--file
string
File selector--permission
string
Permission selector--yes
bool
Confirm permission removalmsdrive profile
Manage provider profilesmsdrive profile create
Create an unauthenticated provider profilemsdrive profile delete
Delete a local provider profilemsdrive profile list
List provider profilesmsdrive profile rename
Rename a local provider profilemsdrive profile use
Set the default provider profilemsdrive resolve
Resolve a marker or short idmsdrive schema
Emit msdrive schema hints--in
bool
Show input schema--input
bool
Show input schema--out
bool
Show output schemamsdrive upload-session
Resume or cancel OneDrive large upload sessionsmsdrive upload-session cancel
Cancel a large upload session--dry-run
bool
Preview upload session cancellation without canceling it--session
string
Upload session selector--yes
bool
Confirm upload session cancellationmsdrive upload-session resume
Resume a large upload session--session
string
Upload session selectormsdrive upload-session status
Inspect a resumable upload session--session
string
Upload session selectormsdrive version
Show msdrive version informationmsdrive version download
Download version bytes--file
string
File selector--out
string
Output path. Omit to print content.--version
string
Version selectormsdrive version get
Get a file version--file
string
File selector--version
string
Version selectormsdrive version list
List file versions--file
string
File selectormsdrive version restore
Restore a file version--file
string
File selector--version
string
Version selector--yes
bool
Confirm version restoreplay_circle Live Examples
Output captured from a real workspace. Regenerate with
scripts/gen-docs.sh --update.
auth
Authenticated as kestrelphilip@outlook.com Next steps: - Files: msdrive file list --limit 10 - Folders: msdrive folder list --limit 10 - Capabilities: msdrive capabilities
files
REF TITLE WHEN
f1 Documents Wed 29 Apr 05:31
f2 OneDrive Eval Folder {id} Wed 29 Apr 05:59
f3 OneDrive Eval Folder {id} Wed 29 Apr 06:00
f4 OneDrive Eval Folder {id} Wed 29 Apr 06:50
f5 OneDrive Eval Folder {id} Wed 29 Apr 07:06
Next steps:
- More: msdrive file list --cursor https://graph.microsoft.com/v1.0/me/drive/root/children?$select=id%2cname%2cdescription%2csize%2ccreatedDateTime%{id}%2cwebUrl%2c%40microsoft.graph.downloadUrl%2cparentReference%2cfile%2cfolder%2cdeleted%2cshared%2ccreatedBy&$top=5&$skiptoken={id}
- Open: msdrive file get f1
- Search: msdrive file search --query <text>
- Files: msdrive file list --limit 10REF TITLE WHEN
f1 OneDrive Eval Folder {id} Sun 17 May 14:09
f2 OneDrive Eval Folder {id} Sun 03 May 08:37
f3 OneDrive Eval Folder {id} Wed 29 Apr 19:12
f4 OneDrive Eval Folder {id} Thu 30 Apr 12:00
f5 OneDrive Eval Folder {id} Thu 30 Apr 12:29
Next steps:
- More: msdrive file list --cursor https://graph.microsoft.com/v1.0/me/drive/root/search(q='eval')?$select=id%2cname%2cdescription%2csize%2ccreatedDateTime%{id}%2cwebUrl%2c%40microsoft.graph.downloadUrl%2cparentReference%2cfile%2cfolder%2cdeleted%2cshared%2ccreatedBy&$top=5&$skiptoken=Ng
- Open: msdrive file get f1
- Search: msdrive file search --query <text>
- Files: msdrive file list --limit 10folders
REF TITLE WHEN
d1 Documents Wed 29 Apr 05:31
d2 OneDrive Eval Folder {id} Wed 29 Apr 05:59
d3 OneDrive Eval Folder {id} Wed 29 Apr 06:00
d4 OneDrive Eval Folder {id} Wed 29 Apr 06:50
d5 OneDrive Eval Folder {id} Wed 29 Apr 07:06
Next steps:
- More: msdrive folder list --cursor https://graph.microsoft.com/v1.0/me/drive/root/children?$select=id%2cname%2cdescription%2csize%2ccreatedDateTime%{id}%2cwebUrl%2c%40microsoft.graph.downloadUrl%2cparentReference%2cfile%2cfolder%2cdeleted%2cshared%2ccreatedBy&$top=5&$skiptoken={id}
- Open: msdrive folder get d1
- Search: msdrive folder search --query <text>
- Files: msdrive file list --limit 10alt_route Composition Patterns
Bridge your ecosystem with zero middleware.
msdrive auth login
# Search for a file, inspect metadata, then list its sharing permissions
msdrive file search --query "project notes" --limit 1 --jsonl \
| msdrive file get
msdrive permission list --file f1
# Upload into a folder discovered from a pipe
msdrive folder search --query "Project docs" --limit 1 --jsonl \
| msdrive file upload --path ./notes.txt --name notes.txt