Skip to main content
One OneDrive drive, or one SharePoint document library, becomes a folder tree of its real files, served as raw bytes.

Setup

The mount needs a Microsoft Graph access token. A delegated token reads the signed-in user’s own drive with no drive ID; an app-only token, or any other drive, needs one drive selector.
The fastest way to try it. The token lasts about an hour.
  1. Open Graph Explorer and sign in.
  2. Run a query such as GET /me/drive and consent when asked.
  3. Open the Access token tab and copy the token.
It is a delegated token, so it reaches /me/drive and needs no drive ID.
A delegated token from an app registration. The first sign-in is interactive, so this is a development bootstrap, not an unattended credential.
  1. In the Microsoft Entra admin center, go to Entra ID > App registrations > New registration. For a personal account, choose Any Entra ID Tenant + Personal Microsoft accounts.
  2. Under Authentication, set Allow public client flows to Yes.
  3. Under API permissions > Microsoft Graph > Delegated permissions, add Files.Read for the user’s own drive, or Files.ReadWrite for writes. Other drives or SharePoint may need Files.Read.All, Files.ReadWrite.All or a Sites.* permission.
  4. Request a device code with the Application (client) ID, open https://microsoft.com/devicelogin and enter the user_code it prints. For writes, ask for Files.ReadWrite:
  5. After signing in, exchange the device_code for tokens:
The reply holds an access token and a refresh token. Mirage does not refresh Microsoft tokens itself: a long-running program passes a callable as access_token that returns a fresh token.
App-only tokens cannot use /me/drive, so they set one of drive_id, site_id, group_id or user_id. With the token in TOKEN:
The first two give the user’s drive and every drive the user can see; the last two give a SharePoint site’s ID and its libraries. A drive ID looks like b!a1B2c3....

Connect

workspace.yaml

Layout

  • Set at most one of drive_id, site_id, group_id and user_id; with none the mount is the signed-in user’s drive. key_prefix mounts a folder.
  • Office files stay raw bytes, with no conversion.
  • Snapshots pin files through version history, which is on by default; old versions read only while the library keeps them (an admin can cap or turn off versioning).

Sample runs

On a write mount, tee, cp, mv, rm and mkdir change the drive; the token needs Files.ReadWrite or a wider write permission.

SDK guides

Python

Every config field, the VFS.md and write support.

TypeScript

Every config field, the VFS.md and write support.