Skip to main content

Emancipation MCP Server

emancipation is a MCP server that lets AI agents read IMAP mailboxes and send plain-text emails over SMTP.

Features

  • No external dependencies besides the MCP SDK
  • MCP server over stdio
  • IMAP mailbox listing, search, message listing, and message retrieval
  • SMTP plain-text email sending with optional cc, bcc, and reply_to
  • TLS/SSL options for both IMAP and SMTP transports
  • Environment-variable configuration for runtime credentials and behavior

Requirements

  • Python 3.11+
  • IMAP server credentials
  • SMTP server credentials

Installation

pip install emancipation

Running the server

Transport is a positional argument and defaults to stdio.

emancipation

This starts the MCP server over stdio (same as emancipation stdio).

For SSE transport:

emancipation sse --host 127.0.0.1 --port 8143

For streamable HTTP transport:

emancipation streamable-http --host 127.0.0.1 --port 8143

Network transports (sse, streamable-http) support:

  • --host (optional, default: 127.0.0.1)
  • --port (optional, default: 8143)

Equivalent invocation patterns:

emancipation [stdio]
emancipation sse [--host HOST] [--port PORT]
emancipation streamable-http [--host HOST] [--port PORT]

You can register multiple entries with different credentials and SERVER_NAME values.


Agent Configuration

Example

Register the server in your MCP client configuration:

{
  "mcpServers": {
    "emancipation": {
      "command": "emancipation",
      "env": {
        "SERVER_NAME": "mail-primary",
        "IMAP_HOST": "imap.example.com",
        "IMAP_PORT": "993",
        "IMAP_TIMEOUT": "15",
        "IMAP_USERNAME": "agent@example.com",
        "IMAP_PASSWORD": "your-imap-password",
        "IMAP_MAILBOX": "INBOX",
        "IMAP_ENABLED": "true",
        "SMTP_HOST": "smtp.example.com",
        "SMTP_PORT": "587",
        "SMTP_USERNAME": "agent@example.com",
        "SMTP_PASSWORD": "your-smtp-password",
        "SMTP_FROM": "agent@example.com",
        "SMTP_ENABLED": "true",
        "SMTP_TIMEOUT": "15",
        "SMTP_USE_TLS": "true",
        "SMTP_USE_SSL": "false"
      }
    }
  }
}

Environment Variables

Set these environment variables to configure the server:

Global configuration:

  • SERVER_NAME (optional, default: emancipation)
  • SERVER_LOG_FILE (optional; when set, log output is written to this file in addition to stdout; logs are appended to the file)
  • SERVER_LOG_LEVEL (optional, default: info; accepted values: debug, info, warning, error, critical)

For IMAP email access:

  • IMAP_ENABLED (optional, default: true; set to false, no, or 0 to disable IMAP tool export)
  • IMAP_HOST (required)
  • IMAP_PORT (optional, default: 993)
  • IMAP_TIMEOUT (optional, default: 15; timeout in seconds; must be greater than 0)
  • IMAP_SESSION_TTL (optional, default: 120; reuse IMAP connections for this many seconds; set to 0 to disable reuse and reconnect per call)
  • IMAP_USERNAME (required)
  • IMAP_PASSWORD (required)
  • IMAP_MAILBOX (optional, default: INBOX)

For sending emails:

  • SMTP_ENABLED (optional, default: true; set to false, no, or 0 to disable SMTP tool export)
  • SMTP_HOST (required)
  • SMTP_PORT (optional, default: 587; 465 when SSL is enabled)
  • SMTP_TIMEOUT (optional, timeout in seconds; must be greater than 0)
  • SMTP_USERNAME (required)
  • SMTP_PASSWORD (required)
  • SMTP_FROM (required)
  • SMTP_USE_TLS (optional, default: true)
  • SMTP_USE_SSL (optional, default: false)

SMTP_USE_TLS and SMTP_USE_SSL cannot both be true. IMAP_ENABLED and SMTP_ENABLED accept only true, yes, 1, false, no, and 0; any other value raises a startup error.

About SERVER_NAME

SERVER_NAME sets the MCP server identity exposed to the client/LLM.

Common use cases:

  • Run multiple emancipation instances at once, each with a different IMAP/SMTP account (for example: mail-primary, mail-finance, mail-support).
  • Make tool provenance clearer in multi-server setups, so logs and MCP UIs show which server handled each tool call.
  • Separate environments (for example: mail-staging vs mail-production) while reusing the same binary and tool set.

If omitted, the server name defaults to emancipation.


Available MCP tools

  • emcp_list_mailboxes: list available mailboxes
  • emcp_search_messages: search message IDs (mailbox, query, limit, offset)
  • emcp_list_messages: list message metadata (id, subject, sender, date) using query and paging
  • emcp_get_message: fetch one message by ID, with optional plain-text body and a trust assessment (trusted, confidence, reason, auth checks)
  • emcp_send_email: send a plain-text email (to, subject, text_body) with optional cc, bcc, and reply_to
  • emcp_delete_message: mark one message as deleted (message_id, optional mailbox, optional expunge)
  • emcp_move_message: move one message to another mailbox (message_id, destination_mailbox, optional source_mailbox, optional expunge)

Message IDs returned by search/list are mailbox-scoped. Use the same mailbox when calling emcp_get_message, emcp_delete_message, or emcp_move_message.

Metadata

Release files for emancipation 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for emancipation 0.2.0
File Size Uploaded Provenance Actions
emancipation-0.2.0.tar.gz 21.6 kB Without provenance Details for emancipation-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for emancipation 0.2.0
File Interpreter ABI Platform Actions
emancipation-0.2.0-py3-none-any.whl Python 3 none any Details for emancipation-0.2.0-py3-none-any.whl

Total release size: 35.5 kB

Release files / emancipation-0.2.0.tar.gz

Download URL emancipation-0.2.0.tar.gz
Size 21.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4c0e5de2c154ee5ef6cad1e1d8d008e723d2d1e1a63334aac1e91675f67f50e9
BLAKE2b-256 checksum
How to use checksums
67659ec3ce91b16b50ef386e7f8d6bb08685904d14d386f258b7094e9bcbd787
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Release files / emancipation-0.2.0-py3-none-any.whl

Download URL emancipation-0.2.0-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fcfa73b59b975a320ecc61fc8107b07f043efe4a007e108cd8cfa5afe98e136e
BLAKE2b-256 checksum
How to use checksums
39f3cc924b46fcd46715b3a9a30893c0415e8cdd56092491ae372213e2a4b778
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Security for emancipation 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page