Skip to content

Latest commit

 

History

History
219 lines (143 loc) · 4.98 KB

File metadata and controls

219 lines (143 loc) · 4.98 KB

🔌 InboxAI MCP Server

The Model Context Protocol (MCP) server provides AI assistants with access to InboxAI's email management capabilities.

🚀 Quick Start

Start the MCP Server

# From the InboxAI project root
uv run python src/mcp_server.py

The server will start and be available for MCP client connections.

Use with Claude Desktop

Add this to your Claude Desktop MCP configuration:

{
  "mcpServers": {
    "inboxai": {
      "command": "uv",
      "args": ["run", "python", "/path/to/InboxAI/src/mcp_server.py"],
      "cwd": "/path/to/InboxAI"
    }
  }
}

🛠️ Available Tools

1. summarise_emails_mcp

Purpose: Fetch and categorize emails with AI-powered summaries

Parameters:

  • time_window (string, default: "24h"): Time window to fetch emails from
    • Examples: "24h", "7d", "12h", "3d"

Returns: Formatted markdown string with email summaries by category

Example:

result = summarise_emails_mcp("24h")
# Returns categorized email summaries

2. reply_to_email_mcp

Purpose: Send intelligent replies to emails

Parameters:

  • email_id (string): ID of the email to reply to
  • reply_text (string, optional): Custom reply text
  • auto_generate (boolean, default: False): Auto-generate reply using AI
  • tone (string, default: "professional"): Tone for auto-generated replies
    • Options: "professional", "casual", "friendly", "formal"

Returns: Success message or error description

Examples:

# Send custom reply
reply_to_email_mcp("email_123", "Thank you for your message!")

# Auto-generate professional reply
reply_to_email_mcp("email_123", auto_generate=True, tone="professional")

# Auto-generate casual reply
reply_to_email_mcp("email_123", auto_generate=True, tone="casual")

3. get_email_suggestions

Purpose: Generate multiple reply suggestions for an email

Parameters:

  • email_id (string): ID of the email to generate suggestions for
  • num_suggestions (integer, default: 3): Number of reply options to generate

Returns: Formatted string with multiple reply suggestions

Example:

suggestions = get_email_suggestions("email_123", 3)
# Returns 3 different reply options with different tones

4. process_inbox_full

Purpose: Run the complete InboxAI workflow using LangGraph

Parameters:

  • time_window (string, default: "24h"): Time window to process emails from

Returns: Complete formatted email processing results

Example:

result = process_inbox_full("7d")
# Returns full inbox analysis with categories and summaries

🔧 Integration Examples

Claude Desktop Usage

Once configured, you can use these commands in Claude Desktop:

Please summarize my emails from the last 24 hours using InboxAI.
Reply to email ID email_123 with a professional tone saying I'll review the proposal.
Generate 3 different reply suggestions for email email_456.

Custom AI Assistant Integration

from mcp_server import mcp

# Your AI assistant can call these tools directly
async def handle_email_request(time_window="24h"):
    # Get email summaries
    summaries = await mcp.call_tool("summarise_emails_mcp", {"time_window": time_window})

    # Process the results
    return summaries

📋 Requirements

Environment Setup

Ensure you have these configured:

  1. Gmail API Credentials: credentials.json in project root
  2. Google AI API Key: Set in .env file as GOOGLE_API_KEY
  3. Dependencies: Install with uv add mcp

Dependencies

The MCP server requires:

  • mcp>=1.10.0 - Model Context Protocol
  • langchain[google-genai]>=0.3.26 - AI integration
  • langgraph>=0.4.10 - Workflow orchestration
  • google-api-python-client>=2.161.0 - Gmail API

🔒 Security

  • All email processing happens locally
  • Only classification/summarization uses external AI API (Google Gemini)
  • OAuth credentials are stored securely
  • No email content is stored permanently

🐛 Troubleshooting

Common Issues

"Import mcp.server.fastmcp could not be resolved"

uv add mcp

"API key not valid"

  • Check your GOOGLE_API_KEY in .env
  • Ensure you're using a Google AI Studio API key

"Credentials file not found"

  • Place credentials.json in the project root
  • Ensure Gmail API is enabled in Google Cloud Console

MCP Server Not Starting

# Check if the server script runs
uv run python src/mcp_server.py

# Check dependencies
uv sync

Debug Mode

Enable verbose logging:

export LOG_LEVEL=DEBUG
uv run python src/mcp_server.py

🔗 Related Documentation


Note: The MCP server provides a bridge between AI assistants and InboxAI's email management capabilities, enabling intelligent email processing through natural language commands.