Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 38 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,25 @@ Copy the `.env.example` file to `.env` and update with your specific configurati

```env
LITELLM_CONFIG_PATH=model.config.toml
# Optional: Path to your MCP server configuration file
# MCP_CONFIG_PATH=mcp.toml

# Redis configuration
REDIS_HOST=localhost
REDIS_PORT=6379

# Optional for research functionality
JINA_API_KEY=your-jina-api-key
# JINA API Key
# JINA_API_KEY=your-jina-api-key # Uncomment and set if using deep research

# For image processing
AZURE_VISION_ENDPOINT=your-azure-vision-endpoint
AZURE_VISION_KEY=your-azure-vision-key
# AZURE_VISION_ENDPOINT=your-azure-vision-endpoint # Uncomment and set if using Azure vision
# AZURE_VISION_KEY=your-azure-vision-key # Uncomment and set if using Azure vision

# For web search functionality
SERPAPI_API_KEY=your-serpapi-api-key
# SERPAPI_API_KEY=your-serpapi-api-key # Uncomment and set for Google Search via SerpAPI
# SERPER_API_KEY=your-serper-api-key # Uncomment and set for Google Search via Serper

SENDER_EMAIL=ai-assistant@mxtoai.com
```

This project supports load balancing and routing across multiple models, so you can define as many models as you'd like. Copy `model.config.example.toml` to a toml file and update it with your preferred configuration. Update `.env` with the path your toml relative to root.
Expand Down Expand Up @@ -257,6 +262,34 @@ The system now supports:
- Fallback responses for partial failures
- Comprehensive error logging

### MCP Server Integration (Optional)

The system supports integration with Model Context Protocol (MCP) servers, allowing the EmailAgent to leverage additional tools and data sources.

**Configuration:**

1. Create or copy `mcp.toml.example` to `mcp.toml` in the project root.
2. Edit `mcp.toml` to define your MCP server configurations. Refer to the comments within `mcp.toml.example` for detailed instructions and examples for both Stdio and SSE based servers.
3. Ensure each server configuration you want to use has `enabled = true`.
4. You can specify a custom path for this configuration file by setting the `MCP_CONFIG_PATH` environment variable in your `.env` file.

**Example `mcp.toml` entry:**
```toml
[mcp_servers.my_filesystem_reader]
type = "stdio"
command = "npx"
args = [
"-y",
"@modelcontextprotocol/server-filesystem",
"/path/to/readable/directory"
]
env = { "SOME_VAR" = "some_value" }
enabled = true
```

**Security Note:**
Using MCP servers, especially Stdio-based ones, involves running external commands and code. The system uses `trust_remote_code=True` when loading these tools via `smolagents`, which is often necessary for their functionality but carries inherent security risks. **Only configure and enable MCP servers from sources you explicitly trust.**

## Load Testing

The project uses Locust for load testing various email processing scenarios.
Expand Down
111 changes: 111 additions & 0 deletions mcp.toml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# mcp.toml.example
# Configuration file for Model Context Protocol (MCP) servers.
#
# This file allows the EmailAgent to connect to various MCP servers
# and utilize the tools they provide.
#
# Security Warning:
# Enabling MCP servers, especially Stdio-based ones, involves running external commands
# and potentially arbitrary code. The `trust_remote_code=True` flag is used when loading
# these tools with smolagents, which is necessary for their operation but carries inherent risks.
# ALWAYS ENSURE YOU TRUST THE SOURCE AND IMPLEMENTATION OF ANY MCP SERVER YOU CONFIGURE.
# For Stdio-based servers, the commands are executed on the machine where the agent is running.
# For SSE-based servers, while the server itself runs remotely, ensure the endpoint is trusted.

# [[mcp_servers]] # Use a list of tables for multiple servers of the same type or for clarity
# name = "filesystem_example"
# type = "stdio" # "stdio" or "sse"
# command = "npx"
# args = [
# "-y",
# "@modelcontextprotocol/server-filesystem",
# "/path/to/your/Desktop", # Replace with actual accessible paths
# "/path/to/your/Downloads" # Replace with actual accessible paths
# ]
# # Optional environment variables for the command
# # env = { "SOME_VARIABLE" = "some_value" }

# [[mcp_servers]]
# name = "github_stdio_example"
# type = "stdio"
# command = "npx"
# args = [
# "-y",
# "@modelcontextprotocol/server-github"
# ]
# env = { GITHUB_PERSONAL_ACCESS_TOKEN = "<YOUR_GITHUB_PERSONAL_ACCESS_TOKEN>" } # Replace with your token

# [[mcp_servers]]
# name = "github_docker_example"
# type = "stdio"
# command = "docker"
# args = [
# "run",
# "-i", # For interactive processes
# "--rm", # Automatically remove the container when it exits
# "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", # Pass the environment variable to the container
# "mcp/github" # The Docker image for the GitHub MCP server
# ]
# env = { GITHUB_PERSONAL_ACCESS_TOKEN = "<YOUR_DOCKER_GITHUB_TOKEN>" } # Replace with your token

# [[mcp_servers]]
# name = "remote_sse_example"
# type = "sse"
# url = "http://127.0.0.1:8000/sse" # Replace with the actual URL of your SSE MCP server
# # Optional: any other parameters required by the mcp.client.sse.sse_client
# # extra_params = { "some_other_sse_param" = "value" }


# More structured way using TOML tables:
# Each key under [mcp_servers] will be treated as a server configuration.
# The name of the server will be the key itself (e.g., "filesystem", "github_service").

[mcp_servers.filesystem]
type = "stdio" # "stdio" or "sse"
command = "npx"
args = [
"-y",
"@modelcontextprotocol/server-filesystem",
"/path/to/your/Desktop", # IMPORTANT: Replace with actual, accessible paths
"/path/to/your/Downloads" # IMPORTANT: Replace with actual, accessible paths
]
# Optional environment variables for the command
# env = { "SOME_VARIABLE" = "some_value" }
# enabled = true # Optional: defaults to true if not specified. Set to false to disable.

[mcp_servers.github_stdio]
type = "stdio"
command = "npx"
args = [
"-y",
"@modelcontextprotocol/server-github"
]
env = { GITHUB_PERSONAL_ACCESS_TOKEN = "<YOUR_GITHUB_PERSONAL_ACCESS_TOKEN>" } # IMPORTANT: Replace with your token
# enabled = true

[mcp_servers.github_docker]
type = "stdio"
command = "docker"
args = [
"run",
"-i", # For interactive processes
"--rm", # Automatically remove the container when it exits
"-e", "GITHUB_PERSONAL_ACCESS_TOKEN", # Pass the environment variable to the container
"mcp/github" # The Docker image for the GitHub MCP server
]
env = { GITHUB_PERSONAL_ACCESS_TOKEN = "<YOUR_DOCKER_GITHUB_TOKEN>" } # IMPORTANT: Replace with your token
# enabled = true

[mcp_servers.pubmed_example]
type = "stdio"
command = "uvx" # Using uvx as per smolagents documentation example
args = ["--quiet", "pubmedmcp@0.1.3"]
env = {"UV_PYTHON" = "3.12"} # Ensure this matches your environment if needed, os.environ will be merged.
# enabled = true

[mcp_servers.remote_sse_service]
type = "sse"
url = "http://127.0.0.1:8000/sse" # IMPORTANT: Replace with the actual URL of your SSE MCP server
# Optional: any other parameters required by the mcp.client.sse.sse_client for SSE connections
# extra_params = { "some_other_sse_param" = "value" }
# enabled = true
Loading
Loading