fagents-mcp
OfficialClick on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@fagents-mcpsend an email to support@example.com about the bug fix"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
fagents-mcp
MCP (Model Context Protocol) server exposing email tools to Claude Code agents. Handles SMTP sending and IMAP reading, with per-agent credential isolation and an audit-logged secure email gate.
Stack: TypeScript, Node.js, Express, @modelcontextprotocol/sdk. Stateless MCP over HTTP.
Tools
Tool | Description |
| Send email via SMTP. Supports plain text, HTML, CC/BCC, and file attachments. |
| List messages in a mailbox folder. Returns newest first with envelope metadata. |
| Read a full message by UID — body text/HTML and attachment list. |
| Search by from/to/subject/date range/unseen/body text. |
| List available IMAP folders. |
| Download an attachment by part number. Returns base64-encoded content. |
| Secure read: fetches email via IMAP, logs full content to |
Related MCP server: email
Architecture
Claude agent (MCP client)
│ POST /mcp (x-api-key: <agent-token>)
▼
fagents-mcp (Express + MCP SDK)
├─ auth.ts — resolve agent from API key
├─ config.ts — load per-agent env from agents.json, AsyncLocalStorage context
├─ email.ts — SMTP send via nodemailer
├─ imap.ts — IMAP read/search/download via node-imap
└─ server.ts — MCP tool registration, gate_email audit loggingStateless: Each MCP request creates a fresh server+transport instance. No session state between calls.
Per-agent credentials: Each agent sends its unique API key. The server resolves the agent ID, then loads that agent's credentials (SMTP host/pass, IMAP host/pass, etc.) from agents.json via AsyncLocalStorage. Agents never see each other's credentials.
Credential Storage
Credentials live in agents.json in the working directory (typically the installation directory). This file is managed by the human operator — agents must not read or write it directly.
{
"agents": {
"ftf": {
"apiKey": "<hashed-or-raw-key>",
"SMTP_HOST": "smtp.example.com",
"SMTP_USER": "ftf@example.com",
"SMTP_PASS": "...",
"IMAP_HOST": "imap.example.com",
"IMAP_USER": "ftf@example.com",
"IMAP_PASS": "...",
"COMMS_TOKEN": "...",
"COMMS_URL": "http://127.0.0.1:9754"
}
},
"shared": {
"SMTP_PORT": "587",
"IMAP_PORT": "993"
}
}AgentConfig accepts any [envKey: string]: string pairs alongside apiKey — the schema is open for extension (Telegram tokens, etc.).
Environment Variables
Without agents.json, the server falls back to environment variables:
Variable | Default | Description |
| 3000 | Listen port |
| 127.0.0.1 | Bind address |
| — | Single-agent API key (if not using agents.json) |
| — | SMTP server hostname |
| 587 | SMTP port |
| — | SMTP username |
| — | SMTP password |
| SMTP_USER | From address |
| — | IMAP server hostname |
| 993 | IMAP port |
| — | IMAP username |
| — | IMAP password |
| true | Use TLS for IMAP |
| — | fagents-comms URL (for gate_email audit log) |
| — | Comms token (for gate_email audit log) |
Setup
npm install
npm run build # compiles TypeScript → dist/
# Single-agent mode (env vars)
MCP_API_KEY=secret SMTP_HOST=smtp.example.com ... node dist/server.js
# Multi-agent mode (agents.json in working dir)
node dist/server.jsDevelopment (no build step):
npm run dev # runs src/server.ts directly via tsxClaude Code Integration
Add to .claude/settings.json (or via MCP config):
{
"mcpServers": {
"fagents-mcp": {
"type": "http",
"url": "http://127.0.0.1:3000/mcp",
"headers": {
"x-api-key": "<your-agent-api-key>"
}
}
}
}MCP tools are discovered at session start. After changing tools or restarting the server, start a new Claude session to pick up changes.
Security Notes
gate_email strips
<untrusted>tag variants from email body before wrapping content — prevents boundary escape attacks from malicious emails.Subject and messageId are excluded from
gate_emailresponse (attacker-controlled fields that could carry injection payloads). They are logged to#email-logfor human review.agents.jsonshould bechmod 600and never committed to version control.Server binds
127.0.0.1by default. Use SSH tunnels or a reverse proxy for remote access.
Origin
Part of the fagents project — autonomous Claude Code agent infrastructure. Built by freeturtle agents and Juho Muhonen.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/fagents/fagents-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server