Convert eml files to Markdown and YAML
  • Python 96.4%
  • Dockerfile 3.6%
Find a file
François Pelletier 598f4d55bf refactor: extract library, add FastAPI/MCP server and Docker support
- Split eml2md.py logic into reusable eml2md_lib.py
- Add FastAPI HTTP server (api.py) with /convert endpoints
- Add MCP server (mcp_server.py) for AI client integration
- Add Dockerfile and docker-compose.yml for containerized deployment
- Update pyproject.toml with fastapi, uvicorn, mcp dependencies
- Rewrite README with CLI, API, Docker, and MCP config docs
2026-07-01 21:35:16 -04:00
.gitignore Initial commit 2026-03-11 01:54:07 +00:00
.python-version version 1 2026-03-10 23:14:54 -04:00
.woodpecker.yml Refactor CI pipeline steps for package validation 2026-04-08 00:38:28 -04:00
api.py refactor: extract library, add FastAPI/MCP server and Docker support 2026-07-01 21:35:16 -04:00
docker-compose.yml refactor: extract library, add FastAPI/MCP server and Docker support 2026-07-01 21:35:16 -04:00
Dockerfile refactor: extract library, add FastAPI/MCP server and Docker support 2026-07-01 21:35:16 -04:00
eml2md.py refactor: extract library, add FastAPI/MCP server and Docker support 2026-07-01 21:35:16 -04:00
eml2md_lib.py refactor: extract library, add FastAPI/MCP server and Docker support 2026-07-01 21:35:16 -04:00
LICENSE Initial commit 2026-03-11 01:54:07 +00:00
mcp_server.py refactor: extract library, add FastAPI/MCP server and Docker support 2026-07-01 21:35:16 -04:00
pyproject.toml refactor: extract library, add FastAPI/MCP server and Docker support 2026-07-01 21:35:16 -04:00
README.md refactor: extract library, add FastAPI/MCP server and Docker support 2026-07-01 21:35:16 -04:00
supervisord.conf refactor: extract library, add FastAPI/MCP server and Docker support 2026-07-01 21:35:16 -04:00
uv.lock version 1 2026-03-10 23:14:54 -04:00

eml-archive-converter

Convert .eml files to Markdown + YAML.

Features

  • CLI python eml2md.py --file message.eml or --folder dir/
  • FastAPI HTTP endpoints for single-file and batch (zip) conversion
  • MCP server expose conversion tools to any MCP-compatible client (e.g. Claude Code)

Installation

pip install -e .

CLI Usage

# Single file
python eml2md.py --file path/to/message.eml

# Entire folder
python eml2md.py --folder path/to/maildir --out /tmp/results

Docker

Build and run with Docker Compose:

docker compose up --build

The FastAPI app is available at http://localhost:8000
The MCP server runs inside the container (see Claude Code config below).

API Endpoints

Method Path Description
GET /health Health check
POST /convert/file Upload a .eml file, get back MD + YAML JSON
POST /convert/folder Upload a .zip of .eml files, get back a .zip of results

Claude Code MCP Client Configuration

Add the following to your Claude Code MCP client configuration (e.g. ~/.claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "eml-archive-converter": {
      "command": "docker",
      "args": [
        "exec",
        "-i",
        "eml-archive-converter-eml-converter-1",
        "python",
        "/app/mcp_server.py"
      ]
    }
  }
}

Note: The container name eml-archive-converter-eml-converter-1 is the default name generated by Docker Compose. Adjust it if you use a different project name or service name.

After updating the config, restart Claude Code. The following MCP tools will be available:

Tool Description
convert_eml_file Convert a single .eml file (provide path)
convert_eml_folder Convert all .eml files in a directory (folder, recursive)
list_eml_files List .eml files in a directory (folder, recursive)

Project Structure

eml2md.py          # CLI entry-point (thin wrapper)
eml2md_lib.py      # Core library  no duplication
api.py             # FastAPI application
mcp_server.py      # MCP server (FastMCP)
pyproject.toml     # Project metadata & dependencies
Dockerfile         # Container image
docker-compose.yml # Orchestration
supervisord.conf   # Runs FastAPI + MCP in one container