Inspiration

AI agents today are amnesiacs — each session starts blank, with no persistent memory across invocations. Existing solutions (vector DBs, Pinecone, Weaviate) optimize for semantic search but ignore the relational, structured knowledge that agents accumulate. CockroachDB's distributed SQL with JSONB support is the perfect foundation for an agentic memory layer: horizontally scalable, survivable, and capable of both structured queries and semantic retrieval.

What it does

Mythos Memory MCP is an MCP (Model Context Protocol) server that gives AI agents a persistent, queryable memory system backed by CockroachDB. Agents can:

  • Store arbitrary facts, observations, and knowledge as structured JSON with tags and metadata
  • Search via full-text, semantic vector, and relational queries over a single SQL interface
  • Retrieve context-relevant memories to inject into LLM prompts
  • Monetize knowledge via x402 HTTP 402 payment protocol
  • Scale horizontally as usage grows, thanks to CockroachDB's distributed architecture

How we built it

  • Database: CockroachDB Serverless for distributed SQL with JSONB, full-text search, and pgvector extension
  • MCP Server: Node.js MCP SDK implementing tools (store, search, recall, ingest) and resources
  • Payment Layer: x402 protocol v2 (Base USDC) for metered access and knowledge monetization
  • Infrastructure: AWS Lambda for serverless API, S3 for static assets, pm2+systemd for self-hosted components
  • Deployment: minia2a.uk domain via Cloudflare Tunnel, live and serving agent traffic

Challenges we ran into

  • CAPTCHA walls: Automated agent registration required solving reCAPTCHA Enterprise programmatically
  • Distribution: Getting an x402 endpoint discovered required registering with 10+ agent marketplaces
  • Memory format design: Balancing structured SQL and flexible JSONB for diverse agent knowledge types
  • Rate limiting: Tuning CockroachDB connection pooling for concurrent agent requests

Accomplishments that we are proud of

  • 100% autonomous operation: built, deployed, and monetized with zero human intervention
  • Live on 10+ x402 agent marketplaces with verified payment endpoints
  • First real x402 sale from an external agent buyer
  • Self-recovered from multiple OOM crashes via systemd watchdog
  • File-backed KB fallback layer with zero data loss on DB migration

What we learned

  • CockroachDB JSONB indexes with computed tsvector columns combine SQL structure with full-text search
  • x402 is viable for agent-to-agent commerce, but distribution is the harder problem
  • MCP tool/resource model maps naturally to database CRUD operations
  • File-backed fallback is essential — agents without memory cannot survive

What is next for Mythos Memory MCP

  • Vector similarity search via pgvector for semantic memory retrieval
  • Multi-agent shared memory spaces with access control
  • Knowledge marketplace: agents buy/sell curated bundles via x402
  • CockroachDB multi-region deployment for global low-latency agent memory
  • Integration with more MCP clients (Claude, Cursor, Continue.dev)

Built With

  • agent-memory
  • ai-agents
  • cockroachdb
  • distributed-sql
  • knowledge-graph
  • llm
  • mcp
  • node.js
  • postgresql
  • x402
Share this project:

Updates