Membrane
by HarshitR2004
README.md
<div align="center">
<img src="assets/logo.png" alt="Membrane Logo" width="200" />
</div>
# ๐ Membrane - Universal Memory Layer for AI Agents
**Python | FastAPI | Next.js | SUI | Walrus | MCP**
The decentralized, verifiable knowledge infrastructure for autonomous agents.
## ๐ Overview
Membrane is a comprehensive platform that provides persistent, verifiable, and shareable memory for AI agents through the Model Context Protocol (MCP). Built on the SUI blockchain for immutable cryptographic state and the Walrus protocol for decentralized blob storage.
> ๐ *[Try it here](https://membrane-pearl.vercel.app/)*
## ๐ธ Screenshots
| Dashboard | Memories | Auth |
|:---:|:---:|:---:|
|  |  |  |
## ๐๏ธ Architecture
```text
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Membrane Platform โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โ โ Frontend โ โ Multi-tenant โ โ
โ โ Dashboard โ โ MCP Server โ โ
โ โ โ โ โ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โ โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโ โผโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ SUI Blockchain โ โ
โ โ โข Cryptographic Proofs โ โ
โ โ โข Tamper Detection โ โ
โ โ โข Memory Provenance โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ Walrus Protocol โ โ
โ โ โข Decentralized Storage โ โ
โ โ โข Memory Payloads & Artifacts โ โ
โ โ โข Blob Management โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
## ๐ On-Chain Integration & Verifiability
Membrane leverages the Sui blockchain to create an immutable, verifiable record of agent memory.
**What exactly gets anchored on Sui?**
- **Memory Hash:** A cryptographic hash of the memory payload ensuring data integrity.
- **Metadata:** Contextual information about the memory (e.g., source, tags, agent ID).
- **Walrus Blob ID:** The decentralized storage identifier pointing to the actual memory payload stored on Walrus.
- **Timestamp:** An immutable record of when the memory was created or modified.
**Why does this matter?**
Anchoring this data on-chain guarantees **Memory Provenance** and **Tamper Detection**. AI agents and human users can mathematically verify that a piece of information existed at a specific time and has not been secretly altered. This is crucial for high-stakes agentic workflows where trust, auditability, and shared context are required.
## ๐ฆ Project Structure
```text
membrane/
โโโ src/membrane/ # ๐ Multi-tenant MCP API Server
โ โโโ api/ # REST endpoints
โ โโโ server.py # FastMCP implementation
โ โโโ memory_manager.py # Memory coordination
โ โโโ retrieval.py # Hybrid search engine
โ
โโโ frontend/ # ๐จ Agent Control Dashboard
โ โโโ app/ # Next.js application
โ โโโ lib/ # API clients & configuration
โ โโโ public/ # Static assets
โ
โโโ tests/ # ๐ง Integration & Unit Tests
โโโ test_api.py # API test suite
โโโ test_connect.py # Walrus/Sui connection tests
```
## ๐ Quick Start
### Prerequisites
- Python 3.11+
- Node.js 18+
- npm 8+
- SUI Wallet with testnet tokens
### 1. Frontend Dashboard (Control Center)
```bash
# Navigate to frontend
cd frontend
# Install dependencies
npm install
# Start development server
npm run dev
# Open http://localhost:3000
```
### 2. Multi-tenant MCP Server
```bash
# Navigate to project root
cd membrane
# Set up virtual environment
python -m venv .venv
source .venv/Scripts/activate # Windows
# source .venv/bin/activate # Mac/Linux
# Install backend dependencies
pip install -e .
# Start ASGI application
uvicorn membrane.app:create_asgi_app --factory --reload --port 8000
# Server available at http://localhost:8000
```
## ๐ง Environment Setup
### API Server (.env)
```env
# Database
DATABASE_URL="postgresql://user:pass@localhost:5432/membrane"
# Security
ENCRYPTION_KEY="your-secure-32-byte-key"
# Walrus Storage (REQUIRED)
WALRUS_PUBLISHER_URL="https://walrus-testnet-publisher.natsai.xyz"
WALRUS_AGGREGATOR_URL="https://walrus-testnet-aggregator.natsai.xyz"
# SUI Configuration (REQUIRED)
SUI_RPC_URL="https://fullnode.testnet.sui.io:443"
SUI_WALLET_ADDRESS="your-sui-wallet-address"
SUI_PRIVATE_KEY="your-sui-private-key"
```
### Frontend (.env.local)
```env
NEXT_PUBLIC_API_URL=http://localhost:8000/api
```
## ๐ Deployment
### Quick Deploy Options
**Frontend Dashboard**
- Vercel (Recommended): `cd frontend && vercel`
- Netlify: `cd frontend && npx netlify deploy --prod`
**Enterprise API Server**
- Render: Connect repository and deploy as ASGI web service
- Docker: `docker build -t membrane-api .`
- Railway: `railway up`
## ๐ฏ Features
### Frontend Dashboard
- โ
Identity Provisioning - Claim Membrane IDs
- โ
API Key Management - Generate and rotate keys
- โ
Telemetry - Real-time metrics and system overview
- โ
SUI Integration - Dapp kit wallet connection
- โ
Configuration Export - Instant MCP manifest generation
### MCP Server / API
- โ
14 MCP Tools - Complete memory orchestration
- โ
Hybrid Search - Metadata + Semantic retrieval (FastEmbed)
- โ
Multi-Tenant - Isolated namespaces and keys
- โ
REST API - System orchestration and metrics
- โ
Artifact Storage - Image, PDF, and text blobs
### Backend Services
- โ
FastMCP Integration - Standardized context protocol
- โ
PostgreSQL Indexing - Ultra-fast metadata lookups
- โ
Walrus Blob Storage - Unlimited payload size
- โ
SUI Verification - Immutable state proofs
## ๐ Security Features
- 100% Real Blockchain - Immutable state records and transaction references
- API Key Authentication - Secure access to namespaces
- Cryptographic Verification - SHA256 + HMAC validation
- AES-CBC Encryption - Secure sensitive memory payloads
- PostgreSQL Isolation - Multi-tenant RLS and namespace boundaries
## ๐ Documentation
- **API Docs:** Available at `http://localhost:8000/docs` when server is running.
- **MCP Protocol:** Refer to the Model Context Protocol official specification.
## ๐งช Testing
### Backend Integration
```bash
# Run the test suite
pytest tests/
```
### Frontend
```bash
cd frontend
npm run lint
npm run build
```
## ๐ฏ Use Cases
### AI Agents & Assistants
- **Long-Term Memory** - Agents that remember past conversations
- **Shared Context** - Multiple agents collaborating on the same project
- **Verifiable Truth** - Audit trails for agent decision making
### Enterprise Applications
- **Knowledge Graphs** - Semantic relationship tracking
- **Agent Orchestration** - Managing state across distributed workers
- **Compliance** - Immutable records of automated actions
## ๐ Performance
- **Speed:** Sub-100ms semantic search execution
- **Efficiency:** CPU-optimized (no GPU required)
- **Verification:** On-chain Walrus blobs via SUI
## ๐ค Contributing
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
## ๐ Support
- **Issues:** Use GitHub Issues for bug reports
- **Discussions:** Use GitHub Discussions for questions
## ๐ Status
Membrane is ready for deployment with active SUI blockchain integration and Walrus storage.
Built with โค๏ธ by the Membrane Team
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo issues