LO

lionello/onedrive-cli

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

179 stars 25 forks 质量 81 趋势 20MIT

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 - 将文件内容转储到 stdout
  • chmod - 更改共享权限
  • 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 stdout
  • chmod - change sharing permissions
  • cp - copies local file(s) to OneDrive or vice-versa
  • df - shows OneDrive storage usage stats
  • find - find file(s) or folder(s) by name, optionally separated by NUL
  • grep - full-text search across the drive, listing matching paths
  • help - shows list of supported commands
  • ln - create a link to the remote item
  • login - request/store an OAuth access token
  • ls - list the contents of a folder
  • mcp - run a read-only MCP server over stdio
  • mkdir - create a remote folder
  • mv - move a local file to OneDrive or vice-versa
  • rm - delete a file or folder from OneDrive
  • sendmail - send an invitation email for editing to recipients
  • stat - 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
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "onedrive": { "command": "onedrive", "args": ["mcp"] } } }