Complete implementation: REST API, MCP server, and documentation
Implementation Summary:
- REST API with FastAPI (complete CRUD operations)
- MCP Server with Python MCP SDK (7 tools)
- Supabase migrations (pgvector setup)
- Docker Compose orchestration
- Mintlify documentation site
- Environment configuration
- Shared config module
REST API Features:
- POST /v1/memories/ - Add memory
- GET /v1/memories/search - Semantic search
- GET /v1/memories/{id} - Get memory
- GET /v1/memories/user/{user_id} - User memories
- PATCH /v1/memories/{id} - Update memory
- DELETE /v1/memories/{id} - Delete memory
- GET /v1/health - Health check
- GET /v1/stats - Statistics
- Bearer token authentication
- OpenAPI documentation
MCP Server Tools:
- add_memory - Add from messages
- search_memories - Semantic search
- get_memory - Retrieve by ID
- get_all_memories - List all
- update_memory - Update content
- delete_memory - Delete by ID
- delete_all_memories - Bulk delete
Infrastructure:
- Neo4j 5.26 with APOC/GDS
- Supabase pgvector integration
- Docker network: localai
- Health checks and monitoring
- Structured logging
Documentation:
- Introduction page
- Quickstart guide
- Architecture deep dive
- Mintlify configuration
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
259
docs/quickstart.mdx
Normal file
259
docs/quickstart.mdx
Normal file
@@ -0,0 +1,259 @@
|
||||
---
|
||||
title: 'Quickstart'
|
||||
description: 'Get T6 Mem0 v2 running in 5 minutes'
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before you begin, ensure you have:
|
||||
|
||||
- Docker and Docker Compose installed
|
||||
- Existing Supabase instance (PostgreSQL with pgvector)
|
||||
- OpenAI API key
|
||||
- Git access to the repository
|
||||
|
||||
<Check>
|
||||
**Ready to go?** Let's set up your memory system!
|
||||
</Check>
|
||||
|
||||
## Step 1: Clone Repository
|
||||
|
||||
```bash
|
||||
git clone https://git.colsys.tech/klas/t6_mem0_v2
|
||||
cd t6_mem0_v2
|
||||
```
|
||||
|
||||
## Step 2: Configure Environment
|
||||
|
||||
Create `.env` file from template:
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
Edit `.env` with your credentials:
|
||||
|
||||
```bash
|
||||
# OpenAI Configuration
|
||||
OPENAI_API_KEY=sk-your-openai-api-key-here
|
||||
|
||||
# Supabase Configuration (your existing instance)
|
||||
SUPABASE_CONNECTION_STRING=postgresql://supabase_admin:password@172.21.0.12:5432/postgres
|
||||
|
||||
# Neo4j Configuration
|
||||
NEO4J_PASSWORD=your-secure-neo4j-password
|
||||
|
||||
# API Configuration
|
||||
API_KEY=your-secure-api-key-here
|
||||
```
|
||||
|
||||
<Warning>
|
||||
**Important**: Replace all placeholder values with your actual credentials. Never commit the `.env` file to version control!
|
||||
</Warning>
|
||||
|
||||
## Step 3: Apply Database Migrations
|
||||
|
||||
Run the Supabase migration to set up the vector store:
|
||||
|
||||
### Option A: Using Supabase SQL Editor (Recommended)
|
||||
|
||||
1. Open your Supabase dashboard
|
||||
2. Navigate to **SQL Editor**
|
||||
3. Copy contents from `migrations/supabase/001_init_vector_store.sql`
|
||||
4. Paste and execute
|
||||
|
||||
### Option B: Using psql
|
||||
|
||||
```bash
|
||||
psql "$SUPABASE_CONNECTION_STRING" -f migrations/supabase/001_init_vector_store.sql
|
||||
```
|
||||
|
||||
<Tip>
|
||||
The migration creates tables, indexes, and functions needed for vector similarity search. See [Supabase Setup](/setup/supabase) for details.
|
||||
</Tip>
|
||||
|
||||
## Step 4: Start Services
|
||||
|
||||
Launch all services with Docker Compose:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
This starts:
|
||||
- **Neo4j** (ports 7474, 7687)
|
||||
- **REST API** (port 8080)
|
||||
- **MCP Server** (port 8765)
|
||||
|
||||
## Step 5: Verify Installation
|
||||
|
||||
Check service health:
|
||||
|
||||
```bash
|
||||
# Check API health
|
||||
curl http://localhost:8080/v1/health
|
||||
|
||||
# Expected response:
|
||||
# {
|
||||
# "status": "healthy",
|
||||
# "version": "0.1.0",
|
||||
# "dependencies": {
|
||||
# "mem0": "healthy"
|
||||
# }
|
||||
# }
|
||||
```
|
||||
|
||||
<Check>
|
||||
**Success!** All services are running. Let's try using the memory system.
|
||||
</Check>
|
||||
|
||||
## Step 6: Add Your First Memory
|
||||
|
||||
### Using REST API
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:8080/v1/memories/ \
|
||||
-H "Authorization: Bearer YOUR_API_KEY" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"messages": [
|
||||
{"role": "user", "content": "I love pizza with mushrooms and olives"}
|
||||
],
|
||||
"user_id": "alice"
|
||||
}'
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"memories": [
|
||||
{
|
||||
"id": "mem_abc123",
|
||||
"memory": "User loves pizza with mushrooms and olives",
|
||||
"user_id": "alice",
|
||||
"created_at": "2025-10-13T12:00:00Z"
|
||||
}
|
||||
],
|
||||
"message": "Successfully added 1 memory(ies)"
|
||||
}
|
||||
```
|
||||
|
||||
## Step 7: Search Memories
|
||||
|
||||
```bash
|
||||
curl -X GET "http://localhost:8080/v1/memories/search?query=What food does Alice like?&user_id=alice" \
|
||||
-H "Authorization: Bearer YOUR_API_KEY"
|
||||
```
|
||||
|
||||
### Response
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "success",
|
||||
"memories": [
|
||||
{
|
||||
"id": "mem_abc123",
|
||||
"memory": "User loves pizza with mushrooms and olives",
|
||||
"user_id": "alice",
|
||||
"score": 0.95,
|
||||
"created_at": "2025-10-13T12:00:00Z"
|
||||
}
|
||||
],
|
||||
"count": 1
|
||||
}
|
||||
```
|
||||
|
||||
<Success>
|
||||
**Congratulations!** Your memory system is working. The AI remembered Alice's food preferences and retrieved them semantically.
|
||||
</Success>
|
||||
|
||||
## Step 8: Explore Neo4j (Optional)
|
||||
|
||||
View memory relationships in Neo4j Browser:
|
||||
|
||||
1. Open http://localhost:7474 in your browser
|
||||
2. Login with:
|
||||
- **Username**: `neo4j`
|
||||
- **Password**: (from your `.env` NEO4J_PASSWORD)
|
||||
3. Run query:
|
||||
|
||||
```cypher
|
||||
MATCH (n) RETURN n LIMIT 25
|
||||
```
|
||||
|
||||
<Tip>
|
||||
Neo4j visualizes relationships between memories, entities, and concepts extracted by mem0.
|
||||
</Tip>
|
||||
|
||||
## Next Steps
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card
|
||||
title="Configure MCP Server"
|
||||
icon="plug"
|
||||
href="/mcp/installation"
|
||||
>
|
||||
Connect with Claude Code for AI assistant integration
|
||||
</Card>
|
||||
<Card
|
||||
title="API Reference"
|
||||
icon="book"
|
||||
href="/api-reference/introduction"
|
||||
>
|
||||
Explore all available endpoints
|
||||
</Card>
|
||||
<Card
|
||||
title="Architecture"
|
||||
icon="sitemap"
|
||||
href="/architecture"
|
||||
>
|
||||
Understand the system design
|
||||
</Card>
|
||||
<Card
|
||||
title="Examples"
|
||||
icon="code"
|
||||
href="/examples/n8n"
|
||||
>
|
||||
See integration examples
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Common Issues
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Connection to Supabase fails">
|
||||
- Verify `SUPABASE_CONNECTION_STRING` is correct
|
||||
- Ensure Supabase is accessible from Docker network
|
||||
- Check if pgvector extension is enabled
|
||||
- Run migration script if tables don't exist
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Neo4j won't start">
|
||||
- Check if ports 7474 and 7687 are available
|
||||
- Verify `NEO4J_PASSWORD` is set in `.env`
|
||||
- Check Docker logs: `docker logs t6-mem0-neo4j`
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="API returns authentication error">
|
||||
- Verify `API_KEY` in `.env` matches request header
|
||||
- Ensure Authorization header format: `Bearer YOUR_API_KEY`
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="OpenAI errors">
|
||||
- Check `OPENAI_API_KEY` is valid
|
||||
- Verify API key has sufficient credits
|
||||
- Check internet connectivity from containers
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
## Getting Help
|
||||
|
||||
- Review [Architecture documentation](/architecture)
|
||||
- Check [API Reference](/api-reference/introduction)
|
||||
- See [Setup guides](/setup/installation)
|
||||
|
||||
---
|
||||
|
||||
**Ready for production?** Continue to [Configuration](/setup/configuration) for advanced settings.
|
||||
Reference in New Issue
Block a user