Agent 365 Email Draft Proxy
Enables Claude Code to search, retrieve, and draft email replies using real Microsoft 365 inbox context, with executive-style profiles and one-click publishing.
README
Agent 365 Email Draft Plugin for Claude Code
Generate executive-style email drafts using real email context from your Microsoft 365 inbox.
✨ Features
- 🔍 Natural Language Email Search - Search your inbox using plain English
- 📧 Executive Style Profiles - Drafts match recipient's communication style
- 🎯 Context-Aware Responses - Uses full email threads for context
- 📤 One-Click Publishing - Create drafts directly in Outlook
- 🚀 One-Time Setup - Configure once, use in any Claude Code conversation
🎭 Executive Profiles
The plugin automatically matches recipients to communication styles:
- Charles Lamanna - Conversational-professional, strategic, engaging
- Nirav Shah - Action-oriented, decisive, technical, timeline-focused
- Robert Bruckner - Direct, data-driven, strategic, analytical
- James Oleinik - Collaborative, balanced, team-focused, thoughtful
Unknown recipients use a professional default style.
🚀 Quick Start
Prerequisites
- Python 3.8+
- Claude Code CLI installed
- Agent 365 account with email access
- Microsoft 365 mailbox
Installation (2 commands!)
-
Clone and install
git clone https://github.com/jamesol-msft/claude-email-draft-plugin.git cd claude-email-draft-plugin pip install -r requirements.txt python setup.py -
Restart Claude Desktop/CLI
That's it! The setup script automatically:
- ✅ Installs MCP proxy to your home directory
- ✅ Installs skill to
~/.claude/skills/email-draft/ - ✅ Configures Claude Desktop MCP server
- ✅ Provides token setup instructions
Token Setup (Optional - for real email access)
For testing without a real token, the plugin works in mock mode by default. For real email access:
# If you have get_agent365_token.py
python get_agent365_token.py
# Or create a mock token for testing
mkdir -p ~/.agent365
cat > ~/.agent365/auth-token.json << 'EOF'
{
"access_token": "mock_token_for_testing",
"token_type": "Bearer",
"expires_in": 3600,
"expires_at": 9999999999
}
EOF
Verify Setup
python verify_setup.py
This checks that everything is configured correctly.
📖 Usage
Interactive Mode
/email-draft
Prompts you for email context.
Search First
/email-draft --search "recent unread from john"
Searches emails, lets you pick one, generates draft.
Reply to Specific Email
/email-draft --reply-to AAMkAGI2TGAA=
Generates reply to email with specific ID.
Example Workflow
-
Search for an email:
/email-draft --search "latest from charles lamanna" -
Claude searches and displays results
-
Select an email from the results
-
Review the generated draft
-
Optionally publish to Outlook drafts folder
🏗️ Architecture
Claude Code
↓ (MCP protocol - JSON-RPC 2.0 over stdio)
agent365_mcp_proxy.py
↓ (HTTPS)
Agent 365 Mail Server
↓ (Microsoft Graph API)
Microsoft 365 (Outlook)
Key Components:
- MCP Proxy (~550 lines Python) - Lightweight bridge between Claude Code and Agent 365
- Skill File (~830 lines Markdown) - Executive profiles and workflow logic
- Configuration - Simple JSON config for Claude Desktop
🔧 MCP Tools
The proxy exposes 3 tools to Claude Code:
| Tool | Purpose | Typical Latency |
|---|---|---|
search_messages |
Search emails with natural language | 30-90s |
get_message |
Retrieve full email details by ID | 1-3s |
create_draft |
Create draft in Outlook | 1-3s |
📚 Documentation
- SETUP.md - Detailed installation guide
- TROUBLESHOOTING.md - Common issues and solutions
- TOKEN_CONFIGURATION.md - Token management and security
- IMPLEMENTATION_COMPLETE.md - Technical implementation details
🔒 Security
- Tokens stored locally (
~/.agent365/auth-token.json) - Tokens expire after 1 hour (manual refresh required)
- No credentials in config files
- All communication over HTTPS
- MCP proxy runs locally (no external services)
🐛 Troubleshooting
Token expired (401 error)
# Refresh your Agent 365 token
python get_agent365_token.py
Proxy not starting
- Check Python version:
python --version(need 3.8+) - Check file path in
claude_desktop_config.json - Check Claude Code logs: View → Developer → Toggle Developer Tools
Skill not appearing
- Verify file location:
~/.claude/skills/email-draft/SKILL.md - Restart Claude Code
- Check for syntax errors in SKILL.md
See TROUBLESHOOTING.md for more solutions.
🎯 Performance
Tested with:
- 15 test cases, 100% pass rate
- 35 total scenarios validated
- Production-ready status: ✅
Benchmarks:
- Proxy startup: <2s
- Email search: 30-90s (natural language processing)
- Get message: 1-3s
- Create draft: 1-3s
🛣️ Roadmap
- [ ] Automatic token refresh
- [ ] Additional executive profiles
- [ ] Calendar integration (meeting prep)
- [ ] Teams integration (chat context)
- [ ] Profile customization UI
🤝 Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Commit your changes
- Open a pull request
📄 License
MIT License - see LICENSE file for details
🙏 Acknowledgments
Built with:
Wave 5 of the skillsIQ project Status: ✅ Production Ready Test Pass Rate: 100% (35/35 scenarios)
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。