Agent Mail: AI Teams Talking to Each Other Over a Real Database
What You're Looking At
An AI coding assistant installs VibeSQL from npm, creates a 10-table agent mail schema, registers agents, sends messages between them, manages kanban boards, runs queries, and tears everything down. No faking. No local paths. Everything from the public npm registry, exactly how a real user would do it.
It took 68 takes to get here.
Why 68 Takes
Because shipping real developer tools is hard, and we refused to cheat.
Every take was a real npm install from the public registry. Every MCP tool call went through the actual protocol. When something broke, we fixed the root cause and published a new version — we didn't patch around it in the script.
Here's what we fixed along the way:
vibesql-mcp (MCP Server) — 4 releases in one day:
| Version | What broke | What we fixed |
|---|---|---|
| 1.0.0 | Health check killed the process on startup (MCP starts before the database) | — |
| 1.0.1 | Removed the blocking health check | Published with stale build artifacts |
| 1.0.2 | No visibility into what the MCP server was doing | Added stderr logging |
| 1.0.3 | list_tables returned nulls, query crashed on every call | Rewrote the API response transformer — vibesql-micro returns rows as objects, MCP expected arrays |
vibesql-micro (Database) — 4 releases in one day:
| Version | What it added |
|---|---|
| 1.0.1 | Windows PostgreSQL /share directory fix |
| 1.0.2 | Real-time startup diagnostics instead of "timeout after 30s" |
| 1.0.3 | Parameterized queries ($1, $2) for SQL injection prevention |
| 1.0.4 | Graceful shutdown via POST /v1/shutdown and vibe stop command |
Other discoveries:
- MCP config goes in
.mcp.jsonat the project root, not.claude/settings.json - Windows needs
cmd /cwrapper for npx in MCP configs npxcaches aggressively — pin the version (vibesql-mcp@1.0.3) or it serves stale code- Pre-approve MCP tools in
settings.local.jsonor the demo hits permission prompts on every call - A global
/vibe-sqlskill was teaching the AI to use curl instead of MCP tools — had to delete it
The Schema
The demo builds a full agent mail system — 10 tables, 14 indexes:
- settings — key-value configuration
- agents — agent profiles with role definitions, expertise, and identity markdown
- teams — agent team groupings
- team_members — many-to-many agent-team relationships
- projects — project tracking
- kanban_boards — visual boards linked to projects
- kanban_columns — board columns (Backlog, In Progress, Done)
- kanban_cards — cards with agent assignments
- messages — threaded messages with importance levels
- inbox — per-agent delivery with read/archive tracking
This schema mirrors the production vibe_agents collection from the PayEz VibeDB — translated from JSONB documents to relational PostgreSQL tables.
What MCP Actually Does
MCP (Model Context Protocol) is a JSON-RPC protocol over stdio. The AI tool spawns the MCP server as a child process and calls tools through structured messages. No HTTP, no REST, no curl.
The vibesql-mcp package exposes 9 tools:
query — Execute any SQL (DDL + DML, unrestricted)
list_tables — List all tables
describe_table — Column schema
table_data — Browse rows with pagination
create_table — DDL helper (validates, prevents multi-statement injection)
insert_row — Insert from JSON key-value pairs
help — VibeSQL topic help
help_products — Product family overview
help_architecture — Architecture patterns
The AI uses these tools natively — no curl, no HTTP clients, no bash commands. It calls query with SQL and gets back formatted results.
Try It Yourself
npm install -g vibesql-micro
npx vibesql-micro serve
Add .mcp.json to your project:
{
"mcpServers": {
"vibesql": {
"command": "npx",
"args": ["--yes", "vibesql-mcp@1.0.3"]
}
}
}
On Windows, use cmd /c:
{
"mcpServers": {
"vibesql": {
"command": "cmd",
"args": ["/c", "npx", "--yes", "vibesql-mcp@1.0.3"]
}
}
}
Open Claude Code in that directory. The MCP tools appear automatically. Ask it to create tables, insert data, run queries — it uses the tools directly.
What's Next
- vibesql-mail — a dedicated Rust API for agent-to-agent messaging (the schema from this demo, but as a standalone service with its own MCP server)
- GPT Store — OpenAPI spec for vibesql-micro so Custom GPTs can query your database
- Gemini — function declarations for the same tool set
The video is up. The packages are on npm. The code is Apache-2.0.
68 takes. Zero shortcuts.