MCP server for Microsoft Outlook integration to manage emails, calendar events, and contacts
Project description
Outlook MCP Server
Model Context Protocol (MCP) server for Microsoft Outlook integration that enables AI assistants to interact with emails, calendar events, and contacts through Microsoft Graph API.
Features
- Email Management: Read, send, and manage emails
- Calendar Operations: View and create calendar events
- Contact Management: Access and create contacts
- Real-time Integration: Direct connection to Microsoft Graph API
- Secure Authentication: Azure AD authentication support
Components
Resources
The server provides access to Outlook data through custom URI schemes:
- email://: Access email messages with metadata and content
- calendar://: Access calendar events with details and attendees
- contact://: Access contact information and details
Each resource provides structured data in JSON format with appropriate metadata.
Tools
The server implements six powerful tools for Outlook integration:
Email Tools
-
get-emails: Retrieve emails from specified folder (inbox, sent, drafts, etc.)
- Parameters:
folder(optional, defaults to "inbox"),limit(optional, defaults to 10) - Returns: List of emails with subject, sender, date, and preview
- Parameters:
-
send-email: Send a new email message
- Parameters:
to(required),subject(required),body(required),cc(optional),bcc(optional) - Returns: Confirmation with message ID
- Parameters:
Calendar Tools
-
get-calendar-events: Retrieve calendar events for a date range
- Parameters:
start_date(optional),end_date(optional),limit(optional, defaults to 20) - Returns: List of events with title, time, location, and attendees
- Parameters:
-
create-calendar-event: Create a new calendar event
- Parameters:
subject(required),start_time(required),end_time(required),location(optional),attendees(optional),body(optional) - Returns: Confirmation with event ID
- Parameters:
Contact Tools
-
get-contacts: Retrieve contacts from address book
- Parameters:
limit(optional, defaults to 50) - Returns: List of contacts with name, email, and phone information
- Parameters:
-
create-contact: Create a new contact
- Parameters:
display_name(required),email(optional),phone(optional),company(optional) - Returns: Confirmation with contact ID
- Parameters:
Prompts
The server provides three AI-powered prompts for enhanced productivity:
-
summarize-emails: Generate intelligent email summaries
- Analyzes recent emails and creates structured summaries
- Identifies action items, important information, and priorities
-
schedule-summary: Create calendar overviews
- Summarizes upcoming meetings and events
- Provides scheduling insights and conflict detection
-
compose-email: AI-assisted email composition
- Helps draft professional emails with proper tone
- Suggests improvements and formatting
Configuration
The server requires Azure AD app registration and configuration through environment variables:
Required Environment Variables
# Azure AD Configuration
OUTLOOK_TENANT_ID=your-tenant-id
OUTLOOK_CLIENT_ID=your-client-id
# Choose one authentication method:
# Option 1: Client Secret (App-only authentication)
OUTLOOK_CLIENT_SECRET=your-client-secret
# Option 2: Username/Password (Delegated authentication)
OUTLOOK_USERNAME=your-username
OUTLOOK_PASSWORD=your-password
Azure AD App Registration
-
Go to Azure Portal → Azure Active Directory → App registrations
-
Create a new registration with these settings:
- Name: Outlook MCP Server
- Supported account types: Accounts in this organizational directory only
- Redirect URI: Not required for this server type
-
Configure API permissions:
- Microsoft Graph → Application permissions (for client secret auth):
Mail.Read,Mail.Send,Calendars.Read,Calendars.ReadWrite,Contacts.Read,Contacts.ReadWrite
- Microsoft Graph → Delegated permissions (for username/password auth):
Mail.Read,Mail.Send,Calendars.Read,Calendars.ReadWrite,Contacts.Read,Contacts.ReadWrite
- Microsoft Graph → Application permissions (for client secret auth):
-
Grant admin consent for the permissions
-
Create a client secret (if using client secret authentication)
Configuration File
Create a .env file in the project root:
cp .env.example .env
# Edit .env with your Azure AD credentials
Installation & Setup
Prerequisites
- Python 3.8 or higher
- Microsoft 365 or Outlook.com account
- Azure AD app registration (see Configuration section)
Install from PyPI (when published)
pip install outlook-mcp
Install from Source
git clone <repository-url>
cd outlook-mcp
uv sync
Quickstart
1. Configure Environment
Set up your environment variables in .env:
OUTLOOK_TENANT_ID=your-tenant-id
OUTLOOK_CLIENT_ID=your-client-id
OUTLOOK_CLIENT_SECRET=your-client-secret
2. Test the Server
# Run the server directly for testing
uv run outlook-mcp
# Or test with MCP Inspector
npm install -g @modelcontextprotocol/inspector
mcp-inspector uv run outlook-mcp
3. Configure with Claude Desktop
Development Configuration
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"outlook-mcp": {
"command": "uv",
"args": [
"--directory",
"/Users/annmariyajoshy/vibecoding/outlook-mcp",
"run",
"outlook-mcp"
],
"env": {
"OUTLOOK_TENANT_ID": "your-tenant-id",
"OUTLOOK_CLIENT_ID": "your-client-id",
"OUTLOOK_CLIENT_SECRET": "your-client-secret"
}
}
}
}
Production Configuration (when published)
{
"mcpServers": {
"outlook-mcp": {
"command": "uvx",
"args": ["outlook-mcp"],
"env": {
"OUTLOOK_TENANT_ID": "your-tenant-id",
"OUTLOOK_CLIENT_ID": "your-client-id",
"OUTLOOK_CLIENT_SECRET": "your-client-secret"
}
}
}
}
Usage Examples
Email Operations
# Get recent emails
emails = await get_emails(folder="inbox", limit=5)
# Send an email
await send_email(
to="recipient@example.com",
subject="Hello from MCP",
body="This email was sent through the MCP server!"
)
Calendar Operations
# Get upcoming events
events = await get_calendar_events(
start_date="2024-01-01",
end_date="2024-01-31"
)
# Create a meeting
await create_calendar_event(
subject="Team Standup",
start_time="2024-01-15T09:00:00",
end_time="2024-01-15T09:30:00",
attendees=["team@example.com"]
)
Contact Operations
# Get contacts
contacts = await get_contacts(limit=10)
# Create a contact
await create_contact(
display_name="John Doe",
email="john.doe@example.com",
phone="+1-555-123-4567"
)
Error Handling
The server includes comprehensive error handling for common scenarios:
- Authentication failures: Clear error messages for expired tokens or invalid credentials
- Permission errors: Helpful guidance when API permissions are insufficient
- Rate limiting: Automatic retry logic with exponential backoff
- Network issues: Graceful degradation and error reporting
Security Considerations
- Credential Storage: Never commit credentials to version control
- Token Management: Tokens are handled securely by Azure Identity library
- Scope Limitation: Request only necessary permissions for your use case
- Network Security: All communication uses HTTPS with Microsoft Graph API
Troubleshooting
Common Issues
- Authentication Error: Verify your tenant ID, client ID, and credentials
- Permission Denied: Check that required permissions are granted and admin consented
- Module Not Found: Ensure all dependencies are installed with
uv sync - Rate Limiting: Implement delays between requests if hitting API limits
Debug Mode
Enable detailed logging:
export PYTHONPATH=/path/to/outlook-mcp/src
export MCP_LOG_LEVEL=DEBUG
uv run outlook-mcp
MCP Inspector
For advanced debugging, use the MCP Inspector:
npm install -g @modelcontextprotocol/inspector
mcp-inspector uv run outlook-mcp
Development
Building and Publishing
To prepare the package for distribution:
- Sync dependencies and update lockfile:
uv sync
- Build package distributions:
uv build
This will create source and wheel distributions in the dist/ directory.
- Publish to PyPI:
uv publish
Note: You'll need to set PyPI credentials via environment variables or command flags:
- Token:
--tokenorUV_PUBLISH_TOKEN - Or username/password:
--username/UV_PUBLISH_USERNAMEand--password/UV_PUBLISH_PASSWORD
Debugging
Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector.
You can launch the MCP Inspector via npm with this command:
npx @modelcontextprotocol/inspector uv --directory /Users/annmariyajoshy/vibecoding/outlook-mcp run outlook-mcp
Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file outlook_mcp-0.1.0.tar.gz.
File metadata
- Download URL: outlook_mcp-0.1.0.tar.gz
- Upload date:
- Size: 80.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e15c19c0f2d72b210ce3c92f290f72cf7283d690f0e9cc7a97c5a8086f278816
|
|
| MD5 |
4483f6e13ff523d19169b1e270b603e5
|
|
| BLAKE2b-256 |
59583ee36ebd16a786e456068868e4c358f91b2be8fbb9da56899db65a0eadd3
|
File details
Details for the file outlook_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: outlook_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0965efcc5f3052fc93646dcbc5d40e5b6a21947f718294fc2894aa9f4f5fdba5
|
|
| MD5 |
8514996f9423a10c2d169ffe4622bfa8
|
|
| BLAKE2b-256 |
5fac8ff387e79ce9d629ea4c34f2392905288d2267b41cf3765e859ac53791f2
|