Skip to main content
Glama
Personal Memory MCP Server

Personal Memory MCP Server

by yoshi507
README.md
# Personal Memory MCP Server

A private, persistent memory store that AI assistants can read and update through the Model Context Protocol (MCP).

> **You must host your own copy.** This repo is shared as source code only. Nobody hosts it for you. To use it, you deploy your own instance (Vercel, or any Node.js host you run yourself), with your own storage and your own `MEMORY_TOKEN`. Don't use anyone else's deployment, and don't share your token.

## What you need

- A GitHub account (to fork or import this repo)
- A free Vercel account, or your own server running Node.js 20+
- A Redis-compatible store. On Vercel, add an Upstash Redis database from the Storage tab (the free plan is enough for personal use).

## Deploy on Vercel

1. **Fork or import the repo**: fork it on GitHub, then go to [vercel.com/new](https://vercel.com/new) and import your fork.
2. **Add a database**: in the project, open the **Storage** tab and create an **Upstash Redis** (or KV) database. Connect it to the project for Production, Preview, and Development.
3. **Set your token**: Project Settings → Environment Variables → add `MEMORY_TOKEN` with a long random value (e.g. `openssl rand -hex 32`). Keep it secret. Anyone with this token can read and write your memory.
4. **Turn off Deployment Protection** for this project (Settings → Deployment Protection), so MCP clients can reach `/api/mcp`. The token is what protects your data.
5. **Deploy** (redeploy after changing environment variables).

## Self-hosting

Any host that runs Next.js and can reach a Redis-compatible database will work. Set `MEMORY_TOKEN` and the database connection variables, then run `npm install`, `npm run build`, and `npm start`. Put it behind HTTPS, since MCP clients require it.

## MCP endpoint

```
https://<your-deployment>/api/mcp
```

Every request must include:

```
Authorization: Bearer <your-MEMORY_TOKEN>
```

To connect a client such as Composio, add a custom MCP server with that URL, use the API key option with header name `Authorization` and prefix `Bearer`, and paste your token.

## Tools

| Tool | Purpose |
|------|---------|
| `get_profile` | Return all current facts, newest first |
| `search_memory` | Case-insensitive search over current facts |
| `add_memory` | Create a new fact |
| `update_memory` | Create a new fact and mark the old one superseded |

When a fact is updated, the old version is kept for 4 hours and then removed automatically.

## Security notes

- Your memory data lives only in your own database. This repo contains no data and no secrets.
- Never commit `.env` files or tokens. `.gitignore` excludes common secret files, but check before you push.
- Treat the token like a password, and rotate it if it leaks.

## License

MIT. See [LICENSE](./LICENSE). You can use, copy, modify, and redistribute this code for any purpose, including commercial use, as long as the copyright notice is kept.