agent-mail
複数のエージェントが連携する業務で、メールのようにメッセージをやり取りし、ファイルの予約や承認フロー、担当者の設定、災害対策など、業務を円滑に進めるための機能を提供するSkill。
📜 元の英語説明(参考)
MCP Agent Mail - Mail-like coordination layer for multi-agent workflows. Identities, inbox/outbox, file reservations, contact policies, threaded messaging, pre-commit guard, Human Overseer, static exports, disaster recovery. Git+SQLite backed. Python/FastMCP.
🇯🇵 日本人クリエイター向け解説
複数のエージェントが連携する業務で、メールのようにメッセージをやり取りし、ファイルの予約や承認フロー、担当者の設定、災害対策など、業務を円滑に進めるための機能を提供するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o agent-mail.zip https://jpskill.com/download/18636.zip && unzip -o agent-mail.zip && rm agent-mail.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/18636.zip -OutFile "$d\agent-mail.zip"; Expand-Archive "$d\agent-mail.zip" -DestinationPath $d -Force; ri "$d\agent-mail.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
agent-mail.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
agent-mailフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
MCP Agent Mail
HTTP専用のFastMCPサーバーとして公開される、コーディングエージェント向けのメールのような連携レイヤーです。記憶に残るID、インボックス/アウトボックス、ファイル予約リース、連絡ポリシー、検索可能なメッセージ履歴、およびHuman Overseerメッセージングを提供します。Git(人間が監査可能な成果物)とSQLite(FTS5による高速クエリ)によってバックアップされています。
これが存在する理由
連携がないと、複数のエージェントは次のようになります。
- お互いの編集を上書きしたり、予期しない差分でパニックになったりする
- 並行するワークストリームからの重要なコンテキストを見逃す
- ツール間で人間がメッセージを中継する必要がある
Agent Mailは、これを以下で解決します。
- 記憶に残るID(「GreenCastle」のような形容詞+名詞の名前)
- 編集意図を知らせるためのアドバイザリファイル予約
- 重要度レベルと確認応答を備えたスレッドメッセージング
- コミット時に予約を強制するプリコミットガード
- 人間からエージェントへの直接通信のためのHuman Overseer
サーバーの起動
# 最も簡単な方法(インストール時にエイリアスが追加されます)
am
# または手動で
cd ~/projects/mcp_agent_mail
./scripts/run_server_with_token.sh
デフォルト: http://127.0.0.1:8765
人間用のWeb UI: http://127.0.0.1:8765/mail
主要な概念
プロジェクト
各作業ディレクトリ(絶対パス)がプロジェクトです。同じディレクトリ内のエージェントは、プロジェクト名前空間を共有します。連携する必要があるエージェントには、同じproject_keyを使用します。
エージェントID
エージェントは、形容詞+名詞の名前(GreenCastle、BlueLake)で登録します。名前はプロジェクトごとに一意で、覚えやすく、インボックス、コミットログ、およびWeb UIに表示されます。
ファイル予約(リース)
ファイルパスまたはglobのアドバイザリロックです。ファイルを編集する前に、意図を知らせるためにファイルを予約します。他のエージェントは予約を確認し、別の作業を選択できます。オプションのプリコミットガードは、他のエージェントの排他的予約と競合するコミットをブロックします。
連絡ポリシー
エージェントごとのポリシーは、誰が誰にメッセージを送信できるかを制御します。
| ポリシー | 動作 |
|---|---|
open |
プロジェクト内のすべてのメッセージを受け入れる |
auto (デフォルト) |
共有コンテキストが存在する場合に許可する(同じスレッド、重複する予約、最近の連絡) |
contacts_only |
最初に明示的な連絡先の承認が必要 |
block_all |
すべての新しい連絡先を拒否する |
メッセージ
スレッド、重要度レベル(low、normal、high、urgent)、およびオプションの確認応答要件を備えたGitHub-Flavored Markdown。画像は自動的にWebPに変換されます。
必須のワークフロー
1. セッションの開始(ワンコールブートストラップ)
macro_start_session(
human_key="/abs/path/to/project",
program="claude-code",
model="opus-4.5",
task_description="Implementing auth module"
)
戻り値: {project, agent, file_reservations, inbox}
この単一の呼び出しは、プロジェクトが存在することを確認し、IDを登録し、オプションでファイルを予約し、インボックスをフェッチします。
2. 編集前にファイルを予約する
file_reservation_paths(
project_key="/abs/path/to/project",
agent_name="GreenCastle",
paths=["src/auth/**/*.ts", "src/middleware/auth.ts"],
ttl_seconds=3600,
exclusive=true,
reason="bd-123"
)
戻り値: {granted: [...], conflicts: [...]}
競合は報告されますが、予約は引き続き許可されます。競合を確認し、必要に応じて調整します。
3. 作業を発表する
send_message(
project_key="/abs/path/to/project",
sender_name="GreenCastle",
to=["BlueLake"],
subject="[bd-123] Starting auth refactor",
body_md="Reserving src/auth/**. Will update session handling.",
thread_id="bd-123",
importance="normal",
ack_required=true
)
4. 定期的にインボックスを確認する
fetch_inbox(
project_key="/abs/path/to/project",
agent_name="GreenCastle",
limit=20,
urgent_only=false,
include_bodies=true
)
または、高速読み取りのためにリソースを使用します。
resource://inbox/GreenCastle?project=/abs/path&limit=20&include_bodies=true
5. 完了したら予約を解放する
release_file_reservations(
project_key="/abs/path/to/project",
agent_name="GreenCastle"
)
4つのマクロ
速度とより小さなモデルのためにマクロを優先します。細かい制御が必要な場合は、粒度の細かいツールを使用します。
| マクロ | 目的 |
|---|---|
macro_start_session |
ブートストラップ: プロジェクトの確認 → エージェントの登録 → オプションのファイル予約 → インボックスのフェッチ |
macro_prepare_thread |
既存の会話に参加: 登録 → スレッドの要約 → インボックスコンテキストのフェッチ |
macro_file_reservation_cycle |
ファイルの予約、作業の実行、オプションで完了時に自動リリース |
macro_contact_handshake |
連絡先の許可をリクエスト、オプションで自動承認、ウェルカムメッセージの送信 |
Beads統合(bd-###ワークフロー)
タスク管理にBeadsを使用する場合は、識別子を一致させてください。
1. 準備完了の作業を選択: bd ready --json → bd-123を選択
2. ファイルの予約: file_reservation_paths(..., reason="bd-123")
3. 開始の発表: send_message(..., thread_id="bd-123", subject="[bd-123] Starting...")
4. 作業と更新: スレッド内で進捗状況を返信
5. 完了: bd close bd-123
release_file_reservations(...)
send_message(..., subject="[bd-123] Completed")
以下としてbd-###を使用します。
- メール
thread_id - メッセージの件名のプレフィックス
[bd-###] - ファイル予約
reason - コミットメッセージの参照
Beads Viewer (bv) 統合
インテリジェントなタスク選択のために、bvのロボットフラグを使用します。
| フラグ | 出力 | ユースケース |
|---|---|---|
bv --robot-insights |
PageRank、クリティカルパス、サイクル | 「最も影響力のあるものは何ですか?」 |
bv --robot-plan |
並列トラック、ブロック解除 | 「並行して実行できるものは何ですか?」 |
bv --robot-priority |
信頼度付きの推奨事項 | 「次に何に取り組むべきですか?」 |
bv --robot-diff --diff-since <ref> |
コミット/日付以降の変更 | 「何が変わりましたか?」 |
経験則: タスク操作にはbdを使用し、タスクインテリジェンスにはbvを使用します。
プロジェクト間の連携
フロントエンド/バックエンドまたはマルチリポジトリプロジェクトの場合:
オプションA: 共有project_key
両方のリポジトリで同じproject_keyを使用します。エージェントは自動的に連携します。
オプションB: 連絡先リンクを持つ個別のプロジェクト
# バックエンドエージェントがconをリクエスト 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
MCP Agent Mail
A mail-like coordination layer for coding agents exposed as an HTTP-only FastMCP server. Provides memorable identities, inbox/outbox, file reservation leases, contact policies, searchable message history, and Human Overseer messaging. Backed by Git (human-auditable artifacts) and SQLite (fast queries with FTS5).
Why This Exists
Without coordination, multiple agents:
- Overwrite each other's edits or panic on unexpected diffs
- Miss critical context from parallel workstreams
- Require humans to relay messages between tools
Agent Mail solves this with:
- Memorable identities (adjective+noun names like "GreenCastle")
- Advisory file reservations to signal editing intent
- Threaded messaging with importance levels and acknowledgments
- Pre-commit guard to enforce reservations at commit time
- Human Overseer for direct human-to-agent communication
Starting the Server
# Quickest way (alias added during install)
am
# Or manually
cd ~/projects/mcp_agent_mail
./scripts/run_server_with_token.sh
Default: http://127.0.0.1:8765
Web UI for humans: http://127.0.0.1:8765/mail
Core Concepts
Projects
Each working directory (absolute path) is a project. Agents in the same directory share a project namespace. Use the same project_key for agents that need to coordinate.
Agent Identity
Agents register with adjective+noun names (GreenCastle, BlueLake). Names are unique per project, memorable, and appear in inboxes, commit logs, and the web UI.
File Reservations (Leases)
Advisory locks on file paths or globs. Before editing files, reserve them to signal intent. Other agents see the reservation and can choose different work. The optional pre-commit guard blocks commits that conflict with others' exclusive reservations.
Contact Policies
Per-agent policies control who can message whom:
| Policy | Behavior |
|---|---|
open |
Accept any message in the project |
auto (default) |
Allow if shared context exists (same thread, overlapping reservations, recent contact) |
contacts_only |
Require explicit contact approval first |
block_all |
Reject all new contacts |
Messages
GitHub-Flavored Markdown with threading, importance levels (low, normal, high, urgent), and optional acknowledgment requirements. Images are auto-converted to WebP.
Essential Workflow
1. Start Session (One-Call Bootstrap)
macro_start_session(
human_key="/abs/path/to/project",
program="claude-code",
model="opus-4.5",
task_description="Implementing auth module"
)
Returns: {project, agent, file_reservations, inbox}
This single call: ensures project exists, registers your identity, optionally reserves files, fetches your inbox.
2. Reserve Files Before Editing
file_reservation_paths(
project_key="/abs/path/to/project",
agent_name="GreenCastle",
paths=["src/auth/**/*.ts", "src/middleware/auth.ts"],
ttl_seconds=3600,
exclusive=true,
reason="bd-123"
)
Returns: {granted: [...], conflicts: [...]}
Conflicts are reported but reservations are still granted. Check conflicts and coordinate if needed.
3. Announce Your Work
send_message(
project_key="/abs/path/to/project",
sender_name="GreenCastle",
to=["BlueLake"],
subject="[bd-123] Starting auth refactor",
body_md="Reserving src/auth/**. Will update session handling.",
thread_id="bd-123",
importance="normal",
ack_required=true
)
4. Check Inbox Periodically
fetch_inbox(
project_key="/abs/path/to/project",
agent_name="GreenCastle",
limit=20,
urgent_only=false,
include_bodies=true
)
Or use resources for fast reads:
resource://inbox/GreenCastle?project=/abs/path&limit=20&include_bodies=true
5. Release Reservations When Done
release_file_reservations(
project_key="/abs/path/to/project",
agent_name="GreenCastle"
)
The Four Macros
Prefer macros for speed and smaller models. Use granular tools when you need fine control.
| Macro | Purpose |
|---|---|
macro_start_session |
Bootstrap: ensure project → register agent → optional file reservations → fetch inbox |
macro_prepare_thread |
Join existing conversation: register → summarize thread → fetch inbox context |
macro_file_reservation_cycle |
Reserve files, do work, optionally auto-release when done |
macro_contact_handshake |
Request contact permission, optionally auto-accept, send welcome message |
Beads Integration (bd-### Workflow)
When using Beads for task management, keep identifiers aligned:
1. Pick ready work: bd ready --json → choose bd-123
2. Reserve files: file_reservation_paths(..., reason="bd-123")
3. Announce start: send_message(..., thread_id="bd-123", subject="[bd-123] Starting...")
4. Work and update: Reply in thread with progress
5. Complete: bd close bd-123
release_file_reservations(...)
send_message(..., subject="[bd-123] Completed")
Use bd-### as:
- Mail
thread_id - Message subject prefix
[bd-###] - File reservation
reason - Commit message reference
Beads Viewer (bv) Integration
Use bv's robot flags for intelligent task selection:
| Flag | Output | Use Case |
|---|---|---|
bv --robot-insights |
PageRank, critical path, cycles | "What's most impactful?" |
bv --robot-plan |
Parallel tracks, unblocks | "What can run in parallel?" |
bv --robot-priority |
Recommendations with confidence | "What should I work on next?" |
bv --robot-diff --diff-since <ref> |
Changes since commit/date | "What changed?" |
Rule of thumb: Use bd for task operations, use bv for task intelligence.
Cross-Project Coordination
For frontend/backend or multi-repo projects:
Option A: Shared project_key
Both repos use the same project_key. Agents coordinate automatically.
Option B: Separate projects with contact links
# Backend agent requests contact with frontend agent
request_contact(
project_key="/abs/path/backend",
from_agent="GreenCastle",
to_agent="BlueLake",
to_project="/abs/path/frontend",
reason="API contract coordination"
)
# Frontend agent accepts
respond_contact(
project_key="/abs/path/frontend",
to_agent="BlueLake",
from_agent="GreenCastle",
accept=true
)
Pre-Commit Guard
Install the guard to block commits that conflict with others' exclusive reservations:
install_precommit_guard(
project_key="/abs/path/to/project",
code_repo_path="/abs/path/to/project"
)
Guard Features
- Composition-safe: Chain-runner preserves existing hooks in
hooks.d/ - Rename-aware: Checks both old and new paths for renames/moves
- NUL-safe: Handles paths with special characters
- Git-native matching: Uses Git wildmatch pathspec semantics
Set AGENT_NAME environment variable so the guard knows who you are.
Bypass in emergencies: AGENT_MAIL_BYPASS=1 git commit ...
Tools Reference
Project & Identity
| Tool | Purpose |
|---|---|
ensure_project(human_key) |
Create/ensure project exists |
register_agent(project_key, program, model, name?, task_description?) |
Register identity |
whois(project_key, agent_name) |
Get agent profile with recent commits |
create_agent_identity(project_key, program, model) |
Always create new unique agent |
Messaging
| Tool | Purpose |
|---|---|
send_message(project_key, sender, to, subject, body_md, ...) |
Send message |
reply_message(project_key, message_id, sender, body_md) |
Reply (preserves thread) |
fetch_inbox(project_key, agent, limit?, since_ts?, urgent_only?) |
Get messages |
mark_message_read(project_key, agent, message_id) |
Mark as read |
acknowledge_message(project_key, agent, message_id) |
Acknowledge receipt |
search_messages(project_key, query) |
FTS5 search |
summarize_thread(project_key, thread_id) |
Extract key points and actions |
File Reservations
| Tool | Purpose |
|---|---|
file_reservation_paths(project_key, agent, paths, ttl?, exclusive?) |
Reserve files |
release_file_reservations(project_key, agent, paths?) |
Release reservations |
renew_file_reservations(project_key, agent, extend_seconds?) |
Extend TTL |
force_release_file_reservation(project_key, agent, reservation_id) |
Clear stale reservation |
Contact Management
| Tool | Purpose |
|---|---|
request_contact(project_key, from_agent, to_agent, reason?) |
Request permission to message |
respond_contact(project_key, to_agent, from_agent, accept) |
Accept/deny contact request |
list_contacts(project_key, agent_name) |
List contact links |
set_contact_policy(project_key, agent_name, policy) |
Set open/auto/contacts_only/block_all |
Resources (Fast Reads)
Use resources for quick, non-mutating reads:
resource://inbox/{agent}?project=<path>&limit=20&include_bodies=true
resource://thread/{thread_id}?project=<path>&include_bodies=true
resource://message/{id}?project=<path>
resource://file_reservations/{slug}?active_only=true
resource://project/{slug}
resource://projects
resource://agents/{project_key}
Search Syntax (FTS5)
"exact phrase"
prefix*
term1 AND term2
term1 OR term2
subject:login
body:"api key"
(auth OR login) AND NOT admin
Example: search_messages(project_key, '"auth module" AND error NOT legacy')
Web UI Features
Browse at http://127.0.0.1:8765/mail:
- Unified inbox across all projects
- Per-project search with FTS5
- Thread viewer with markdown rendering
- File reservations browser
- Human Overseer: Send high-priority messages to agents from the web UI
- Related Projects Discovery: AI-powered suggestions for linking repos
Human Overseer
Send direct messages to agents with automatic preamble:
- Messages marked as
highimportance - Bypasses contact policies
- Agents are instructed to pause current work, complete request, then resume
Static Mailbox Export
Export projects to portable, read-only bundles for auditors, stakeholders, or archives:
# Interactive wizard (recommended)
uv run python -m mcp_agent_mail.cli share wizard
# Manual export
uv run python -m mcp_agent_mail.cli share export --output ./bundle
# With signing
uv run python -m mcp_agent_mail.cli share export \
--output ./bundle \
--signing-key ./keys/signing.key
# Preview locally
uv run python -m mcp_agent_mail.cli share preview ./bundle
Export Features
- Ed25519 cryptographic signing
- Age encryption for confidential distribution
- Scrub presets:
standard(removes secrets) orstrict(redacts bodies) - Deploy to GitHub Pages or Cloudflare Pages via wizard
Disaster Recovery
# Save current state
uv run python -m mcp_agent_mail.cli archive save --label nightly
# List restore points
uv run python -m mcp_agent_mail.cli archive list --json
# Restore after disaster
uv run python -m mcp_agent_mail.cli archive restore <file>.zip --force
Mailbox Health (Doctor)
# Run diagnostics
uv run python -m mcp_agent_mail.cli doctor check
# Preview repairs
uv run python -m mcp_agent_mail.cli doctor repair --dry-run
# Apply repairs (creates backup first)
uv run python -m mcp_agent_mail.cli doctor repair
Checks: stale locks, database integrity, orphaned records, FTS sync, expired reservations.
Common Pitfalls
| Error | Fix |
|---|---|
| "sender_name not registered" | Call register_agent or macro_start_session first |
| "FILE_RESERVATION_CONFLICT" | Wait for expiry, coordinate, or use non-exclusive |
| "CONTACT_BLOCKED" | Use request_contact and wait for approval |
| Empty inbox | Check since_ts, urgent_only, verify agent name matches exactly |
Installation
# One-liner (recommended)
curl -fsSL "https://raw.githubusercontent.com/Dicklesworthstone/mcp_agent_mail/main/scripts/install.sh?$(date +%s)" | bash -s -- --yes
# Custom port
curl -fsSL ... | bash -s -- --port 9000 --yes
# Change port after installation
uv run python -m mcp_agent_mail.cli config set-port 9000
Key Environment Variables
| Variable | Default | Description |
|---|---|---|
STORAGE_ROOT |
~/.mcp_agent_mail_git_mailbox_repo |
Root for repos and SQLite DB |
HTTP_PORT |
8765 |
Server port |
HTTP_BEARER_TOKEN |
— | Static bearer token for auth |
LLM_ENABLED |
true |
Enable LLM for summaries/discovery |
CONTACT_ENFORCEMENT_ENABLED |
true |
Enforce contact policy |
Docker
docker build -t mcp-agent-mail .
docker run --rm -p 8765:8765 \
-e HTTP_HOST=0.0.0.0 \
-v agent_mail_data:/data \
mcp-agent-mail
Integration with Flywheel
| Tool | Integration |
|---|---|
| NTM | Agent panes coordinate via mail, dashboard shows inbox |
| BV | Task IDs become thread IDs, robot flags inform task selection |
| CASS | Search mail threads across sessions |
| CM | Extract procedural memory from mail archives |
| DCG | Mail notifies agents of blocked commands |
| RU | Coordinate multi-repo updates via cross-project mail |