#!/bin/bash
# FastMail MCP Server Docker Bridge Script
# This script bridges Docker stdio transport to Claude Code
set -e
# Configuration
CONTAINER_NAME="fastmail-mcp-server"
IMAGE_NAME="fastmail-mcp-server:latest"
ENV_FILE="/Users/ceverson/Development/email_organization/core/.env"
# Function to check if container exists and is running
container_running() {
docker ps --format "table {{.Names}}" | grep -q "^${CONTAINER_NAME}$"
}
# Function to start container if not running
ensure_container_running() {
if ! container_running; then
echo "Starting FastMail MCP Server container..." >&2
# Remove any stopped container with the same name
docker rm -f "$CONTAINER_NAME" 2>/dev/null || true
# Start new container in detached mode
docker run -d \
--name "$CONTAINER_NAME" \
--restart unless-stopped \
--memory=256m \
--cpus=0.5 \
--read-only \
--tmpfs /tmp \
--tmpfs /var/tmp \
--security-opt no-new-privileges:true \
--env-file "$ENV_FILE" \
"$IMAGE_NAME" \
tail -f /dev/null
# Wait a moment for container to be ready
sleep 2
echo "FastMail MCP Server container started" >&2
fi
}
# Function to stop container when script exits
cleanup() {
echo "Cleaning up..." >&2
docker stop "$CONTAINER_NAME" 2>/dev/null || true
docker rm "$CONTAINER_NAME" 2>/dev/null || true
}
# Set up cleanup on exit
trap cleanup EXIT INT TERM
# Ensure container is running
ensure_container_running
# Forward stdin/stdout through Docker exec
exec docker exec -i "$CONTAINER_NAME" node src/index.js
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/gr3enarr0w/fastmail-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server