Metadata-Version: 2.4
Name: better-mem0-mcp
Version: 1.1.6
Summary: Zero-setup MCP Server for AI memory - works with Neon/Supabase
Project-URL: Homepage, https://github.com/n24q02m/better-mem0-mcp
Project-URL: Repository, https://github.com/n24q02m/better-mem0-mcp.git
Project-URL: Issues, https://github.com/n24q02m/better-mem0-mcp/issues
Author-email: n24q02m <quangminh2422004@gmail.com>
License: MIT
License-File: LICENSE
Keywords: ai-agent,llm,mcp,mem0,memory,pgvector
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.13
Requires-Dist: google-genai>=1.0.0
Requires-Dist: litellm>=1.0.0
Requires-Dist: loguru>=0.7.0
Requires-Dist: mcp[cli]>=1.0.0
Requires-Dist: mem0ai>=0.1.0
Requires-Dist: psycopg[binary,pool]>=3.1.0
Requires-Dist: pydantic-settings>=2.0.0
Description-Content-Type: text/markdown

# better-mem0-mcp

**Self-hosted MCP Server for AI memory with PostgreSQL (pgvector).**

[![PyPI](https://img.shields.io/pypi/v/better-mem0-mcp)](https://pypi.org/project/better-mem0-mcp/)
[![Docker](https://img.shields.io/docker/v/n24q02m/better-mem0-mcp?label=docker)](https://hub.docker.com/r/n24q02m/better-mem0-mcp)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

## Features

- **Self-hosted PostgreSQL** - Your data stays with you (Neon/Supabase free tier supported)
- **Graph Memory** - SQL-based relationship tracking alongside vector memory
- **Multi-provider LLM** - Gemini, OpenAI, Anthropic, Groq, DeepSeek, Mistral
- **Fallback chains** - Multi-key per provider + multi-model fallback
- **Zero manual setup** - Just `DATABASE_URL` + `API_KEYS`

---

## Quick Start

### 1. Get Prerequisites

- **Database**: [Neon](https://neon.tech) or [Supabase](https://supabase.com) (free tier works)
- **API Key**: Any supported provider ([Google AI Studio](https://aistudio.google.com/apikey) is free)

### 2. Add to mcp.json

#### uvx (Recommended)

```json
{
  "mcpServers": {
    "better-mem0": {
      "command": "uvx",
      "args": ["better-mem0-mcp@latest"],
      "env": {
        "DATABASE_URL": "postgresql://user:pass@xxx.neon.tech/neondb?sslmode=require",
        "API_KEYS": "gemini:AIza..."
      }
    }
  }
}
```

#### Docker

```json
{
  "mcpServers": {
    "better-mem0": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-e", "DATABASE_URL", "-e", "API_KEYS", "n24q02m/better-mem0-mcp:latest"],
      "env": {
        "DATABASE_URL": "postgresql://...",
        "API_KEYS": "gemini:AIza..."
      }
    }
  }
}
```

### 3. Done!

Ask your AI: "Remember that I prefer dark mode and use FastAPI"

---

## Configuration

| Variable | Required | Description |
|----------|----------|-------------|
| `DATABASE_URL` | Yes | PostgreSQL with pgvector extension |
| `API_KEYS` | Yes | `provider:key` pairs, comma-separated |
| `LLM_MODELS` | No | Model fallback chain |
| `EMBEDDER_MODELS` | No | Embedding model chain |

### Supported Providers

`gemini`, `openai`, `anthropic`, `groq`, `deepseek`, `mistral`

### Examples

**Single provider:**
```bash
API_KEYS=gemini:AIza...
```

**Multi-key with fallback:**
```bash
API_KEYS=gemini:AIza-1,gemini:AIza-2,openai:sk-xxx
LLM_MODELS=gemini/gemini-3-flash-preview,openai/gpt-4o-mini
EMBEDDER_MODELS=gemini/gemini-embedding-001,openai/text-embedding-3-small
```

### Defaults

| Setting | Default |
|---------|---------|
| `LLM_MODELS` | `gemini/gemini-3-flash-preview` |
| `EMBEDDER_MODELS` | `gemini/gemini-embedding-001` |

---

## Tools

| Tool | Description |
|------|-------------|
| `memory` | Memory operations: `add`, `search`, `list`, `delete` |
| `help` | Get full documentation for tools |

### Usage Examples

```json
{"action": "add", "content": "I prefer TypeScript over JavaScript"}
{"action": "search", "query": "programming preferences"}
{"action": "list"}
{"action": "delete", "memory_id": "abc123"}
```

---

## Build from Source

```bash
git clone https://github.com/n24q02m/better-mem0-mcp
cd better-mem0-mcp

# Setup (requires mise: https://mise.jdx.dev/)
mise run setup

# Run
uv run better-mem0-mcp
```

**Requirements:** Python 3.13+

---

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md)

## License

MIT - See [LICENSE](LICENSE)
