mirror of
https://github.com/Dasemu/email-mcp.git
synced 2026-11-26 07:16:22 +00:00
Merge pull request 'chore: bootstrap Claude setup' (#1) from chore/bootstrap into main
This commit is contained in:
commit
da134b105a
11 files changed
+202
No files matched your search
@@ -0,0 +1 @@
|
||||
2
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"hooks": {
|
||||
"PostToolUse": [
|
||||
{
|
||||
"matcher": "Edit|Write",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "f=$(cat | python3 -c 'import json,sys;print(json.load(sys.stdin).get(\"tool_input\",{}).get(\"file_path\",\"\"))'); case \"$f\" in *.py) python3 -m py_compile \"$f\" ;; esac"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"Stop": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "cd \"$CLAUDE_PROJECT_DIR\" && python3 -m py_compile server.py"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
# Copy to email-mcp.env (gitignored) and fill in real values. Never commit real values.
|
||||
|
||||
# IMAP server used to read/manage mail
|
||||
IMAP_HOST=
|
||||
IMAP_PORT=993
|
||||
|
||||
# SMTP server used to send mail
|
||||
SMTP_HOST=
|
||||
SMTP_PORT=465
|
||||
|
||||
# JSON object mapping each account's email address to its password, e.g.
|
||||
# EMAIL_ACCOUNTS={"user@example.com":"app-password"}
|
||||
EMAIL_ACCOUNTS=
|
||||
|
||||
# Address/port the MCP server binds to
|
||||
BIND_HOST=127.0.0.1
|
||||
BIND_PORT=8084
|
||||
@@ -0,0 +1,29 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [development]
|
||||
push:
|
||||
branches: [development, main]
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
cache: "pip"
|
||||
|
||||
- name: Install dependencies
|
||||
run: pip install -r requirements.txt
|
||||
|
||||
# No linter is configured yet; this is a minimal syntax check.
|
||||
- name: Syntax check
|
||||
run: python -m py_compile server.py
|
||||
|
||||
# No test suite exists yet.
|
||||
- name: Tests
|
||||
run: echo "No test suite configured yet; skipping."
|
||||
@@ -0,0 +1,68 @@
|
||||
name: Version
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [development, main]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
bump:
|
||||
if: github.actor != 'github-actions[bot]' && !contains(github.event.head_commit.message, '[skip ci]')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Configure git
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
- name: Bump version
|
||||
id: bump
|
||||
run: |
|
||||
set -euo pipefail
|
||||
current=$(cat VERSION)
|
||||
IFS=. read -r major minor patch <<< "$current"
|
||||
|
||||
if [ "${{ github.ref_name }}" = "development" ]; then
|
||||
patch=$((patch + 1))
|
||||
else
|
||||
# main: MINOR bump only when every commit on this push came from development
|
||||
# (i.e. this push is a merge of development into main), otherwise a hotfix PATCH bump.
|
||||
is_merge_from_development=true
|
||||
for sha in $(git rev-list ${{ github.event.before }}..${{ github.sha }}); do
|
||||
if ! git merge-base --is-ancestor "$sha" origin/development 2>/dev/null; then
|
||||
is_merge_from_development=false
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$is_merge_from_development" = true ]; then
|
||||
minor=$((minor + 1))
|
||||
patch=0
|
||||
else
|
||||
patch=$((patch + 1))
|
||||
fi
|
||||
fi
|
||||
|
||||
new_version="$major.$minor.$patch"
|
||||
echo "$new_version" > VERSION
|
||||
echo "new_version=$new_version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Commit and push
|
||||
run: |
|
||||
git add VERSION
|
||||
git commit -m "chore(release): v${{ steps.bump.outputs.new_version }} [skip ci]"
|
||||
git push origin HEAD:${{ github.ref_name }}
|
||||
|
||||
- name: Merge main back into development
|
||||
if: github.ref_name == 'main'
|
||||
run: |
|
||||
git fetch origin development
|
||||
git checkout development
|
||||
git merge --no-edit origin/main
|
||||
git push origin development
|
||||
@@ -1 +1,4 @@
|
||||
email-mcp.env
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
# CLAUDE.md
|
||||
|
||||
## Overview
|
||||
A single-file MCP (Model Context Protocol) server exposing IMAP/SMTP email operations
|
||||
(list/read/move/delete emails, manage folders, send mail) as MCP tools over
|
||||
streamable-http, for one or more configured email accounts.
|
||||
|
||||
## Commands
|
||||
- Run locally: `python server.py` (requires env vars below; see `.env.example`).
|
||||
- Install dependencies: `pip install -r requirements.txt`.
|
||||
- Test: no test suite yet.
|
||||
- Lint/format: no linter/formatter configured yet.
|
||||
- Build: none (plain Python script, deployed via Nixpacks — see `nixpacks.toml`).
|
||||
|
||||
## Architecture
|
||||
Everything lives in `server.py`: env-based config, IMAP/SMTP helper functions, and
|
||||
`@mcp.tool()`-decorated functions exposed to MCP clients. See `docs/` for any deeper
|
||||
notes as they are added.
|
||||
|
||||
## Conventions
|
||||
- Python 3, stdlib `imaplib`/`smtplib`/`email` for all mail access — no mail client
|
||||
framework.
|
||||
- Tools return plain strings or JSON-serializable dicts/lists, never raw IMAP data.
|
||||
|
||||
## Workflow quirks
|
||||
- `EMAIL_ACCOUNTS` is a JSON object mapping account (email address) to password; it is
|
||||
read from the environment, never from a committed file.
|
||||
|
||||
## Deployment
|
||||
Deployed via Nixpacks (`nixpacks.toml`: `python server.py`) to a PaaS-style host, not
|
||||
the LXC/systemd pattern. The server binds to `BIND_HOST`/`BIND_PORT` and speaks MCP
|
||||
over streamable-http.
|
||||
|
||||
## Gotchas
|
||||
- `purge_email` permanently deletes a message; there is no undo.
|
||||
- Real credentials belong in `email-mcp.env` (gitignored), never in `.env.example` or
|
||||
in code.
|
||||
@@ -0,0 +1,6 @@
|
||||
# LESSONS.md
|
||||
|
||||
Recurring mistakes in this repo and how to avoid them. Read before starting work, add
|
||||
to it when a mistake repeats.
|
||||
|
||||
(No recurring mistakes recorded yet.)
|
||||
@@ -0,0 +1,15 @@
|
||||
# ZenvairoEmail-mcp
|
||||
|
||||
An MCP server that exposes IMAP/SMTP email operations (list accounts and folders,
|
||||
read/move/delete emails, send mail) as tools for MCP clients.
|
||||
|
||||
## Quick start
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
cp .env.example email-mcp.env # fill in real values
|
||||
set -a; source email-mcp.env; set +a
|
||||
python server.py
|
||||
```
|
||||
|
||||
See `CLAUDE.md` for architecture and conventions, and `docs/` for further documentation.
|
||||
Whitespace-only changes.
Reference in new issue
Block a user