A Kimi plugin to manage SharePoint and OneDrive through the Microsoft Graph API. Connect your Microsoft 365 account with OAuth2, explore sites and document libraries, upload and download files, and search documents โ all in natural language from Kimi.
- ๐ OAuth2 Authentication โ Device code flow with MSAL; token is stored locally and silently auto-refreshed.
- ๐ข Site Exploration โ List your followed SharePoint sites and search sites by keyword.
- ๐ Library Navigation โ List drives (document libraries) and explore folders in OneDrive or any site.
- โฌ๏ธ Downloads โ Bring files from SharePoint/OneDrive to your local workspace.
- โฌ๏ธ Uploads โ Upload local files to any remote folder, with conflict handling (
rename/replace/fail). - ๐ Search โ Search files by keyword in your OneDrive and accessible sites.
- ๐ Recent โ List files you have used recently.
Version: 0.1.0 โ Functional MVP โ
Completed:
- Plugin scaffold (manifest + skill)
- OAuth2 authentication (MSAL device flow, token cache with auto-refresh)
- List followed sites and search sites
- List libraries (drives) and navigate folders
- Download and upload files
- File search by keyword
- Status commands:
auth-check,whoami,recent
Pending (Phase 2 โ see Roadmap):
- Sharing links and version management
- SharePoint lists (read/write)
- Folder change monitoring + automations (cron jobs)
- Dashboard widget (recent files / site modifications)
- Document content extraction for analysis with Kimi
- Multi-account / multi-site support
- Large file upload sessions (> 250 MB)
Before installing you need:
- Kimi Desktop installed on your machine.
- A Microsoft 365 account with access to SharePoint/OneDrive.
- Graph permissions in the tenant app registration:
Files.ReadWrite.AllandSites.ReadWrite.All.
The plugin uses by default the CLIENT_ID / TENANT_ID defined at the beginning of
skills/sharepoint/scripts/sp_cli.py. If the tenant requires admin consent,
an admin must grant the above permissions in
Azure Portal โ Entra ID โ App registrations โ (the app) โ API permissions.
You can use your own app registration without touching the code, using environment variables:
SP_CLIENT_IDโ your Application (client) IDSP_TENANT_IDโ your Directory (tenant) IDSP_AUTH_DIRโ directory where to store tokens (default~/.kimi-sharepoint)
git clone https://github.com/FlacH7/kimi-sharepoint-plugin.git
In a Kimi conversation, ask:
"Register this local plugin in my personal marketplace:
<absolute path to repo>"
The agent validates and registers it. Then open Kimi's Plugins page โ ใไธชไบบใ (Personal) tab โ click ๏ผ on "SharePoint Manager". No restart needed.
Windows (PowerShell):
& "$env:APPDATA\kimi-desktop\daimon-bundle\bin\kimi-daimon.cmd" kimi-plugin register-personal "C:\full\path\to\kimi-sharepoint-plugin" --share-dir "$env:APPDATA\kimi-desktop\daimon-share"
macOS:
kimi-daimon kimi-plugin register-personal ~/path/to/kimi-sharepoint-plugin \
--share-dir ~/Library/Application\ Support/kimi-desktop/daimon-share
Linux:
kimi-daimon kimi-plugin register-personal ~/path/to/kimi-sharepoint-plugin \
--share-dir ~/.kimi/daimon-share
- Open Kimi Desktop
- Go to the Plugins panel (ๆไปถ)
- Switch to the ใไธชไบบใ (Personal) tab
- Search for "SharePoint Manager"
- Click ๏ผ or ใๅฎ่ฃ ใ (Install)
- Done! The plugin activates immediately โ no restart
The first time you use it, ask Kimi: "Connect to my SharePoint". The agent will run the device code flow:
- It shows you a URL (
https://login.microsoft.com/device) and a code. - You open the URL, enter the code and sign in with your Microsoft 365 account.
- You accept the permissions. The token is saved to
~/.kimi-sharepointand renews automatically.
Security: Never upload the contents of
~/.kimi-sharepoint(contains the token) to the repo. It lives outside the plugin directory, and.gitignorecovers it just in case.
Once installed and authenticated, ask Kimi in natural language:
| Request | Action |
|---|---|
| "List my SharePoint sites" | Show your followed sites |
| "What folders are in the team site?" | Explore libraries and folders |
| "Search OneDrive for report documents" | Search by keyword |
| "Download the presentation from the Shared folder" | Download to your workspace |
| "Upload this PDF to the Documents folder of site X" | Upload a local file |
| "What files have I used recently?" | Recent files list |
| "Which account am I connected to?" | Session status |
kimi-sharepoint-plugin/
โโโ kimi.plugin.json # Plugin manifest
โโโ README.md
โโโ LICENSE
โโโ .gitignore
โโโ skills/
โโโ sharepoint/
โโโ SKILL.md # Agent instructions + command reference
โโโ scripts/
โโโ sp_cli.py # CLI: auth + Graph API (browse / up / down / search)
Drive identifiers: me = user's OneDrive; <drive-id> = specific library;
site:<site-id> = default drive of a site.
# Authentication
python3 scripts/sp_cli.py auth-check # read-only preflight (is there a saved session?)
python3 scripts/sp_cli.py auth-start # start device flow (shows URL + code)
python3 scripts/sp_cli.py auth-complete # complete login and save token
python3 scripts/sp_cli.py whoami # authenticated account
# Navigation
python3 scripts/sp_cli.py sites [keyword] [--limit N] # followed sites / site search
python3 scripts/sp_cli.py drives [--site <id>] # libraries (drives)
python3 scripts/sp_cli.py ls <drive> [path] [--limit N] # list folder (root if no path)
# Files
python3 scripts/sp_cli.py download <drive> <remote-path> [local-destination]
python3 scripts/sp_cli.py upload <local> <drive> <remote-folder> [--name X] [--conflict rename|replace|fail]
# Search and recent
python3 scripts/sp_cli.py search <keyword> [--drive <drive>] [--limit N]
python3 scripts/sp_cli.py recent [--limit N]Typical exploration pattern: sites โ drives --site <id> โ ls <drive> <path> โ download / search.
Development continues in phases. The suggested order to complete 100% of the scope:
- Sharing links and versioning โ create links with expiration/permissions (
/createLink), list file versions and restore. - SharePoint lists โ read and write list items (
/sites/{id}/lists), useful for inventories, tasks and records. - Change monitoring โ folder polling with delta query (
/delta) to detect new/modified files and trigger automations (Kimi cron jobs). - Widget โ Dashboard/็ๆฟ panel with recent files and site modifications linked to an automation.
- Content extraction โ download and convert documents (Word/Excel/PDF) to analyze them with Kimi without manual steps.
- Multi-account / multi-site โ multiple Microsoft 365 accounts and favorite sites configurable.
- Large files โ upload sessions for files over 250 MB.
Each phase should end with: changes to
sp_cli.py+ updateSKILL.md+cachebuster.py(bump version) + test + commit.
The app registration has not been granted Graph permissions. A tenant admin
must add Files.ReadWrite.All and Sites.ReadWrite.All in Azure Portal โ App
registrations โ API permissions โ Grant admin consent.
Bug fixed in 0.1.0+local.20260907-150122. MSAL adds offline_access by
itself; it must not be declared in SCOPES. Update the plugin from the ใไธชไบบใ tab.
Locate the executable in your Kimi Desktop installation:
- Windows:
C:\Users\<USER>\AppData\Roaming\kimi-desktop\daimon-bundle\bin\kimi-daimon.cmd - macOS:
~/Library/Application Support/kimi-desktop/daimon-bundle/bin/kimi-daimon - Linux:
~/.kimi/daimon-bundle/bin/kimi-daimon
Check that:
- The
register-personalcommand finished without errors. - The repo folder contains
kimi.plugin.json. - Refresh the Plugins page (close and reopen).
Verify the drive id and remote path. Use sites and drives to get the
correct identifiers before navigating.
Run auth-start / auth-complete again. If it persists, delete
~/.kimi-sharepoint/msal_cache.json and repeat login.
- OAuth2 authentication with device flow (MSAL) and auto-refresh token
- List followed sites and site search
- List drives and navigate folders
- Download and upload files (with conflict handling)
- File search and recent files list
- Fix: removed
offline_accessfrom SCOPES (reserved by MSAL)
MIT โ see LICENSE.
Compatible with: Microsoft Graph API v1.0
Requires: Kimi Desktop, Python 3 with msal and requests