Integrations
OneDrive
Manage files, folders, and Office documents
The OneDrive integration provides access to Microsoft OneDrive and Office files through the Integrate MCP server.
Installation
The OneDrive integration is included with the SDK:
import { onedriveIntegration } from "integrate-sdk/server";Setup
1. Create a Microsoft App Registration
- Go to Azure Portal - App Registrations
- Create a new registration
- Configure redirect URIs
- Create a client secret
- Note your Application (client) ID and Client Secret
2. Configure the Integration on Your Server
Add the OneDrive integration to your server configuration. The integration automatically reads ONEDRIVE_CLIENT_ID and ONEDRIVE_CLIENT_SECRET from your environment variables:
import { createMCPServer, onedriveIntegration } from "integrate-sdk/server";
export const { client: serverClient } = createMCPServer({
apiKey: process.env.INTEGRATE_API_KEY,
integrations: [
onedriveIntegration({
scopes: ["Files.Read", "Files.ReadWrite", "offline_access"], // Optional
}),
],
});You can override the environment variables by passing explicit values:
onedriveIntegration({
clientId: process.env.CUSTOM_ONEDRIVE_ID,
clientSecret: process.env.CUSTOM_ONEDRIVE_SECRET,
scopes: ["Files.Read", "Files.ReadWrite"],
});3. Client-Side Usage
The default client automatically includes all integrations. You can use it directly:
import { client } from "integrate-sdk";
await client.authorize("onedrive");
const files = await client.onedrive.listFiles({});If you're using a custom client, add the integration to the integrations array:
import { createMCPClient, onedriveIntegration } from "integrate-sdk";
const customClient = createMCPClient({
integrations: [onedriveIntegration()],
});Configuration Options
Prop
Type
Available Tools
Files
onedrive_list_files- List files and foldersonedrive_get_file- Get file metadataonedrive_download_file- Download file contentonedrive_upload_file- Upload a fileonedrive_delete_file- Delete a fileonedrive_search_files- Search for filesonedrive_share_file- Create sharing link
Word Documents
onedrive_word_get_content- Get Word document content
Excel Spreadsheets
onedrive_excel_get_worksheets- List worksheets in an Excel fileonedrive_excel_get_range- Get cell range valuesonedrive_excel_update_range- Update cell range values
PowerPoint Presentations
onedrive_powerpoint_get_slides- List slides in a presentation
Examples
List Files
const result = await client.onedrive.listFiles({
path: "/Documents",
});
console.log("Files:", result);Upload a File
const result = await client.onedrive.uploadFile({
path: "/Documents/report.pdf",
content: fileBuffer,
});
console.log("File uploaded:", result);Update Excel Range
const result = await client.onedrive.excelUpdateRange({
fileId: "01ABCDEF123456789",
worksheetId: "Sheet1",
range: "A1:B2",
values: [
["Name", "Value"],
["Item 1", "100"],
],
});
console.log("Range updated:", result);OAuth Scopes
The default scopes are ['Files.Read', 'Files.ReadWrite', 'offline_access']. You may need different scopes:
Files.Read- Read user filesFiles.Read.All- Read all files user can accessFiles.ReadWrite- Read and write user filesFiles.ReadWrite.All- Read and write all files user can accessoffline_access- Maintain access without user presence
Error Handling
try {
const result = await client.onedrive.getFile({
fileId: "01ABCDEF123456789",
});
} catch (error) {
if (error.message.includes("not found")) {
console.error("File not found");
} else if (error.message.includes("authentication")) {
console.error("Authentication failed");
} else {
console.error("Unexpected error:", error);
}
}Next Steps
- Explore the Google Workspace Integration
- Explore the Outlook Integration
- See Advanced Usage for more examples