Skip to main content

Python MCP server for IMAP/SMTP email, WebDAV, and CalDAV

Project description

mcp-email-webdav-caldav

Python MCP server for IMAP/SMTP email, WebDAV, and CalDAV for mail.ru services

Package Run

Publish the package to PyPI as mcp-email-webdav-caldav, then run it without cloning this repository:

Get external app password here (choose all protocols) https://account.mail.ru/user/2-step-auth/passwords

Update package

uv tool upgrade mcp-email-webdav-caldav

For Claude:

claude-glm-5 mcp add --scope user mail-webdav-caldav \
--env 'MCP_SERVER_FULL_NAME=Иван Иванов' \
--env MCP_SERVER_EMAIL_ADDRESS=ivan@inbox.ru \
--env MCP_SERVER_PASSWORD=token \
-- uvx mcp-email-webdav-caldav

For Codex:

[mcp_servers.mail-webdav-python]
command = "uvx"
args = ["mcp-email-webdav-caldav"]
enabled = true

[mcp_servers.mail-webdav-python.env]
MCP_SERVER_FULL_NAME = "Jane Doe"
MCP_SERVER_EMAIL_ADDRESS = "jane@example.com"
MCP_SERVER_PASSWORD = "app_password_here"

Equivalent one-off run:

uvx mcp-email-webdav-caldav

Or install the package once and run the console script:

pipx install mcp-email-webdav-caldav

Then Codex can use:

command = "mcp-email-webdav-caldav"
args = []

Ready-made examples:

Build And Publish

Build source and wheel distributions:

uv build

Publish to PyPI:

uv publish

Runtime Environment Variables

Required:

  • MCP_SERVER_FULL_NAME
  • MCP_SERVER_EMAIL_ADDRESS
  • MCP_SERVER_PASSWORD

MCP_SERVER_EMAIL_ADDRESS and MCP_SERVER_PASSWORD are reused as credentials for Email, WebDAV, and CalDAV.

Service Constants

Provider-specific settings live in src/mcp_email_webdav_caldav/constants.py:

  • Email IMAP/SMTP host, port, SSL, sent-folder, and attachment-download settings.
  • WebDAV account name, base URL, description, SSL verification, download, and upload settings.
  • CalDAV account name, base URL, well-known discovery, SSL verification, and write settings.

CalDAV uses /.well-known/caldav discovery by default. The client follows redirects, reads current-user-principal, then reads calendar-home-set and performs calendar/event operations relative to that discovered calendar-home URL.

Email, WebDAV, and CalDAV accounts can also be saved to ~/.config/zerolib/mcp_email_webdav_caldav/config.json via the add_email_account, add_webdav_account, and add_caldav_account tools. Override the file location with MCP_EMAIL_WEBDAV_CALDAV_CONFIG_PATH.

Tools

Email:

  • add_email_account
  • list_available_accounts
  • list_mailboxes
  • list_emails_metadata
  • get_emails_content
  • send_email
  • delete_emails
  • download_attachment

WebDAV:

  • add_webdav_account
  • list_webdav_accounts
  • webdav_list
  • webdav_get_text
  • webdav_download_file
  • webdav_put_text
  • webdav_upload_file
  • webdav_mkdir
  • webdav_delete
  • webdav_move
  • webdav_copy

CalDAV:

  • add_caldav_account
  • list_caldav_accounts
  • caldav_list_calendars
  • caldav_list_events
  • caldav_check_availability
  • caldav_get_event
  • caldav_put_event
  • caldav_create_event
  • caldav_delete_event

list_emails_metadata returns mailbox together with each email_id; pass the same mailbox to get_emails_content, delete_emails, and download_attachment. Set all_mailboxes=true to search every selectable IMAP folder.

webdav_download_file and webdav_upload_file are disabled by default because they read/write local files. Enable them explicitly in constants.py.

Sent email is uploaded to IMAP after SMTP send when EMAIL_SAVE_TO_SENT is enabled. Leave EMAIL_SENT_FOLDER_NAME empty to auto-detect the IMAP mailbox with the \Sent flag, which is the right mode for localized folders such as Mail.ru Отправленные. The send_email response includes sent_copy with the mailbox used for the saved copy.

caldav_put_event, caldav_create_event, and caldav_delete_event are disabled by default because they modify remote calendars. Enable them explicitly in constants.py.

caldav_create_event accepts attendees as attendees = ["Name <user@example.com>", "other@example.com"]. The participants field is accepted as an alias. The server writes standard ORGANIZER / ATTENDEE iCalendar fields. Use caldav_check_availability before creating a meeting to check whether the selected calendar has busy items in the requested time range.

Test

PYTHONPATH=src python3 -m unittest discover -s tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_email_webdav_caldav-0.2.9.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_email_webdav_caldav-0.2.9-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file mcp_email_webdav_caldav-0.2.9.tar.gz.

File metadata

  • Download URL: mcp_email_webdav_caldav-0.2.9.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mcp_email_webdav_caldav-0.2.9.tar.gz
Algorithm Hash digest
SHA256 53f372366e1905e6bf2eef560296d7082f571dc1bd2ab38b17a7173639cbda93
MD5 70763a8027fef04583aadc58a8e56cd9
BLAKE2b-256 423f225405c41fc38769d230cc82310aead56b1b578acddad76937a5db7817c8

See more details on using hashes here.

File details

Details for the file mcp_email_webdav_caldav-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: mcp_email_webdav_caldav-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mcp_email_webdav_caldav-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 300fade04629c798699c531d08ba7ae5e1820bddabdc84ce1a650af6b0251828
MD5 f7afb6e67554d8e82eef40be8161709e
BLAKE2b-256 c01397c6b977e550f101eee7d0e846ea488546fa9d7d7bda6d3c4b5d97b6a6c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page