
微软图形
STDIO微软Graph API助手工具包
微软Graph API助手工具包
Powerful MCP server for Microsoft Graph API - a complete AI assistant toolkit for Outlook, Calendar, OneDrive, and Contacts.
# Add Microsoft MCP server (replace with your Azure app ID) claude mcp add microsoft-mcp -e MICROSOFT_MCP_CLIENT_ID=your-app-id-here -- uvx --from git+https://github.com/elyxlz/microsoft-mcp.git microsoft-mcp # Start Claude Desktop claude
# Email examples > read my latest emails with full content > reply to the email from John saying "I'll review this today" > send an email with attachment to [email protected] # Calendar examples > show my calendar for next week > check if I'm free tomorrow at 2pm > create a meeting with Bob next Monday at 10am # File examples > list files in my OneDrive > upload this report to OneDrive > search for "project proposal" across all my files # Multi-account > list all my Microsoft accounts > send email from my work account
read_emails
- Read emails with full body contentget_email
- Get specific email with attachmentsreply_to_email
- Reply maintaining thread contextsend_email
- Send with CC/BCC and attachmentsmark_email_read
- Mark emails as read/unreadmove_email
- Move between foldersdownload_attachment
- Download email attachmentsget_calendar_events
- List events with full detailscheck_availability
- Check free/busy timescreate_event
- Create with location and attendeesupdate_event
- Reschedule or modify eventsdelete_event
- Cancel eventsrespond_to_event
- Accept/decline invitationsget_contacts
- Search or list contactslist_files
- Browse OneDrive with paginationupload_file
- Upload files to OneDrivedownload_file
- Download file contentdelete_file
- Delete files or folderssearch
- Universal search across all serviceslist_accounts
- Show authenticated accountsmicrosoft-mcp
git clone https://github.com/elyxlz/microsoft-mcp.git cd microsoft-mcp uv sync
# Set your Azure app ID export MICROSOFT_MCP_CLIENT_ID="your-app-id-here" # Run authentication script uv run authenticate.py # Follow the prompts to authenticate your Microsoft accounts
Add to your Claude Desktop configuration:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{ "mcpServers": { "microsoft": { "command": "uvx", "args": ["--from", "git+https://github.com/elyxlz/microsoft-mcp.git", "microsoft-mcp"], "env": { "MICROSOFT_MCP_CLIENT_ID": "your-app-id-here" } } } }
Or for local development:
{ "mcpServers": { "microsoft": { "command": "uv", "args": ["--directory", "/path/to/microsoft-mcp", "run", "microsoft-mcp"], "env": { "MICROSOFT_MCP_CLIENT_ID": "your-app-id-here" } } } }
All tools support an optional account_id
parameter:
# Use default account send_email("[email protected]", "Subject", "Body") # Use specific account send_email("[email protected]", "Subject", "Body", account_id="account-id-here") # List accounts to get IDs list_accounts()
# Run tests uv run pytest tests/ -v # Type checking uv run pyright # Format code uvx ruff format . # Lint uvx ruff check --fix --unsafe-fixes .
# Read latest emails with full content emails = read_emails(count=10, include_body=True) # Reply maintaining thread reply_to_email(email_id, "Thanks for your message. I'll review and get back to you.") # Forward with attachments email = get_email(email_id) attachments = [download_attachment(email_id, att["id"]) for att in email["attachments"]] send_email("[email protected]", f"FW: {email['subject']}", email["body"]["content"], attachments=attachments)
# Check availability before scheduling availability = check_availability("2024-01-15T10:00:00Z", "2024-01-15T18:00:00Z", ["[email protected]"]) # Create meeting with details create_event( "Project Review", "2024-01-15T14:00:00Z", "2024-01-15T15:00:00Z", location="Conference Room A", body="Quarterly review of project progress", attendees=["[email protected]", "[email protected]"] )
~/.microsoft_mcp_token_cache.json
MICROSOFT_MCP_TENANT_ID=consumers
for personal accounts~/.microsoft_mcp_token_cache.json
and re-authenticateMIT