npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tai-mcp

v0.1.0

Published

TAI MCP Email Server - enables AI agents to interact with email through CF Mail Bridge API

Readme

TAI MCP Email Server

A Model Context Protocol (MCP) server that enables AI agents to interact with email through the CF Mail Bridge API.

Features

  • MCP Mode (Default): Provides email tools for MCP-compatible clients like Claude Desktop
  • Live Mode: Monitors for new emails and automatically invokes Claude Code to process them
  • Registration: Register new users with the CF Mail Bridge API

MCP Tools

send_email

Send an email through the CF Mail Bridge API.

Parameters:

  • to (optional): Recipient email address (defaults to USEREMAIL env var)
  • subject (optional): Email subject line (defaults to "Email from CF Mail Bridge")
  • html (optional): HTML message body content

fetch_email

Retrieve the oldest unread email and mark it as read.

Parameters:

  • email_id (optional): Specific email ID to fetch (if not provided, fetches oldest unread)

list_inbox

List recent emails sent to the instance address.

Parameters:

  • limit (optional): Number of messages to return (default: 10, max: 200)
  • offset (optional): Number of messages to skip for pagination (default: 0)
  • show_read (optional): Include read emails in the list (default: false)

Installation

npm install
npm run build

Configuration

Set the following environment variables:

Required

NAME=alice                    # CF Mail Bridge username
PASSWORD=secure_password123   # Authentication password
INSTANCE=desktop             # Agent instance identifier

Optional

[email protected]   # Default recipient for send_email
LOG_LEVEL=info               # Logging level: error|warn|info|debug
API_TIMEOUT=30000            # API request timeout in ms
POLL_INTERVAL=5000           # Live mode polling interval in ms
API_BASE_URL=https://tai.chat # API base URL (default)

Your instance email will be: {INSTANCE}.{NAME}@tai.chat

Usage

MCP Mode (Default)

Start as an MCP server:

npm start
# or
./build/src/index.js

Live Mode

Monitor for new emails and auto-invoke Claude Code:

npm start live
# or
./build/src/index.js live

Register User

Register a new user with the CF Mail Bridge API:

npm start register
# or with custom username
npm start register alice

MCP Client Configuration

Add to your Claude Desktop configuration file:

{
  "mcpServers": {
    "tai-email": {
      "command": "/path/to/tai-mcp-email-server/build/src/index.js",
      "env": {
        "NAME": "your-username",
        "PASSWORD": "your-password", 
        "INSTANCE": "desktop",
        "USEREMAIL": "[email protected]"
      }
    }
  }
}

Development

Build

npm run build

Development Mode

npm run dev

Testing

npm test

Linting

npm run lint

Project Structure

src/
├── index.ts              # Main entry point & CLI router
├── server.ts             # MCP server implementation
├── commands/             # CLI commands
│   ├── register.ts       # Registration command
│   └── live.ts           # Live polling command
├── tools/                # MCP tool implementations
│   ├── send-email.ts     # send_email tool
│   ├── fetch-email.ts    # fetch_email tool
│   └── list-inbox.ts     # list_inbox tool
├── services/             # Core services
│   ├── auth.ts           # Authentication service
│   ├── api-client.ts     # CF Mail Bridge API client
│   └── email-poller.ts   # Email polling service
├── utils/                # Utility modules
│   ├── logger.ts         # Logging utility
│   ├── config.ts         # Configuration management
│   └── html-to-markdown.ts # HTML to markdown converter
└── types/                # TypeScript type definitions
    ├── api.ts            # API response types
    └── tools.ts          # Tool parameter schemas

API Integration

This server integrates with the CF Mail Bridge API at https://tai.chat. Key endpoints used:

  • POST /api/v1/register - User registration
  • POST /api/v1/login - User authentication
  • GET /api/v1/messages - Fetch messages with filtering
  • POST /api/v1/send-email - Send emails
  • PUT /api/v1/messages/{id}/read - Mark messages as read

Live Mode Operation

In live mode, the server:

  1. Polls the API every 5 seconds for unread emails
  2. When new emails are detected, executes:
    claude code -p "Please resolve the unread email and send the response back to the user after the email is resolved"
  3. Claude Code can then use the same MCP server to fetch, process, and respond to emails

Error Handling

The server implements comprehensive error handling:

  • Validates environment variables on startup
  • Handles API authentication failures with automatic retry
  • Provides user-friendly error messages
  • Logs all operations for debugging

Security

  • JWT tokens are stored in memory only
  • Auto-refresh tokens before expiration
  • Validate all user inputs with Zod schemas
  • No secrets are logged or exposed

License

MIT License