AI & Agents

Gemini CLI Connect to OneDrive: CLI Workflows, Sync & Remote MCP

Connecting Gemini CLI to OneDrive bridges Google command-line AI workflows with Microsoft 365 enterprise storage. Instead of downloading whole folders or configuring complex Microsoft Graph API tokens, developers can sync OneDrive and SharePoint folders into an intelligent Fast.io workspace. Using the remote Model Context Protocol over Streamable HTTP, Gemini CLI queries indexed documents directly from the terminal with citation-backed hybrid search.

Tom Langridge 12 min read Updated
Connecting Gemini CLI to Microsoft OneDrive and SharePoint using remote MCP and intelligent workspaces.

Bridging Gemini CLI and Microsoft 365 Storage

Command-line developers running Google Gemini AI in their terminals frequently hit an ecosystem wall when corporate knowledge lives in Microsoft OneDrive or SharePoint. Gemini CLI natively lacks direct Microsoft Graph API authentication plugins, leaving engineers with brittle choices: manually downloading folders to local disk or managing ad-hoc sync daemons. Connecting Gemini CLI to OneDrive enables command-line developers using Google Gemini AI to reference, inspect, and query enterprise documents stored in Microsoft OneDrive and SharePoint without cluttering local filesystems or writing custom Graph API middleware.

In software organizations and technology teams, project context rarely stays within git repositories. Core business context is distributed across cloud drives. Engineering teams, product managers, and operations leads keep system specifications, compliance frameworks, architectural decision records, customer research, and sprint roadmaps across Google Drive, Dropbox, Box, OneDrive, and SharePoint. When engineers work in terminal environments using Google Gemini CLI, they need immediate access to this context. A developer investigating an outage needs to inspect the database failover policy stored in a corporate OneDrive document. An engineer implementing a third-party webhook needs to verify payload schemas documented in a partner specification file in SharePoint.

Developer tutorials often assume Gemini CLI operates only against local code directories or assets hosted in Google Cloud Storage buckets. This assumption completely misses cross-cloud Model Context Protocol (MCP) bridging patterns for Microsoft 365 environments. Because many developers assume cross-ecosystem access is unsupported, they rely on tedious workarounds. They switch between terminal windows and browser tabs, manually download Word documents and PDFs, or write throwaway shell scripts to extract text files.

Manual file downloads break the continuity of command-line workflows. Local copies quickly drift out of date as colleagues update specifications in OneDrive. Storing internal company documents on local laptops also expands the security surface area and consumes workstation disk space. Command-line developers need a direct, server-side retrieval pattern that lets Gemini CLI query live, indexed enterprise files where they already live, without pulling massive directories across the network.

Why Direct Microsoft Graph API Scripts Fail Terminal Agents

Attempting to wire Gemini CLI directly to Microsoft 365 storage through custom scripts exposes several architectural friction points. While the Microsoft Graph API provides comprehensive programmatic access to OneDrive personal drives and SharePoint document libraries, calling Graph API endpoints directly from a terminal agent introduces administrative complexity, bandwidth bottlenecks, and token waste.

The primary obstacle is Microsoft Entra ID authentication. To enable a local CLI tool to read Microsoft 365 files, an engineer must register an application in the Microsoft Entra ID portal. This registration requires configuring redirect URIs, generating client credentials, and assigning high-privilege permission scopes such as Files.Read.All or Sites.Read.All. In enterprise environments, corporate security policies require tenant administrator consent for these scopes. Securing tenant-wide admin approval for an individual developer command-line script is rarely approved by IT security teams. Even when approval is granted, managing OAuth token refreshes, local credential storage, and tenant isolation within terminal scripts requires substantial maintenance.

Direct terminal connections to Microsoft Graph API also encounter request volume thresholds. According to Microsoft Learn throttling guidance, Microsoft Graph detects high request volumes and throttles applications by returning an HTTP 429 status code with a Retry-After header. Similarly, in managed cloud environments such as Gemini Enterprise, Google Cloud documentation notes that the native Microsoft OneDrive connector restricts file uploads and downloads to a maximum of 50 MB, which prevents handling larger technical archives or media assets.

A third issue is the Files-On-Demand trap on local workstations. Developers who install the OneDrive desktop client on macOS or Windows often try to point Gemini CLI at local sync directories. Modern cloud sync tools use Files-On-Demand to preserve local storage, presenting files as virtual stubs until an application requests their contents. When a command-line tool, script, or local agent attempts to inspect or grep through these stub files, the operating system attempts to download the file contents on demand. A single broad search query executed by Gemini CLI can trigger recursive downloads of tens of gigabytes of archived documents, choking the workstation network connection and freezing terminal execution.

Even if files are downloaded locally, passing raw document formats into a command-line LLM creates severe token exhaustion. Corporate documents in OneDrive and SharePoint are typically formatted as Microsoft Word (.docx), PowerPoint (.pptx), Excel (.xlsx), or formatted PDF files. Passing unindexed full-length files into Gemini CLI prompt context consumes hundreds of thousands of tokens per query. This floods the model context window with irrelevant boilerplate, increases API latency, and dramatically raises inference costs. Terminal developers do not need raw document dumps. They require semantic search that retrieves only the exact passages relevant to their prompt, complete with verifiable source citations.

Finally, enterprise document organization in Microsoft 365 is structurally complex. Files rarely live in a single flat directory. Personal OneDrive folders exist alongside SharePoint team sites, communication sites, and shared document libraries. Traversing these nested hierarchies using direct Microsoft Graph API calls requires resolving site IDs, drive identifiers, and folder paths across multiple REST calls. When a developer moves a file or reorganizes a team folder, direct API scripts break.

How to Connect Gemini CLI to OneDrive via Fast.io Remote MCP

Instead of building custom Graph API middleware or downloading folders to local disks, developers can place an intelligent workspace between Microsoft 365 and Gemini CLI. Fast.io serves as this workspace layer, allowing you to keep your primary storage in Microsoft OneDrive and SharePoint while providing an indexed retrieval interface for AI agents.

The setup requires four concrete steps:

  1. Connect your OneDrive folder to a Fast.io workspace using Cloud Sync: In Fast.io, create a workspace dedicated to your project or engineering team. Cloud Sync connects Google Drive, Dropbox, Box and OneDrive folders to a workspace, one-way or two-way, on a schedule or on demand. SharePoint document libraries connect directly through the OneDrive connector. Configure Cloud Sync to connect the target OneDrive folder or SharePoint library to your workspace. Cloud Sync runs on a schedule or on demand rather than continuous or real-time sync, ensuring predictable updates. Once files sync into the workspace, Fast.io Intelligence Mode automatically indexes them for hybrid search, combining full-text keyword indexing, semantic vector search, and metadata filtering.

  2. Understand the remote MCP endpoint architecture: Fast.io hosts a remote Model Context Protocol server over Streamable HTTP. Unlike local MCP servers that run as local Node.js or Python subprocesses on your computer, the Fast.io server runs remotely at mcp.fast.io. For coding agents operating in IDEs and terminals, including Gemini CLI, Claude Code, Cursor, and Qwen Code, the dedicated endpoint is https://mcp.fast.io/mcp/code. Setup procedures are documented at https://mcp.fast.io/docs, and tool actions are detailed at https://mcp.fast.io/skill.md.

  3. Register Fast.io in Gemini CLI settings.json: Open your Gemini CLI configuration file. To configure the connection globally for your user account, edit ~/.gemini/settings.json on macOS and Linux, or %USERPROFILE%\.gemini\settings.json on Windows. To configure the connection only for a specific repository, edit .gemini/settings.json in the root of your project directory.

Add the fast-io server configuration under the mcpServers block. In Gemini CLI and its forks, you must specify the "httpUrl" property for Streamable HTTP servers. Do not use "url", because in Gemini CLI "url" selects the legacy Server-Sent Events (SSE) transport:

{
  "mcpServers": {
    "fast-io": {
      "httpUrl": "https://mcp.fast.io/mcp/code"
    }
  }
}

To complete authentication, launch Gemini CLI in your terminal and execute the MCP auth command:

/mcp auth fast-io

This command opens your default browser and displays Fast.io's Review Permissions screen. Choose Read Only or Read & Write access, and select the specific organization and workspace the connection can reach. If you run Gemini CLI in a headless terminal, remote SSH session, or CI/CD container where a browser cannot open, pass a scoped Bearer token in the headers block instead:

{
  "mcpServers": {
    "fast-io": {
      "httpUrl": "https://mcp.fast.io/mcp/code",
      "headers": {
        "Authorization": "Bearer <api key>"
      }
    }
  }
}
  1. Query OneDrive documents directly from the terminal: Start an interactive Gemini CLI session by running gemini in your terminal. Verify that the MCP server is connected by running /mcp. You can now prompt Gemini CLI to search and inspect documents residing in your synced OneDrive folders without downloading them locally:
> Search our synced OneDrive architecture specs for the caching strategy and summarize our Redis failover settings.

Gemini CLI invokes the search tool on https://mcp.fast.io/mcp/code. Fast.io performs hybrid search across the pre-indexed documents, extracts the relevant text passages, and returns them to Gemini CLI with exact document citations. Gemini CLI then synthesizes an accurate answer in your terminal output.

In connector evaluations published at fast.io/benchmarks, Fastio was measured the fastest and the lowest cost of the providers tested.

Monthly plans start with a 14-day free trial, which requires a credit card. Creating an account is free; doing real work requires an organization on a paid subscription. Tier options and capacities are detailed on Fast.io pricing.

Fast.io intelligent workspace indexing documents for hybrid semantic and full-text search
Fastio features

Query OneDrive Files Directly from Gemini CLI

Sync your Microsoft 365 folders into an intelligent workspace and search indexed enterprise documents from your terminal with remote MCP. Starts with a 14-day free trial.

How to Query OneDrive Documents and Extract Structured Metadata

Connecting Gemini CLI to OneDrive through Fast.io changes how developers interact with corporate knowledge. Instead of treating enterprise file storage as a static repository for human reading, the terminal becomes an interactive research and execution environment.

Engineers routinely need to verify technical constraints against internal specifications before writing code. When implementing a new microservice, a developer can ask Gemini CLI to cross-reference architectural decision records stored in SharePoint with current API route designs. Gemini CLI queries the Fast.io workspace, finds the relevant decisions, and highlights approved authentication schemes or database access rules directly in the shell.

Semantic search provides major operational advantages over standard keyword matching. In traditional file storage, searching for a phrase like "database connection pooling limits" only returns files containing those exact words. If the engineering document titles the section "Relational Datastore Concurrency Thresholds," keyword search fails. Fast.io Intelligence Mode indexes document meaning alongside full-text keywords. When Gemini CLI queries the workspace, the hybrid search engine matches conceptual intent, ensuring engineers find critical information even when terminology differs across teams.

When teams need structured data from unstructured corporate documents, Metadata Views turn files into a queryable database. Rather than relying on manual data entry or fragile regular expressions, users describe the fields they want extracted in natural language. Fast.io automatically designs a typed schema supporting Text, Integer, Decimal, Boolean, URL, JSON, and Date & Time formats. For example, an engineering operations team can extract software license expiration dates, vendor contract values, or infrastructure hardware requirements from hundreds of vendor agreements stored in OneDrive. Gemini CLI can then query these structured fields via MCP tools, filtering records by date, cost, or renewal status without reading each file from scratch.

Fast.io workspaces also provide a shared foundation for human-agent collaboration. Human team members can create, review, and organize documents using the Fast.io web interface, while autonomous agents such as Gemini CLI, Claude Code, and Cursor read and update files through remote MCP endpoints. Fast.io maintains full per-file version history, ensuring that every modification is preserved and earlier versions can be restored at any time. A detailed activity log records changes across the organization, tracking file uploads, edits, moves, and deletions made by team members and AI agents alike.

Security Architecture, Permission Scoping, and Configuration Troubleshooting

Connecting an AI command-line tool to corporate storage requires rigorous security boundaries. Direct OAuth connections to Microsoft 365 often create over-broad exposure. When a developer grants an application access to Microsoft Graph API, the integration typically inherits visibility across all personal OneDrive folders and accessible SharePoint sites. If an employee has access to sensitive financial projections, human resources reviews, or customer agreements, a directly connected AI tool could inadvertently retrieve and expose those records during an unrelated prompt.

Fast.io eliminates this broad blast radius through strict workspace boundaries. Fast.io manages access using role-based permissions set per organization, workspace, and share. Every workspace member accesses the workspace according to their assigned role. To isolate sensitive files from an AI agent, teams place those files in a separate workspace or share only the specific folder needed for the project. By creating a dedicated Fast.io workspace for a project and syncing only the designated OneDrive folder into it, the workspace boundary functions as an access perimeter. Gemini CLI can only search and reference documents contained within that specific workspace. Every other document in your Microsoft 365 tenant remains completely isolated and unreachable.

When configuring Gemini CLI with remote MCP servers, developers may encounter a few common setup issues:

  • Transport connection errors: If Gemini CLI fails to connect to Fast.io and outputs an error such as Connection failed, inspect settings.json. Verify that you used "httpUrl" instead of "url". In Gemini CLI, "url" defaults to Server-Sent Events (SSE), whereas Fast.io uses Streamable HTTP. Setting "httpUrl": "https://mcp.fast.io/mcp/code" resolves the transport mismatch.
  • Authentication expiration: If Gemini CLI returns authorization errors when invoking the search or execute tools, the OAuth session may have expired. Run /mcp auth fast-io to refresh the browser authentication flow. In automated environments using Bearer tokens, verify that the API key has not been revoked in Fast.io settings.
  • Missing recently added files: If a colleague recently uploaded a new document to OneDrive but Gemini CLI cannot locate it, check the Cloud Sync status in Fast.io. Cloud Sync operates on a schedule or on demand, not in continuous or real-time mode. Trigger an on-demand sync from the Fast.io workspace to pull the latest OneDrive changes immediately.
  • Context window management: While Gemini models feature large context windows, feeding unnecessary document pages into prompts degrades response quality. Because Fast.io indexes files server-side and performs hybrid retrieval, Gemini CLI receives only the relevant passages needed to answer the question. Keeping queries focused produces faster responses and preserves credit allowances.

Sources

References used to verify factual claims in this guide.

  1. Microsoft Graph detects high request volumes and throttles applications by returning an HTTP 429 status code with a Retry-After header.

  2. The native Microsoft OneDrive connector in Gemini Enterprise restricts file uploads and downloads to a maximum of 50 MB.

Frequently Asked Questions

Can Gemini CLI access Microsoft OneDrive files?

Gemini CLI does not natively include direct Microsoft Graph API authentication plugins. However, you can connect Gemini CLI to Microsoft OneDrive and SharePoint by syncing your OneDrive folders into a Fast.io workspace using Cloud Sync, and registering Fast.io as a remote MCP server in Gemini CLI using Streamable HTTP.

How do I configure MCP servers in Gemini CLI?

You configure MCP servers in Gemini CLI by editing `~/.gemini/settings.json` for user-wide settings or `.gemini/settings.json` for project-specific settings. Under the `mcpServers` block, define your server using `"httpUrl"` for Streamable HTTP endpoints, such as `"httpUrl": "https://mcp.fast.io/mcp/code"`. Save the file and run `/mcp auth <server-name>` in Gemini CLI to complete authentication.

How can I query SharePoint documents from the command line using Gemini?

SharePoint document libraries connect to Fast.io through the OneDrive connector in Cloud Sync. Once the SharePoint library is synced into a Fast.io workspace, Intelligence Mode indexes the documents. Gemini CLI can then query the indexed SharePoint content via the remote MCP server using natural language prompts.

Does Fast.io sync with Google Drive?

Yes. Fast.io Cloud Sync connects Google Drive, Dropbox, Box and OneDrive folders to a workspace, one-way or two-way, on a schedule or on demand. Teams can sync folders from any of these four providers into dedicated Fast.io workspaces for AI agent querying.

Why should I use httpUrl instead of url in Gemini CLI settings?

In Gemini CLI and its forks, the `"url"` configuration key selects the Server-Sent Events (SSE) transport by default, whereas `"httpUrl"` selects the Streamable HTTP transport. Because Fast.io hosts its remote MCP endpoints over Streamable HTTP, you must specify `"httpUrl": "https://mcp.fast.io/mcp/code"` to establish a valid connection.

How does Fast.io protect sensitive OneDrive documents from over-broad AI access?

Fast.io enforces role-based permissions set per organization, workspace, and share. Instead of granting an AI agent broad access to your entire Microsoft 365 tenant, you sync only the specific project folder into an isolated Fast.io workspace. The workspace acts as the security boundary, ensuring Gemini CLI can only search and reference documents in that designated workspace.

Related Resources

Fastio features

Query OneDrive Files Directly from Gemini CLI

Sync your Microsoft 365 folders into an intelligent workspace and search indexed enterprise documents from your terminal with remote MCP. Starts with a 14-day free trial.