# How to integrate One drive MCP with Claude Agent SDK

```json
{
  "title": "How to integrate One drive MCP with Claude Agent SDK",
  "toolkit": "One drive",
  "toolkit_slug": "one_drive",
  "framework": "Claude Agent SDK",
  "framework_slug": "claude-agents-sdk",
  "url": "https://composio.dev/toolkits/one_drive/framework/claude-agents-sdk",
  "markdown_url": "https://composio.dev/toolkits/one_drive/framework/claude-agents-sdk.md",
  "updated_at": "2026-05-12T10:20:34.201Z"
}
```

## Introduction

This guide walks you through connecting One drive to the Claude Agent SDK using the Composio tool router. By the end, you'll have a working One drive agent that can share project folder with your team, download the latest version of report.docx, check who can access budget.xlsx through natural language commands.
This guide will help you understand how to give your Claude Agent SDK agent real control over a One drive account through Composio's One drive MCP server.
Before we dive in, let's take a quick look at the key ideas and tools involved.

## Also integrate One drive with

- [ChatGPT](https://composio.dev/toolkits/one_drive/framework/chatgpt)
- [OpenAI Agents SDK](https://composio.dev/toolkits/one_drive/framework/open-ai-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/one_drive/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/one_drive/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/one_drive/framework/codex)
- [Cursor](https://composio.dev/toolkits/one_drive/framework/cursor)
- [VS Code](https://composio.dev/toolkits/one_drive/framework/vscode)
- [OpenCode](https://composio.dev/toolkits/one_drive/framework/opencode)
- [OpenClaw](https://composio.dev/toolkits/one_drive/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/one_drive/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/one_drive/framework/cli)
- [Google ADK](https://composio.dev/toolkits/one_drive/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/one_drive/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/one_drive/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/one_drive/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/one_drive/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/one_drive/framework/crew-ai)

## TL;DR

Here's what you'll learn:
- Get and set up your Claude/Anthropic and Composio API keys
- Install the necessary dependencies
- Initialize Composio and create a Tool Router session for One drive
- Configure an AI agent that can use One drive as a tool
- Run a live chat session where you can ask the agent to perform One drive operations

## What is Claude Agent SDK?

The Claude Agent SDK is Anthropic's official framework for building AI agents powered by Claude. It provides a streamlined interface for creating agents with MCP tool support and conversation management.
Key features include:
- Native MCP Support: Built-in support for Model Context Protocol servers
- Permission Modes: Control tool execution permissions
- Streaming Responses: Real-time response streaming for interactive applications
- Context Manager: Clean async context management for sessions

## What is the One drive MCP server, and what's possible with it?

The One drive MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your OneDrive account. It provides structured and secure access to your cloud files and folders, so your agent can perform actions like uploading documents, sharing files, managing storage, and retrieving version histories on your behalf.
- File and folder management: Effortlessly copy, move, or delete files and folders, keeping your OneDrive organized with just a prompt.
- Easy sharing and collaboration: Instantly generate secure sharing links for documents or folders, making collaboration with others seamless.
- File download and preview: Have your agent fetch files or retrieve visual thumbnails for quick previews and streamlined access.
- Access control and permissions review: Check who can view or edit any file or folder, and manage sharing permissions without manual clicks.
- Version tracking and quota monitoring: Retrieve version histories for files and monitor your storage quota to stay on top of changes and space usage.

## Supported Tools

| Tool slug | Name | Description |
|---|---|---|
| `ONE_DRIVE_CHECKIN_ITEM` | Check In Drive Item | Tool to check in a checked out driveItem resource, making the version of the document available to others. Use when you need to check in a file that was previously checked out in OneDrive or SharePoint. |
| `ONE_DRIVE_CHECKOUT_ITEM` | Checkout Drive Item | Tool to check out a driveItem to prevent others from editing it and make your changes invisible until checked in. Use when you need to lock a file for exclusive editing in SharePoint or OneDrive. |
| `ONE_DRIVE_COPY_ITEM` | Copy Item | Tool to copy a DriveItem (file or folder) to a new location asynchronously. Use when you need to duplicate an item, optionally renaming it or specifying a different parent folder. The operation is asynchronous; the response provides a URL to monitor the copy progress. Do not assume the copy is complete immediately; verify via ONE_DRIVE_GET_ITEM or by listing the destination, especially for large folder trees. |
| `ONE_DRIVE_CREATE_ITEM_PERMISSION` | Create Drive Item Permission | Tool to create a new permission on a OneDrive drive item. Use when you need to grant application or SharePoint group permissions to a file or folder. This endpoint supports creating application permissions and SharePoint site group permissions only. |
| `ONE_DRIVE_CREATE_LINK` | Create Sharing Link | Tool to create a sharing link for a DriveItem (file or folder) by its unique ID. Use when you need to generate a shareable link for an item in OneDrive or SharePoint. |
| `ONE_DRIVE_DELETE_ITEM` | Delete Item | Tool to delete a DriveItem (file or folder) by its unique ID from the authenticated user's OneDrive. Use when you need to remove an item from OneDrive. This action moves the item to the recycle bin, not permanently deleting it; storage quota is not freed until the recycle bin is emptied. Bulk deletions can trigger 429 (rate limit) or 5xx responses — limit concurrency and use exponential backoff. |
| `ONE_DRIVE_DELETE_ITEM_PERMANENTLY` | Permanently Delete Drive Item | Tool to permanently delete a driveItem by its ID without moving it to the recycle bin. Use when you need to irreversibly remove a file or folder from OneDrive or SharePoint. This action cannot be undone. |
| `ONE_DRIVE_DELETE_ITEM_PERMISSION` | Delete Drive Item Permission | Tool to delete a permission from a drive item. Use when you need to revoke sharing access to a file or folder. Only non-inherited sharing permissions can be deleted. |
| `ONE_DRIVE_DELETE_SHARE_PERMISSION` | Delete Shares Permission | Tool to delete the permission navigation property for a shared drive item. Use when you need to remove a sharing link permission. This effectively revokes access via the specific share link. |
| `ONE_DRIVE_DISCARD_CHECKOUT` | Discard Checkout | Tool to discard the checkout of a driveItem, releasing it and discarding any changes made while checked out. Use when you need to cancel a checkout and revert changes on a file in SharePoint or OneDrive. |
| `ONE_DRIVE_DOWNLOAD_FILE` | Download a file | Downloads a file from a user's OneDrive using its item ID, which must refer to a file and not a folder. Response contains a content object with fields: s3url (URL to fetch raw file bytes), mimetype, and name; raw file data is not returned directly. Parsing content from Excel, Word, PDF, or other formats requires additional tooling. The response also includes attachment.s3key, required when passing this file to downstream tools such as OUTLOOK_SEND_EMAIL or OUTLOOK_CREATE_DRAFT. |
| `ONE_DRIVE_DOWNLOAD_FILE_BY_PATH` | Download file by path | Downloads the contents of a file from OneDrive by its path. The API returns a 302 redirect to a pre-authenticated download URL. Use when you know the file path but not the item ID. |
| `ONE_DRIVE_DOWNLOAD_ITEM_AS_FORMAT` | Download item as format | Tool to download the contents of a driveItem converted to a specific format (e.g., PDF or HTML). Use when you need to convert Office documents to PDF or Loop/Fluid files to HTML before downloading. Supports accessing items by item_id or by path, and can target specific drives via drive_id. |
| `ONE_DRIVE_DOWNLOAD_ITEM_VERSION` | Download Drive Item Version Content | Tool to download the contents of a specific previous version of a drive item (file). Returns the actual file content. Note: You cannot download the current version using this endpoint - it only works for previous versions. |
| `ONE_DRIVE_FOLLOW_ITEM` | Follow Drive Item | Tool to follow a driveItem (file or folder) in OneDrive or SharePoint. Use when you need to add an item to the user's followed items list for tracking updates. |
| `ONE_DRIVE_GET_DRIVE` | Get Drive | Retrieves the properties and relationships of a Drive resource by its unique ID. Use this action when you need to get details about a specific OneDrive, user's OneDrive, group's document library, or a site's document library. Only drives accessible to the authenticated user are returned; missing drives indicate insufficient OAuth scope or tenant permissions. |
| `ONE_DRIVE_GET_DRIVE_ITEM_BY_SHARING_URL` | Get DriveItem by Sharing URL | Tool to resolve a OneDrive/SharePoint sharing URL (or shareId) to a DriveItem with driveId and itemId. Use when you have a sharing link from Teams, chat, or 1drv.ms and need the item's metadata or IDs for downstream actions like permissions or download. |
| `ONE_DRIVE_GET_FOLLOWED_ITEM` | Get Drives Following | Tool to retrieve a specific followed driveItem from a drive. Use when you need to get details about a file or folder that the user has marked to follow. |
| `ONE_DRIVE_GET_GROUP_DRIVE` | Get Group Drive | Tool to retrieve the document library (drive) for a Microsoft 365 group. Use when you need to access the default document library associated with a specific group. |
| `ONE_DRIVE_GET_ITEM` | Get Item Metadata | Retrieves the metadata of a DriveItem by its unique ID. Use this tool to get information about a specific file or folder in OneDrive when you have its ID. If a `drive_id` is not provided, it defaults to the user's main drive. |
| `ONE_DRIVE_GET_ITEM_PERMISSIONS` | Get Item Permissions | Retrieves the permissions of a DriveItem by its unique ID within a specific Drive. Use when you need to check who has access to a file or folder and what level of access they have. Response nests permission entries under `data.value`; check top-level `success`/`error` flags before processing results. Results include inherited permissions, owner entries, and anonymous link entries — not just explicitly granted permissions. Sharing links may have differing scopes (org-only vs. anonymous); verify `link.scope` before treating a permission as externally accessible. |
| `ONE_DRIVE_GET_ITEM_THUMBNAILS` | Get Item Thumbnails | Tool to retrieve the thumbnails associated with a DriveItem. Use when you need to display visual previews of files. Response contains a `value` array with size keys (`small`, `medium`, `large`); thumbnails may not be generated for all file types or newly uploaded items, so handle an empty or missing `value` array. Returned thumbnail URLs are external HTTP endpoints with independent availability. |
| `ONE_DRIVE_GET_ITEM_VERSIONS` | Get Item Versions | Tool to retrieve the version history of a DriveItem by its unique ID. Use when you need to access or list previous versions of a file. Version history may be unavailable or empty for folders or items in drives without versioning enabled. |
| `ONE_DRIVE_GET_RECENT_ITEMS` | Get Recent Items | Get files and folders recently accessed by the user. Returns items based on activity history (opened, edited, viewed), sorted by most recent first — NOT by modification time; use ONE_DRIVE_ONEDRIVE_LIST_ITEMS or ONE_DRIVE_LIST_ROOT_DRIVE_CHANGES for strictly modification-based queries. Use when you need to see what the user worked on recently (e.g., 'Show me files I worked on today'). Different from search - this tracks activity, not content. Results may contain duplicate names; disambiguate using lastModifiedDateTime, parentReference.path, and the file/folder property before acting on a specific item. |
| `ONE_DRIVE_GET_ROOT` | Get Drive Root Folder | Tool to retrieve metadata for the root folder of the signed-in user's OneDrive. Use when you need information about the user's OneDrive root directory, such as size, child count, or web URL. |
| `ONE_DRIVE_GET_SHARE` | Get Shared Item by ShareId | Tool to access a shared DriveItem or collection of shared items using a shareId or encoded sharing URL. Returns the sharedDriveItem resource with metadata about the shared item and its owner. Use when you have a shareId or sharing token and need information about what was shared. |
| `ONE_DRIVE_GET_SHARED_ITEMS` | Get Shared Items | Tool to retrieve items shared with the authenticated user (not items the user has shared with others). Returns files and folders shared with the current user; response value array may be empty if no items exist. Use webUrl field from results for clickable links to items. |
| `ONE_DRIVE_GET_SHAREPOINT_LIST_ITEMS` | Get SharePoint List Items | Tool to get the items (list items) within a specific SharePoint list on a site. Use when you need to retrieve data from a SharePoint list. |
| `ONE_DRIVE_GET_SITE` | Get Site Details | Retrieves metadata for a specific SharePoint site by its ID. Use this action when you need to get details like display name, web URL, and creation/modification dates for a known SharePoint site. |
| `ONE_DRIVE_GET_SITE_PAGE_CONTENT` | Get SharePoint Site Page Content | Gets the content of a modern SharePoint site page. Use when you need to retrieve the details and content of a specific page within a SharePoint site. |
| `ONE_DRIVE_GET_SPECIAL_FOLDER` | Get Drive Special Folder | Tool to retrieve a special folder in OneDrive by name. Use when you need to access well-known folders (documents, photos, approot, etc.) without looking up by path or ID. |
| `ONE_DRIVE_GRANT_SHARE_PERMISSION` | Grant Shares Permission | Tool to grant users access to a link represented by a permission using an encoded sharing URL. Use when you need to give specific users access to a shared OneDrive or SharePoint resource. |
| `ONE_DRIVE_INVITE_USER_TO_ITEM` | Invite User to Drive Item | Tool to invite users or grant permissions to a specific item in a OneDrive drive. Use when you need to share a file or folder with other users and define their access level (e.g., read or write). |
| `ONE_DRIVE_LIST_ACTIVITIES` | List Drive Activities | Tool to retrieve recent activities on the authenticated user's OneDrive. Use when you need to track recent changes or actions performed across the drive. |
| `ONE_DRIVE_LIST_BUNDLES` | List Drive Bundles | Tool to retrieve a list of bundle resources from a specified drive. Bundles are collections of files (e.g., photo albums). Use when you need to list bundles in a drive. |
| `ONE_DRIVE_LIST_DRIVES` | List Drives | Tool to retrieve a list of Drive resources available to the authenticated user, or for a specific user, group, or site. Use when you need to find out what drives are accessible. Returns only drives within the signed-in account's permission scope; missing drives indicate insufficient permissions or different tenant scope. Results are paginated — follow skip_token across all pages to avoid missing drives. Returned drives represent document libraries and may not reflect full SharePoint site structure; use SHARE_POINT_GET_SITE_COLLECTION_INFO or SHARE_POINT_SEARCH_QUERY for broader coverage. Use driveType and webUrl to distinguish personal, system, and SharePoint-backed drives. |
| `ONE_DRIVE_LIST_FOLDER_CHILDREN` | List Folder Children | List the direct children (files/folders) of a OneDrive/SharePoint folder by DriveItem ID or path. Returns reliable pagination tokens/nextLink for large folders. Use when you need to enumerate folder contents deterministically, find companion artifacts (e.g., .vtt/.docx files), or browse within a known folder. |
| `ONE_DRIVE_LIST_ITEM_ACTIVITIES` | List Drive Item Activities | Tool to list recent activities for a specific item in a OneDrive drive. Use when you need to track changes or actions performed on a file or folder. |
| `ONE_DRIVE_LIST_ROOT_DRIVE_CHANGES` | List Root Drive Changes | Tool to list changes in the root of the user's primary drive using a delta token. Use when you need to track file and folder modifications, additions, or deletions in the main OneDrive directory. First call without `token` returns all current items plus an `@odata.deltaLink`; store that token and pass it on subsequent calls to retrieve only incremental changes. Losing the deltaLink token forces a full resync. Responses include deleted items (check `deleted` property) and the root item itself alongside files and folders. |
| `ONE_DRIVE_LIST_SHARE_PERMISSIONS` | List Shares Permission | Tool to retrieve permission details for a shared OneDrive or SharePoint item using a share ID. Use when you have an encoded sharing URL and need to check the permission level, password protection, and access details. |
| `ONE_DRIVE_LIST_SHAREPOINT_LIST_ITEMS_DELTA` | List SharePoint List Items Delta | Tool to track changes to items in a SharePoint list using a delta query. Use when you need to get newly created, updated, or deleted list items without performing a full read of the entire item collection. |
| `ONE_DRIVE_LIST_SITE_COLUMNS` | List Site Columns | Tool to list all column definitions for a SharePoint site. Use this when you need to retrieve the schema or structure of columns within a specific SharePoint site. |
| `ONE_DRIVE_LIST_SITE_ITEMS_DELTA` | List Site Drive Items Delta | Tool to track changes to DriveItems in the default document library of a SharePoint site. Use when you need to get a list of items that have been added, modified, or deleted since a previous state or to get an initial enumeration of all items. |
| `ONE_DRIVE_LIST_SITE_LISTS` | List Site Lists | Tool to list all lists under a specific SharePoint site. Use when you need to enumerate lists within a known site. Returns only Microsoft Graph-supported lists — internal/system lists are excluded, so results may be a strict subset of all site lists (e.g., 13 returned where 108 exist). Results are in the `data.value` array. IMPORTANT: Only works with organizational Microsoft 365 accounts (Azure AD/Entra ID). NOT supported for personal Microsoft accounts (MSA/Outlook.com/Hotmail). Personal OneDrive users cannot access SharePoint sites through this endpoint. |
| `ONE_DRIVE_LIST_SITE_SUBSITES` | List Site Subsites | Tool to list all subsites of a SharePoint site. Use when you need to retrieve a collection of subsites for a given parent site. IMPORTANT: This action only works with organizational Microsoft 365 accounts (Azure AD/Entra ID accounts). It is NOT supported for personal Microsoft accounts (MSA/Outlook.com/Hotmail accounts). Personal OneDrive users cannot access SharePoint sites through this endpoint. An empty `value` array in the response means the site has no subsites, not a failure. |
| `ONE_DRIVE_LIST_SUBSCRIPTIONS` | List Subscriptions | Tool to list the current subscriptions for the authenticated user or app. Use this to retrieve details of existing webhook subscriptions. Results may span multiple drives and resources; filter client-side by resource URL or type to narrow to a specific scope. An empty `value` array means no subscriptions exist, not a failed call. |
| `ONE_DRIVE_MOVE_ITEM` | Move Item | Tool to move a file or folder to a new parent folder in OneDrive. Use when you need to reorganize your files or folders by changing their location. You can optionally rename the item during the move. If a file with the same name exists at the destination, the API returns `nameAlreadyExists`; use the `name` parameter to provide a unique name or resolve the conflict beforehand. |
| `ONE_DRIVE_ONEDRIVE_CREATE_FOLDER` | Create folder | Creates a new folder in the user's OneDrive, automatically renaming on conflict, optionally within a specified parent_folder (by ID or full path from root) which, if not the root, must exist and be accessible. |
| `ONE_DRIVE_ONEDRIVE_CREATE_TEXT_FILE` | Create a new text file | Creates a new plain-text file with specified content in the authenticated user's personal OneDrive, using either the folder's unique ID or its absolute path relative to the user's OneDrive root (paths are automatically resolved to IDs); note that OneDrive may rename or create a new version if the filename already exists. All files are written as plain text regardless of extension — specifying .docx or .xlsx does not produce a true Office document. This action only works with the user's personal OneDrive (/me/drive) and does not support SharePoint document libraries or shared drives. |
| `ONE_DRIVE_ONEDRIVE_FIND_FILE` | Find Item | Non-recursively finds an item (file or folder) in a specified OneDrive folder; if `folder` is provided as a path, it must actually exist. Results in large folders may be paginated via `@odata.nextLink`; iterate all pages to avoid missing files. For searches where the subfolder is unknown, use ONE_DRIVE_SEARCH_ITEMS instead. |
| `ONE_DRIVE_ONEDRIVE_FIND_FOLDER` | Find Folder | Finds folders by name within an accessible parent folder in OneDrive, or lists all its direct child folders if no name is specified. Search is non-recursive: only immediate children of `folder` are checked, not deeper hierarchy levels. |
| `ONE_DRIVE_ONEDRIVE_LIST_ITEMS` | List OneDrive items | Retrieves all files and folders as `driveItem` resources from the root of a specified user's OneDrive, automatically handling pagination. Non-recursive: returns only root-level items; subfolder contents require separate calls. Results may include `remoteItem` pointers (shared items from other drives) — use `remoteItem.driveId` and `remoteItem.id` for those in downstream calls. Distinguish files from folders by presence of `file` or `folder` property. Always use `id` values returned by this tool directly; never construct item IDs manually. Items may be absent from results due to permission restrictions, not drive absence. |
| `ONE_DRIVE_ONEDRIVE_UPLOAD_FILE` | Upload file | Uploads a file to a specified OneDrive folder, automatically creating the destination folder if it doesn't exist, renaming on conflict, and supporting large files via chunking. |
| `ONE_DRIVE_PREVIEW_DRIVE_ITEM` | Preview Drive Item | Generates or retrieves a short-lived, permission-bound embeddable URL for a preview of a specific item. URLs expire and must be regenerated per session — do not cache. Use when you need to display a temporary preview of a file. |
| `ONE_DRIVE_RESTORE_DRIVE_ITEM` | Restore Deleted Item | Tool to restore a deleted OneDrive driveItem (file or folder) from the recycle bin. Use when you need to recover a deleted item to its original location or to a specified parent folder, optionally renaming it during restoration. IMPORTANT LIMITATION: This API is ONLY available for OneDrive Personal accounts. It does NOT work with OneDrive for Business or SharePoint. For Business/SharePoint accounts, use the SharePoint REST API endpoints (/_api/web/recyclebin) instead. |
| `ONE_DRIVE_SEARCH_ITEMS` | Search Items | Search OneDrive for files and folders by keyword. Searches filenames, metadata, and file content to find matching items. Use when you need to find specific files based on keywords, file types, or content. Supports filtering, sorting, and pagination. Results are mixed files and folders — filter client-side using file vs folder properties. Disambiguate similarly named items using parentReference.path, lastModifiedDateTime, and size before passing item IDs downstream. Newly created or recently moved files may not appear due to indexing delays; fall back to ONE_DRIVE_LIST_FOLDER_CHILDREN if expected items are missing. No server-side date filtering — apply lastModifiedDateTime/createdDateTime filtering in your own logic. HTTP 429 responses include a Retry-After header; use exponential backoff. |
| `ONE_DRIVE_UNFOLLOW_ITEM` | Delete Drive Following | Tool to unfollow a driveItem by removing it from the user's followed items collection. Use when you need to stop following a file or folder that was previously marked to follow. |
| `ONE_DRIVE_UPDATE_DRIVE_ITEM_METADATA` | Update Drive Item Metadata | Tool to update the metadata of a specific item (file or folder) in OneDrive. Use this to rename items, change descriptions, or move items to a new parent folder. |
| `ONE_DRIVE_UPDATE_DRIVE_ITEMS_PERMISSIONS` | Update Drive Item Permissions | Tool to update the roles of an existing permission on a OneDrive drive item. Use when you need to change the access level (read, write, owner) for a specific permission on a file or folder. |
| `ONE_DRIVE_UPDATE_FILE_CONTENT` | Update File Content | Tool to create an upload session for updating an existing file's content in OneDrive. Use when you need to overwrite/update an existing DriveItem's content while preserving its item ID, avoiding duplicate copies and maintaining existing share links. |

## Supported Triggers

| Trigger slug | Name | Description |
|---|---|---|
| `ONE_DRIVE_BASE_TRIGGER` | Onedrivebasetrigger | Base trigger for OneDrive changes using Gmail-style state management. Subclasses override `filter_changes(...)` to extract only the relevant items. |
| `ONE_DRIVE_FILE_CREATED_TRIGGER` | OneDrive File Created Trigger | Triggers when a new file is created in OneDrive. Uses Gmail-style state management for reliable duplicate prevention. |
| `ONE_DRIVE_FILE_UPDATED` | File Updated | Trigger that fires when a OneDrive file's content or metadata changes. Returns file ID, last modified time, and modifier info. |
| `ONE_DRIVE_FOLDER_CREATED_TRIGGER` | OneDrive Folder Created Trigger | Triggers when a new folder is created in OneDrive. Uses Gmail-style state management for reliable duplicate prevention. |
| `ONE_DRIVE_ITEM_DELETED_TRIGGER` | OneDrive Item Deleted Trigger | Triggers when a file or folder is deleted in OneDrive. Uses Gmail-style state management for reliable duplicate prevention. |
| `ONE_DRIVE_ITEM_MOVED_OR_RENAMED_TRIGGER` | Item Moved or Renamed | Triggers when a file or folder is moved to a different path or renamed in OneDrive. Includes both old and new path/name data in the payload. |
| `ONE_DRIVE_ITEM_UPDATED_TRIGGER` | OneDrive Item Updated Trigger | Triggers when an existing file or folder is modified in OneDrive. Uses Gmail-style state management and only detects actual modifications, not new creations. |
| `ONE_DRIVE_NEW_VERSION_CREATED_TRIGGER` | New Version Created | Trigger that fires when a new version of a specified OneDrive file is created. |
| `ONE_DRIVE_SHARING_PERMISSION_CHANGED_TRIGGER` | Sharing Permission Added or Removed | Sharing Permission Added or Removed |

## Creating MCP Server - Stand-alone vs Composio SDK

The One drive MCP server is an implementation of the Model Context Protocol that connects your AI agent to One drive. It provides structured and secure access so your agent can perform One drive operations on your behalf through a secure, permission-based interface.
With Composio's managed implementation, you don't have to create your own developer app. For production, if you're building an end product, we recommend using your own credentials. The managed server helps you prototype fast and go from 0-1 faster.

## Step-by-step Guide

### 1. Prerequisites

Before starting, make sure you have:
- Composio API Key and Claude/Anthropic API Key
- Primary know-how of Claude Agents SDK
- A One drive account
- Some knowledge of Python

### 1. Getting API Keys for Claude/Anthropic and Composio

Claude/Anthropic API Key
- Go to the [Anthropic Console](https://console.anthropic.com/settings/organization/api-keys) and create an API key. You'll need credits to use the models.
- Keep the API key safe.
Composio API Key
- Log in to the [Composio dashboard](https://dashboard.composio.dev?utm_source=toolkits&utm_medium=framework_docs).
- Navigate to your API settings and generate a new API key.
- Store this key securely as you'll need it for authentication.

### 2. Install dependencies

No description provided.
```python
pip install composio-anthropic claude-agent-sdk python-dotenv
```

```typescript
npm install @anthropic-ai/claude-agent-sdk @composio/core dotenv
```

### 3. Set up environment variables

Create a .env file in your project root.
What's happening:
- COMPOSIO_API_KEY authenticates with Composio
- USER_ID identifies the user for session management
- ANTHROPIC_API_KEY authenticates with Anthropic/Claude
```bash
COMPOSIO_API_KEY=your_composio_api_key_here
USER_ID=your_user_id_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here
```

### 4. Import dependencies

No description provided.
```python
import asyncio
from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions
import os
from composio import Composio
from dotenv import load_dotenv

load_dotenv()
```

```typescript
import 'dotenv/config';
import readline from 'node:readline';
import { Composio } from '@composio/core';
import { query, type Options } from "@anthropic-ai/claude-agent-sdk";

dotenv.config();
```

### 5. Create a Composio instance and Tool Router session

No description provided.
```python
async def chat_with_remote_mcp():
    api_key = os.getenv("COMPOSIO_API_KEY")
    if not api_key:
        raise RuntimeError("COMPOSIO_API_KEY is not set")

    composio = Composio(api_key=api_key)

    # Create Tool Router session for One drive
    mcp_server = composio.create(
        user_id=os.getenv("USER_ID"),
        toolkits=["one_drive"]
    )

    url = mcp_server.mcp.url

    if not url:
        raise ValueError("Session URL not found")
```

```typescript
async function chat() {
  const { COMPOSIO_API_KEY, USER_ID } = process.env;
  if (!COMPOSIO_API_KEY || !USER_ID) {
    throw new Error('COMPOSIO_API_KEY and USER_ID required in .env');
  }

  const composio = new Composio({ apiKey: COMPOSIO_API_KEY });

  // Create Tool Router session for One drive
  const session = await composio.create(USER_ID, {
    toolkits: ['one_drive'],
  });
  const mcpUrl = session?.mcp.url;
```

### 6. Configure Claude Agent with MCP

No description provided.
```python
# Configure remote MCP server for Claude
options = ClaudeAgentOptions(
    permission_mode="bypassPermissions",
    mcp_servers={
        "composio": {
            "type": "http",
            "url": url,
            "headers": {
                "x-api-key": os.getenv("COMPOSIO_API_KEY")
            }
        }
    },
    system_prompt="You are a helpful assistant with access to One drive tools via Composio.",
    max_turns=10
)
```

```typescript
const options: Options = {
  permissionMode: 'bypassPermissions',
  mcpServers: {
    composio: {
      type: 'http',
      url: mcpUrl,
      headers: { 'x-api-key': COMPOSIO_API_KEY }
    }
  },
  systemPrompt: 'You are a helpful assistant with access to One drive tools via Composio.',
  maxTurns: 10,
};
```

### 7. Create client and start chat loop

No description provided.
```python
# Create client with context manager
async with ClaudeSDKClient(options=options) as client:
    print("\nChat started. Type 'exit' or 'quit' to end.\n")

    # Main chat loop
    while True:
        user_input = input("You: ").strip()
        if user_input.lower() in {"exit", "quit"}:
            print("Goodbye!")
            break

        # Send query
        await client.query(user_input)

        # Receive and print response
        print("Claude: ", end="", flush=True)
        async for message in client.receive_response():
            if hasattr(message, "content"):
                for block in message.content:
                    if hasattr(block, "text"):
                        print(block.text, end="", flush=True)
        print()
```

```typescript
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    prompt: 'You: '
  });

  console.log('\nChat started. Type "exit" to quit.\n');

  let isProcessing = false;

  async function ask(prompt: string) {
    isProcessing = true;
    rl.pause();

    process.stdout.write('Claude is thinking...');
    const stream = query({ prompt, options });

    let firstChunk = true;
    for await (const msg of stream) {
      const content = (msg as any).message?.content || (msg as any).content;
      if (Array.isArray(content)) {
        for (const block of content) {
          if (block.type === 'text' && block.text) {
            if (firstChunk) {
              process.stdout.write('\r\x1b[K');
              process.stdout.write('Claude: ');
              firstChunk = false;
            }
            process.stdout.write(block.text);
          }
        }
      }
    }
    process.stdout.write('\n\n');

    isProcessing = false;
    rl.resume();
    rl.prompt();
  }

  rl.on('line', async (line) => {
    if (isProcessing) return;

    const input = line.trim();
    if (input === 'exit') {
      rl.close();
      process.exit(0);
    }
    if (input) await ask(input);
    else rl.prompt();
  });

  await ask('What can you help me with?');
}
```

### 8. Run the application

No description provided.
```python
if __name__ == "__main__":
    asyncio.run(chat_with_remote_mcp())
```

```typescript
try {
  await chat();
} catch (error) {
  console.error(error);
  process.exit(1);
}
```

## Complete Code

```python
import asyncio
from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions
import os
from composio import Composio
from dotenv import load_dotenv

load_dotenv()

async def chat_with_remote_mcp():
    api_key = os.getenv("COMPOSIO_API_KEY")
    if not api_key:
        raise RuntimeError("COMPOSIO_API_KEY is not set")

    composio = Composio(api_key=api_key)

    # Create Tool Router session for One drive
    mcp_server = composio.create(
        user_id=os.getenv("USER_ID"),
        toolkits=["one_drive"]
    )

    url = mcp_server.mcp.url

    if not url:
        raise ValueError("Session URL not found")

    # Configure remote MCP server for Claude
    options = ClaudeAgentOptions(
        permission_mode="bypassPermissions",
        mcp_servers={
            "composio": {
                "type": "http",
                "url": url,
                "headers": {
                    "x-api-key": os.getenv("COMPOSIO_API_KEY")
                }
            }
        },
        system_prompt="You are a helpful assistant with access to One drive tools via Composio.",
        max_turns=10
    )

    # Create client with context manager
    async with ClaudeSDKClient(options=options) as client:
        print("\nChat started. Type 'exit' or 'quit' to end.\n")

        # Main chat loop
        while True:
            user_input = input("You: ").strip()
            if user_input.lower() in {"exit", "quit"}:
                print("Goodbye!")
                break

            # Send query
            await client.query(user_input)

            # Receive and print response
            print("Claude: ", end="", flush=True)
            async for message in client.receive_response():
                if hasattr(message, "content"):
                    for block in message.content:
                        if hasattr(block, "text"):
                            print(block.text, end="", flush=True)
            print()

if __name__ == "__main__":
    asyncio.run(chat_with_remote_mcp())
```

```typescript
import 'dotenv/config';
import readline from 'node:readline';
import { Composio } from '@composio/core';
import { query, type Options } from "@anthropic-ai/claude-agent-sdk";

async function chat() {
  const { COMPOSIO_API_KEY, USER_ID } = process.env;
  if (!COMPOSIO_API_KEY || !USER_ID) {
    throw new Error('COMPOSIO_API_KEY and USER_ID required in .env');
  }

  const composio = new Composio({ apiKey: COMPOSIO_API_KEY });
  const session = await composio.create(USER_ID, {
    toolkits: ['one_drive']
  });
  const mcp_url = session?.mcp.url;

  const options: Options = {
    permissionMode: 'bypassPermissions',
    mcpServers: {
      composio: {
        type: 'http',
        url: mcp_url,
        headers: { 'x-api-key': COMPOSIO_API_KEY }
      }
    },
    systemPrompt: 'You are a helpful assistant with access to One drive tools via Composio.',
    maxTurns: 10,
  };

  const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    prompt: 'You: '
  });

  console.log('\nChat started. Type "exit" to quit.\n');

  let isProcessing = false;

  async function ask(prompt: string) {
    isProcessing = true;
    rl.pause();

    process.stdout.write('Claude is thinking...');
    const stream = query({ prompt, options });

    let firstChunk = true;
    for await (const msg of stream) {
      const content = (msg as any).message?.content || (msg as any).content;
      if (Array.isArray(content)) {
        for (const block of content) {
          if (block.type === 'text' && block.text) {
            if (firstChunk) {
              process.stdout.write('\r\x1b[K');
              process.stdout.write('Claude: ');
              firstChunk = false;
            }
            process.stdout.write(block.text);
          }
        }
      }
    }
    process.stdout.write('\n\n');

    isProcessing = false;
    rl.resume();
    rl.prompt();
  }

  rl.on('line', async (line) => {
    if (isProcessing) return;

    const input = line.trim();
    if (input === 'exit') {
      rl.close();
      process.exit(0);
    }
    if (input) await ask(input);
    else rl.prompt();
  });

  await ask('What can you help me with?');
}

try {
  await chat();
} catch (error) {
  console.error(error);
  process.exit(1);
}
```

## Conclusion

You've successfully built a Claude Agent SDK agent that can interact with One drive through Composio's Tool Router.
Key features:
- Native MCP support through Claude's agent framework
- Streaming responses for real-time interaction
- Permission bypass for smooth automated workflows
You can extend this by adding more toolkits, implementing custom business logic, or building a web interface around the agent.

## How to build One drive MCP Agent with another framework

- [ChatGPT](https://composio.dev/toolkits/one_drive/framework/chatgpt)
- [OpenAI Agents SDK](https://composio.dev/toolkits/one_drive/framework/open-ai-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/one_drive/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/one_drive/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/one_drive/framework/codex)
- [Cursor](https://composio.dev/toolkits/one_drive/framework/cursor)
- [VS Code](https://composio.dev/toolkits/one_drive/framework/vscode)
- [OpenCode](https://composio.dev/toolkits/one_drive/framework/opencode)
- [OpenClaw](https://composio.dev/toolkits/one_drive/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/one_drive/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/one_drive/framework/cli)
- [Google ADK](https://composio.dev/toolkits/one_drive/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/one_drive/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/one_drive/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/one_drive/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/one_drive/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/one_drive/framework/crew-ai)

## Related Toolkits

- [Google Drive](https://composio.dev/toolkits/googledrive) - Google Drive is a cloud storage platform for uploading, sharing, and collaborating on files. It's perfect for keeping your documents accessible and organized across devices.
- [Google Docs](https://composio.dev/toolkits/googledocs) - Google Docs is a cloud-based word processor that enables document creation and real-time collaboration. Its seamless sharing and version history make team editing and content management a breeze.
- [Google Super](https://composio.dev/toolkits/googlesuper) - Google Super is an all-in-one suite combining Gmail, Drive, Calendar, Sheets, Analytics, and more. It gives you a unified platform to manage your digital life, boosting productivity and organization.
- [Affinda](https://composio.dev/toolkits/affinda) - Affinda is an AI-powered document processing platform that automates data extraction from resumes, invoices, and more. It streamlines document-heavy workflows by turning files into structured, actionable data.
- [Agility cms](https://composio.dev/toolkits/agility_cms) - Agility CMS is a headless content management system for building and managing digital experiences across platforms. It lets teams update content quickly and deliver omnichannel experiences with ease.
- [Algodocs](https://composio.dev/toolkits/algodocs) - Algodocs is an AI-powered platform that automates data extraction from business documents. It delivers fast, secure, and accurate processing without templates or manual training.
- [Api2pdf](https://composio.dev/toolkits/api2pdf) - Api2Pdf is a REST API for generating PDFs from HTML, URLs, and documents using powerful engines like wkhtmltopdf and Headless Chrome. It streamlines document conversion and automation for developers and businesses.
- [Aryn](https://composio.dev/toolkits/aryn) - Aryn is an AI-powered platform for parsing, extracting, and analyzing data from unstructured documents. Use it to automate document processing and unlock actionable insights from your files.
- [Boldsign](https://composio.dev/toolkits/boldsign) - Boldsign is a digital eSignature platform for sending, signing, and tracking documents online. Organizations use it to automate agreements and manage legally binding workflows efficiently.
- [Boloforms](https://composio.dev/toolkits/boloforms) - BoloForms is an eSignature platform built for small businesses, offering unlimited signatures, templates, and forms. It simplifies digital document signing and team collaboration at a predictable, fixed price.
- [Box](https://composio.dev/toolkits/box) - Box is a cloud content management and file sharing platform for businesses. It helps teams securely store, organize, and collaborate on files from anywhere.
- [Carbone](https://composio.dev/toolkits/carbone) - Carbone is a blazing-fast report generator that turns JSON data into PDFs, Word docs, spreadsheets, and more using flexible templates. It lets you automate document creation at scale with minimal code.
- [Castingwords](https://composio.dev/toolkits/castingwords) - CastingWords is a transcription service specializing in human-powered, accurate transcripts via a simple API. Get seamless audio-to-text conversion for interviews, meetings, podcasts, and more.
- [Cloudconvert](https://composio.dev/toolkits/cloudconvert) - CloudConvert is a powerful file conversion service supporting over 200 file formats. It streamlines converting, compressing, and managing documents, media, and more, all in one place.
- [Cloudlayer](https://composio.dev/toolkits/cloudlayer) - Cloudlayer is a document and asset generation service for creating PDFs and images via API or SDKs. It lets you automate high-quality doc creation, saving dev time and reducing manual work.
- [Cloudpress](https://composio.dev/toolkits/cloudpress) - Cloudpress is a content export tool for Google Docs and Notion. It automates publishing to your favorite Content Management Systems.
- [Contentful graphql](https://composio.dev/toolkits/contentful_graphql) - Contentful graphql is a content delivery API that lets you access Contentful data using GraphQL queries. It gives you efficient, flexible ways to fetch and manage structured content for any digital project.
- [Conversion tools](https://composio.dev/toolkits/conversion_tools) - Conversion Tools is an online service for converting documents between formats such as PDF, Word, Excel, XML, and CSV. It lets you automate complex document workflows with just a few clicks.
- [Convertapi](https://composio.dev/toolkits/convertapi) - ConvertAPI is a robust file conversion service for documents, images, and spreadsheets. It streamlines programmatic format changes and lets developers automate complex workflows with a single API.
- [Craftmypdf](https://composio.dev/toolkits/craftmypdf) - CraftMyPDF is a web-based service for designing and generating PDFs with templates and live data. It streamlines document creation by automating personalized PDFs at scale.

## Frequently Asked Questions

### What are the differences in Tool Router MCP and One drive MCP?

With a standalone One drive MCP server, the agents and LLMs can only access a fixed set of One drive tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from One drive and many other apps based on the task at hand, all through a single MCP endpoint.

### Can I use Tool Router MCP with Claude Agent SDK?

Yes, you can. Claude Agent SDK fully supports MCP integration. You get structured tool calling, message history handling, and model orchestration while Tool Router takes care of discovering and serving the right One drive tools.

### Can I manage the permissions and scopes for One drive while using Tool Router?

Yes, absolutely. You can configure which One drive scopes and actions are allowed when connecting your account to Composio. You can also bring your own OAuth credentials or API configuration so you keep full control over what the agent can do.

### How safe is my data with Composio Tool Router?

All sensitive data such as tokens, keys, and configuration is fully encrypted at rest and in transit. Composio is SOC 2 Type 2 compliant and follows strict security practices so your One drive data and credentials are handled as safely as possible.

---
[See all toolkits](https://composio.dev/toolkits) · [Composio docs](https://docs.composio.dev/llms.txt)
