Skip to main content
Glama
amoghsamadhiya779-afk

Memory Context MCP Server

README.md
# Memory Context MCP Server

[![GitHub Repo](https://img.shields.io/badge/GitHub-MCP--SERVER-blue?logo=github)](https://github.com/amoghsamadhiya779-afk/MCP-SERVER)
[![Python 3.12+](https://img.shields.io/badge/Python-3.12+-3776AB?logo=python&logoColor=white)](https://python.org)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)

A **Model Context Protocol (MCP)** server that gives LLMs persistent, semantic memory using vector search.

Built with **Python**, **ChromaDB**, and the official **MCP SDK**, this server allows AI models to store, search, update, and delete knowledge — and recall it across sessions using cosine-similarity vector search, not just keyword matching.

---

## Features

- **Vector Search** — Semantic similarity search powered by `sentence-transformers` (runs 100% locally).
- **MCP Protocol** — Exposes `store_memory`, `search_memory`, `update_memory`, `delete_memory` as MCP tools.
- **MCP Prompts** — Slash-command style prompts (`recall_topic`, `memory_summary`, `recall_session`) for compatible LLM clients.
- **Interactive CLI** — A polished terminal interface with `/commands` for manual database management.
- **Namespace Isolation** — Memories are grouped by namespace to prevent cross-project leakage.
- **Security** — Size limits, tag validation, and local-only storage.

---

## Quick Start

### 1. Install Dependencies

```bash
pip install -r requirements.txt
```

### 2. Launch the CLI

```bash
python main.py
```

### 3. Launch as MCP Server (for LLM Clients)

```bash
python main.py --serve
```

---

## CLI Commands

| Command              | Description                                |
|----------------------|--------------------------------------------|
| `/start`             | Launch the MCP stdio server                |
| `/add <text>`        | Store a memory (supports `--tags t1,t2`)   |
| `/search <query>`    | Semantic search across memories            |
| `/stats`             | View database statistics                   |
| `/list`              | List recent memories                       |
| `/delete <id>`       | Delete a memory by its ID                  |
| `/clear`             | Wipe all memories (with confirmation)      |
| `/namespace <name>`  | Set the active namespace                   |
| `/help`              | Show help                                  |
| `/exit`              | Exit the CLI                               |

---

## MCP Client Configuration (Claude Desktop)

Add this to your Claude Desktop `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "memory-context-server": {
      "command": "python",
      "args": ["main.py", "--serve"],
      "cwd": "/path/to/MCP - SERVER"
    }
  }
}
```

---

## Architecture

```
MCP - SERVER/
├── main.py                 # Entry point (CLI or --serve)
├── requirements.txt        # Python dependencies
├── .gitignore
├── README.md
├── chroma_data/            # ChromaDB persistent storage (auto-created)
└── src/
    ├── __init__.py
    ├── config.py           # Constants and security limits
    ├── db.py               # ChromaDB vector database layer
    ├── mcp_server.py       # MCP tools & prompts
    └── cli.py              # Interactive terminal CLI
```

---

## License

MIT