@spteck/m365-hooks
v1.4.0
Published
A comprehensive collection of React hooks for Microsoft 365 development, including SharePoint, Microsoft Graph, and **Model Context Protocol (MCP)** client integration.
Downloads
985
Readme
M365 - React hooks use to create React Applications that need to access M365 Data
By João Mendes
A comprehensive collection of React hooks for Microsoft 365 development, including SharePoint, Microsoft Graph, and Model Context Protocol (MCP) client integration.
Features
- 🔌 MCP Client Hook - Connect to any Model Context Protocol server and use it as a data layer
- 📊 SharePoint data access hooks
- 📅 Calendar events management
- 👥 User and group management
- 🔍 Search and recommendations
- 📹 Video and media handling
- 💾 Advanced caching with IndexedDB
- 🎨 Theming utilities
- ⚡ Performance optimized
- 🔒 Type-safe with TypeScript
New: MCP Server Integration
The useMCPServer hook enables your application to connect to any Model Context Protocol server and use it as a universal data layer. Perfect for:
- AI agent integrations
- External API abstractions
- Tool orchestration
- Resource management
- Cross-platform data access
Quick Example:
import { useMCPServer } from '@spteck/m365-hooks';
const { tools, callTool } = useMCPServer({
url: 'https://mcp-server.example.com',
headers: { Authorization: 'Bearer token' }
});
// Call any tool from the server
const result = await callTool({
name: 'get_data',
arguments: { query: 'search term' }
});📖 Full MCP Documentation | Examples
Installation
npm install @spteck/m365-hooksAvailable Hooks
MCP Integration
useMCPServer- Model Context Protocol client for universal data layer access
SharePoint
usePnPjs- PnP JS integrationuseSharePointPermissions- Permission checkinguseSharePointCalendarEvents- Calendar eventsuseSharePointActivities- Activity trackinguseNewsPosts- News posts managementusePageLikes- Page likes functionalityuseMySavedPages- Saved pages management
Microsoft Graph
useGraphUserAPI- User API accessuseGroupCalendarEvents- Group calendar events
Utilities
useCache- In-memory cachinguseIndexedDBCache- Persistent cachinguseUtils- General utilitiesuseLogging- Logging utilitiesuseAppToast- Toast notifications
Media
useVideos- Video managementuseVideoThumbnail- Video thumbnails
Other
useAppCatalog- App catalog managementuseMicrosoftAppStore- App store integrationuseMicrosoftLicensing- License managementuseYammerMessages- Yammer integrationuseEventManagement- Event managementusePooling- Polling utilitiesuseRecomendedItems- RecommendationsuseMantineThemeFromFluentTheme- Theme conversion
Documentation
- MCP Server Hook Guide - Complete guide for MCP integration
- MCP Examples - 13+ usage examples
- IndexedDB Cache - Caching documentation
- Cache Management - Cache strategies
License
MIT
Author
João Mendes - @joaojmendes
