Agent 365 Email Draft Proxy

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.

Category
Visit Server

README

Agent 365 Email Draft Plugin for Claude Code

Generate executive-style email drafts using real email context from your Microsoft 365 inbox.

License: MIT

✨ 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!)

  1. 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
    
  2. 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

  1. Search for an email:

    /email-draft --search "latest from charles lamanna"
    
  2. Claude searches and displays results

  3. Select an email from the results

  4. Review the generated draft

  5. 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

🔒 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:

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. 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)

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured