GraphAccessGateway
A Micro-Control Plane (MCP) server providing programmatic connectivity to Microsoft 365 resources, specifically mail, calendar, and storage (OneDrive/SharePoint), leveraging the Microsoft Graph API suite. This integration empowers external AI agents, like Claude Desktop, to interact with user productivity data via advanced operational commands such as message composition, event scheduling, and data retrieval.
Author

Norcim133
Quick Info
Actions
Tags
GraphAccessGateway
This component functions as an MCP backend enabling secure, API-driven interaction with your Microsoft 365 tenant data (Exchange Online, Calendar, OneDrive, SharePoint) via the robust Microsoft Graph SDK.
🌟 Core Capabilities
- Electronic Correspondence Management: Full lifecycle handling for email, including drafting replies, sorting actions, sophisticated search queries, filtering, and analytical processing of the mailbox contents.
- Scheduling & Time Management: Comprehensive support for querying existing appointments, generating new meeting invites, modifying event details, and dispatching invitations.
- Cloud Storage Interfaces: Functionality to index, search, and retrieve metadata for files stored within the user's personal OneDrive account.
- Enterprise File Access: Capabilities to map user drives, execute searches across SharePoint sites, and fetch associated file metadata.
🛠️ Implementation Details
- API Client: Utilization of the official
msgraph-sdk-python. - Authentication Layer: Implements
azure.identityutilizingDeviceCodeCredentialpaired withTokenCachePersistenceOptionsfor secure, persistent session management. - Server Framework: Built atop
FastMCP, ensuring compliance with the required MCP interface specification. - Environment Management: Leverages
uvfor high-speed dependency resolution and virtual environment orchestration.
⚙️ Prerequisites & Deployment Environment
This server is currently optimized for:
- Operating System: Local deployment on macOS systems.
- Client Integration: Designed specifically for seamless operation with Claude Desktop.
- Authorization Model: Requires an Azure Active Directory (Azure AD) application registration.
❗ Crucial Note on Permissions: Setting this up mandates administrative privileges within your Azure tenancy. The Graph API scopes required (e.g.,
Mail.Read,Calendars.Read) often necessitate tenant-level administrative consent, which standard end-user delegation cannot grant.
▶️ Initiation Sequence
-
Source Acquisition: Clone the repository and navigate into the root directory: bash git clone https://github.com/Norcim133/OutlookMCPServer.git cd OutlookMCPServer
-
Dependency Installation: Establish the isolated environment: bash uv venv uv sync
-
Local Execution Test: Start the server using the MCP Inspector utility for initial validation: bash mcp dev main.py (expect errors)
Debugging connectivity within the Inspector environment is strongly recommended before attempting integration with the main Claude application.
🔒 Credential Configuration
Prior to application launch, configure the necessary secrets and cache structure:
-
Initialize the token storage directory in the project root: BASH mkdir -p auth_cache
-
Generate the runtime configuration file: bash touch .env
-
Populate the
.envfile with required identifiers: bash echo "AZURE_CLIENT_ID=" > .env echo "AZURE_TENANT_ID= " >> .env echo "AZURE_GRAPH_SCOPES=User.Read Mail.Read Mail.Send Mail.ReadWrite" >> .env
NOTE: File system permissions require additional entries in .env.
On the initial execution, the DeviceCodeCredential flow will initiate; successful completion results in an auth_record.json file being materialized within the auth_cache directory.
Administrative Prerequisite: Tenant-level consent is mandatory for the underlying application registration to grant the necessary Microsoft Graph API permissions.
🖥️ Claude Desktop Integration Manifest
To expose this gateway to Claude Desktop, modify your claude_desktop_config.json as follows:
{ "mcpServers": { "outlook": { "command": "uv", "args": [ "run", "--with", "azure-identity,mcp[cli],msgraph-core,msgraph-sdk", "mcp", "run", "/absolute/path/to/OutlookMCPServer" ] } } }
Locate this configuration file via Claude Desktop's Settings/Developer/Edit Config menu.
Recommendation: Consider substituting the relative uv call in "command" with its absolute path for enhanced reliability.
Important: Any modification to the configuration file or the underlying server code necessitates a complete restart of the Claude Desktop client to take effect.
🗂️ Project Layout
. ├── README.md ├── main.py ├── settings.py ├── auth_cache/ │ └── auth_record.json ├── mcpserver/ │ └── graph/ │ ├── init.py │ ├── calendar_service.py │ ├── controller.py │ ├── file_service.py │ ├── mail_service.py │ ├── init.py │ ├── auth_wrapper.py │ ├── context_manager.py │ ├── mail_query.py │ ├── message_info.py │ └── server.py ├── tests/ ├── .env ├── init.py ├── main.py
🎯 Development Milestones
- Mail Functionality: Complete
- Desktop Auth Linkage: Complete
- Calendar Orchestration: Complete
- OneDrive Access Layer: Complete
- SharePoint Connection: Complete
⚖️ Licensing
MIT License
Copyright (c) 2024 Enthoosa AI
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
BUSINESS MANAGEMENT CONTEXT: Enterprise administration solutions encompass the applications, procedural controls, computational frameworks, and strategic methods utilized by organizations to navigate market volatility, sustain competitive advantage, and enhance overall operational effectiveness. Tools are often department-specific, covering areas like fiscal control, process refinement, strategic planning, and workforce management. Modern systems have rapidly advanced, moving from legacy MIS to integrated Cloud ERP/CRM platforms. Successful implementation hinges critically upon judicious tool selection, tailored adaptation to unique organizational requirements, and effective deployment, rather than merely adopting the newest technology.
