
lionello/onedrive-cli 是从 https://github.com/lionello/onedrive-cli. 导入的 MCP 服务器候选。
概览
lionello/onedrive-cli 是从 https://github.com/lionello/onedrive-cli. 导入的 MCP 服务器候选。
概述(AI 翻译)
OneDrive(个人)跨平台命令行界面
安装
与npm共度:
这会将命令安装为onedrive,并用onedrive-cli作为别名。
或者用nix-env:
或者引用来源:
开始
登录一次,然后将硬盘当作文件系统使用:
login 打开你的浏览器,然后存储它重新获得的访问令牌
~/.onedrive-cli-token(或如果设置了 $XDG_STATE_HOME)。令牌有效
一小时内,当命令报告令牌时,再次运行login
已过期。添加 -r 以获得只读令牌。
用途
usage: onedrive COMMAND [arguments]
随时运行 onedrive help(或 -h/--help)
onedrive --version 用于安装版本。命令如下:
album- 列表、创建或编辑相册(ls/create/add/rm)cat- 将文件内容转储到 stdoutchmod- 更改共享权限cp- 将本地文件复制到 OneDrive 或反之df- 显示 OneDrive 存储使用统计数据find- 按名称查找文件或文件夹,可选用NUL分隔。grep- 全文搜索,显示匹配路径help- 显示支持命令列表
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
onedrive-cli
Cross-platform command line interface for OneDrive (Personal)
Installation
With npm:
npm install -g @lionello/onedrive-cli
That installs the command as onedrive, with onedrive-cli as an alias for it.
Or with nix-env:
nix-env -if https://github.com/lionello/onedrive-cli/archive/master.tar.gz -A package
Or from source:
git clone https://github.com/lionello/onedrive-cli.git
cd onedrive-cli
npm install
bin/onedrive login
Getting started
Sign in once, then use the drive like a filesystem:
onedrive login # opens the Microsoft login page
onedrive df # check the connection and storage usage
onedrive ls # list your drive root
login opens your browser, then stores the access token it gets back in
~/.onedrive-cli-token (or $XDG_STATE_HOME if that is set). Tokens are valid
for one hour, so run login again when a command reports that the token
expired. Add -r for a read-only token.
Usage
usage: onedrive COMMAND [arguments]
Run onedrive help (or -h/--help) for this list at any time, and
onedrive --version for the installed version. The commands are:
album- list, create, or edit photo albums (ls/create/add/rm)cat- dumps the contents of a file to stdoutchmod- change sharing permissionscp- copies local file(s) to OneDrive or vice-versadf- shows OneDrive storage usage statsfind- find file(s) or folder(s) by name, optionally separated byNULgrep- full-text search across the drive, listing matching pathshelp- shows list of supported commandsln- create a link to the remote itemlogin- request/store an OAuth access tokenls- list the contents of a foldermcp- run a read-only MCP server over stdiomkdir- create a remote foldermv- move a local file to OneDrive or vice-versarm- delete a file or folder from OneDrivesendmail- send an invitation email for editing to recipientsstat- dump all information for particular file(s)wget- copy a remote URL to OneDrive (server side)
Examples
List the contents of the Public folder
onedrive ls Public
Grep one file
onedrive cat Documents/passwords | grep boa
Let OneDrive upload a file server side
onedrive wget http://mega.com/somehugepublicfile Documents/somehugepublicfile
Upload files recursively
find * -type f -print0 | xargs -0 -n1 -I{} onedrive cp "./{}" "Shared Favorites/{}"
Move remote files to a new folder
onedrive find 'Pictures/Camera Roll' -regex 2015 -type f -print0 | xargs -0 onedrive mv -t :/Pictures/2015/
Create an album and add photos to it
onedrive album create 'Summer 2026'
onedrive album add 'Summer 2026' 'Pictures/Camera Roll/IMG_1234.jpg'
onedrive albums # list all albums
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"onedrive": {
"command": "onedrive",
"args": ["mcp"]
}
}
}