Skip to main content

Open-source, self-hosted Inbox-as-a-Service API for AI Agents

Project description

The Norns weaving fate at Yggdrasil

NornWeave

"Laws they made there, and life allotted / To the sons of men, and set their fates."
- Voluspa (The Prophecy of the Seeress), Poetic Edda, Stanza 20

Open-source, self-hosted Inbox-as-a-Service API for AI Agents

CI Status License


What is NornWeave?

Standard email APIs are stateless and built for transactional sending. NornWeave adds a stateful layer (Inboxes, Threads, History) and an intelligent layer (Markdown parsing, Semantic Search) to make email consumable by LLMs via REST or MCP.

In Norse mythology, the Norns (Urdr, Verdandi, and Skuld) dwell at the base of Yggdrasil, the World Tree. They weave the tapestry of fate for all beings. Similarly, NornWeave:

  • Takes raw "water" (incoming email data streams)
  • Weaves disconnected messages into coherent Threads (the Tapestry)
  • Nourishes AI Agents with clean, structured context

Features

Foundation (The Mail Proxy)

  • Virtual Inboxes: Create email addresses for your AI agents
  • Webhook Ingestion: Receive emails from Mailgun, SES, SendGrid, Resend
  • Persistent Storage: PostgreSQL with abstracted storage adapters
  • Email Sending: Send replies through your configured provider

Intelligence (The Agent Layer)

  • Content Parsing: HTML to clean Markdown, cruft removal
  • Threading: Automatic conversation grouping via email headers
  • MCP Server: Connect directly to Claude, Cursor, and other MCP clients
  • Attachment Processing: Extract text from PDFs and documents

Enterprise (The Platform Layer)

  • Semantic Search: Vector embeddings with pgvector
  • Real-time Webhooks: Get notified of new messages
  • Rate Limiting: Protect against runaway agents
  • Multi-Tenancy: Organizations and projects

Quick Start

Install from PyPI

# Base installation (SQLite, all email providers)
pip install nornweave

# With PostgreSQL support
pip install nornweave[postgres]

# With MCP server for AI agents
pip install nornweave[mcp]

# Full installation
pip install nornweave[all]

Using Docker (Recommended for Production)

# Clone the repository
git clone https://github.com/DataCovey/nornweave.git
cd nornweave

# Copy environment configuration
cp .env.example .env
# Edit .env with your API keys

# Start the stack
docker compose up -d

# Run migrations
docker compose exec api alembic upgrade head

Using uv (Development)

# Clone the repository
git clone https://github.com/DataCovey/nornweave.git
cd nornweave

# Install dependencies
make install-dev

# Copy environment configuration
cp .env.example .env

# Start PostgreSQL (or use your own)
docker compose up -d postgres

# Run migrations
make migrate

# Start the development server
make dev

Configure Your Email Provider

  1. Set EMAIL_PROVIDER in .env (e.g., mailgun)
  2. Add your provider's API key
  3. Configure the webhook URL in your provider's dashboard:
    https://your-server.com/webhooks/mailgun
    

API Overview

Create an Inbox

curl -X POST http://localhost:8000/v1/inboxes \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Support Agent", "email_username": "support"}'

Read a Thread

curl http://localhost:8000/v1/threads/th_123 \
  -H "Authorization: Bearer YOUR_API_KEY"

Response (LLM-optimized):

{
  "id": "th_123",
  "subject": "Re: Pricing Question",
  "messages": [
    { "role": "user", "author": "bob@gmail.com", "content": "How much is it?", "timestamp": "..." },
    { "role": "assistant", "author": "agent@myco.com", "content": "$20/mo", "timestamp": "..." }
  ]
}

Send a Reply

curl -X POST http://localhost:8000/v1/messages \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "inbox_id": "ibx_555",
    "reply_to_thread_id": "th_123",
    "to": ["client@gmail.com"],
    "subject": "Re: Pricing Question",
    "body": "Thanks for your interest! Our pricing starts at $20/mo."
  }'

MCP Integration

NornWeave exposes an MCP server for direct integration with Claude, Cursor, and other MCP-compatible clients.

Available Tools

Tool Description
create_inbox Provision a new email address
send_email Send an email (auto-converts Markdown to HTML)
search_email Find relevant messages in your inbox
wait_for_reply Block until a reply arrives (experimental)

Configure in Cursor/Claude

pip install nornweave[mcp]
{
  "mcpServers": {
    "nornweave": {
      "command": "nornweave",
      "args": ["mcp"],
      "env": {
        "NORNWEAVE_API_URL": "http://localhost:8000"
      }
    }
  }
}

Architecture

NornWeave uses a thematic architecture inspired by Norse mythology:

Component Name Purpose
Storage Layer Urdr (The Well) Database adapters (PostgreSQL, SQLite)
Ingestion Engine Verdandi (The Loom) Webhook processing, HTML to Markdown
API & Outbound Skuld (The Prophecy) REST API, email sending, rate limiting
Gateway Yggdrasil API router connecting all providers
MCP Tools Huginn & Muninn Read/write tools for AI agents

Supported Providers

Provider Sending Receiving Auto-Route Setup
Mailgun yes yes yes
AWS SES yes yes manual
SendGrid yes yes yes
Resend yes yes yes

Documentation

Repository Structure

This is a monorepo:

  • src/nornweave/ – Main NornWeave server components
  • clients/python/ – Python client SDK (nornweave-client)
  • packages/n8n-nodes-nornweave/ – n8n community node (@nornweave/n8n-nodes-nornweave)

The root credentials symlink points to packages/n8n-nodes-nornweave/credentials so n8n’s package verification can find the credential file when checking the repo.

Contributing

We welcome contributions! Please see our Contributing Guide for details.

License

NornWeave is open-source software licensed under the Apache 2.0 License.


Image: "Nornorna spinner odet tradar vid Yggdrasil" by L. B. Hansen
Public Domain

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nornweave-0.1.2.tar.gz (120.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nornweave-0.1.2-py3-none-any.whl (112.0 kB view details)

Uploaded Python 3

File details

Details for the file nornweave-0.1.2.tar.gz.

File metadata

  • Download URL: nornweave-0.1.2.tar.gz
  • Upload date:
  • Size: 120.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nornweave-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8218cb9ac52918b1fac50b7ebac6f5ebc7a46333c182d3f214c4a8603a2cd700
MD5 e30f1bf88d29c72613e45cb508dca9f1
BLAKE2b-256 7657cdd3ead6276a5e8c8adde5fe236ece842724ccac64a4adb2f181c60547a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for nornweave-0.1.2.tar.gz:

Publisher: server-pypi-publish.yml on DataCovey/nornweave

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nornweave-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: nornweave-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 112.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nornweave-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 85eaf54b2652459fa55c79154d6d0ebe9b806e3a5002e5636aac663b35cc824d
MD5 839b6afdc53945b9c3b0df9fcc9ed51f
BLAKE2b-256 955ba133b287cb85f13296dd2c777341ed93dcf5a7fd03c33e98521af1949010

See more details on using hashes here.

Provenance

The following attestation bundles were made for nornweave-0.1.2-py3-none-any.whl:

Publisher: server-pypi-publish.yml on DataCovey/nornweave

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page