loading…
Search for a command to run...
loading…
Enables AI assistants to manage Microsoft Outlook emails, calendar events, contacts, and folders via COM automation.
Enables AI assistants to manage Microsoft Outlook emails, calendar events, contacts, and folders via COM automation.
Python Version License: MIT Platform MCP
A Model Context Protocol (MCP) server for Microsoft Outlook integration.
Version: 1.0.3 | Documentation: DOCUMENTATION.md | Contributing: CONTRIBUTING.md | Examples: EXAMPLES.md
This MCP server provides AI assistants with the ability to interact with Microsoft Outlook, including:
Detailed documentation for each feature: DOCUMENTATION.md
get_inbox_emails - Retrieve emails from inbox with filtering optionsget_sent_emails - Retrieve sent emailssearch_emails - Search emails across folders by subject, body, or sendersend_email - Send emails with CC/BCC support, HTML content, and auto-learned stylecreate_draft_email - Create draft emails without sending, with HTML and auto-learned styleAuto-Learning Style: When
OUTLOOK_AUTO_LEARN_STYLE=true, the server dynamically learns your email formatting style (font-family, font-size, color) from your most recent sent email each time you send or create a draft. This learned style is automatically applied to plain-text emails. No caching - learning happens live on every send/draft operation.
get_email_attachments - List all attachments from an email (with robust detection)download_email_attachment - Download a specific attachment to disksend_email_with_attachments - Send emails with file attachmentsRobust Detection: Attachment detection intelligently filters out inline images, email signatures, and embedded items to show only real file attachments. Uses ContentID detection, file size filtering, and type checking.
get_calendar_events - Get upcoming calendar eventscreate_calendar_event - Create new calendar events with attendeessearch_calendar_events - Search events by subject or locationget_contacts - Retrieve contacts with optional name filteringcreate_contact - Create new contactssearch_contacts - Search contacts by name, email, or companylist_outlook_folders - List all Outlook folders (ultra-fast, no item counts)search_emails_in_custom_folder - Search in specific custom folders with date filteringlist_outlook_rules - List all Outlook rules with conditions and actionsThis MCP has been heavily optimized for large mailboxes and to minimize Outlook freezing:
items.CountSee DOCUMENTATION.md - Performances for detailed performance information.
Quick Start Guide: QUICK_START.md | Full Installation Guide: DOCUMENTATION.md - Installation
Clone or download this repository
Install dependencies:
pip install -r requirements.txt
Or using the project file:
pip install -e .
Verify Outlook is running and configured with an account
Test the installation:
python tests/test_connection.py
Run the MCP server directly:
python src/outlook_mcp.py
Or using FastMCP's built-in CLI:
fastmcp run src/outlook_mcp.py
Add this configuration to your MCP settings file:
For Cursor (~/.cursor/mcp.json or workspace settings):
{
"mcpServers": {
"outlook": {
"command": "python",
"args": [
"C:/Users/YOUR_USERNAME/source/repos/MCP/src/outlook_mcp.py"
],
"env": {}
}
}
}
For Claude Desktop (%APPDATA%/Claude/claude_desktop_config.json on Windows):
{
"mcpServers": {
"outlook": {
"command": "python",
"args": [
"C:/Users/YOUR_USERNAME/source/repos/MCP/src/outlook_mcp.py"
]
}
}
}
Important: Replace YOUR_USERNAME with your actual Windows username.
You can test the server using FastMCP's interactive mode:
fastmcp dev src/outlook_mcp.py
This will open an interactive prompt where you can test the tools.
More Examples: EXAMPLES.md - Real-world use cases and workflows
# Get last 10 unread emails
get_inbox_emails(limit=10, unread_only=True)
# Search for emails about "meeting"
search_emails(query="meeting", folder="inbox", limit=20)
# Send a simple email
send_email(
to="[email protected]",
subject="Meeting Follow-up",
body="Hi, following up on our meeting...",
importance="high"
)
# Send email with HTML content and Outlook signature
send_email(
to="[email protected]",
subject="Project Update",
html_body="<h1>Update</h1><p>Here are the details...</p>",
signature_name="My Signature"
)
# Create a draft with multiple recipients and signature
create_draft_email(
to="[email protected]",
subject="Project Update",
body="Here's the latest update...",
cc="[email protected]",
signature_name="My Signature"
)
# Get next 7 days of events
get_calendar_events(days_ahead=7)
# Create a meeting
create_calendar_event(
subject="Team Standup",
start_time="2025-01-15 09:00",
end_time="2025-01-15 09:30",
location="Conference Room A",
required_attendees="[email protected]",
reminder_minutes=15
)
# Search for meetings
search_calendar_events(query="standup", days_range=30)
# Get all contacts
get_contacts(limit=50)
# Search for a contact
search_contacts(query="John Smith")
# Create a new contact
create_contact(
full_name="Jane Doe",
email="[email protected]",
company="Acme Corp",
job_title="Product Manager",
mobile_phone="+1-555-1234"
)
pip install pywin32python Scripts/pywin32_postinstall.py -install (if needed)2025-01-15 14:00mcp-outlook/
├── src/
│ ├── __init__.py
│ └── outlook_mcp.py # Main MCP server
├── pyproject.toml # Project configuration
├── requirements.txt # Dependencies
├── .gitignore
└── README.md
To add a new tool, use the @mcp.tool() decorator:
@mcp.tool()
def my_new_tool(param1: str, param2: int = 10) -> str:
"""
Tool description.
Args:
param1: Description of param1
param2: Description of param2 (default: 10)
Returns:
JSON string with results
"""
# Implementation
return json.dumps({"success": True, "data": "..."})
pytest
black src/
ruff check src/
MIT License - See LICENSE file for details.
Contributions are welcome! Please read our Contributing Guide for details on:
Quick Start for Contributors:
git checkout -b feature/amazing-feature)feat:, fix:, docs:, etc.)See CONTRIBUTING.md for detailed instructions.
For issues or questions:
Before creating an issue:
python tests/test_connection.py and include the outputNote: This tool accesses your local Outlook data. Ensure you follow your organization's security policies when handling email and calendar data.
Выполни в терминале:
claude mcp add mcp-outlook -- npx Безопасность
Низкий рискАвтоматическая эвристика по публичным данным — не гарантия безопасности.