memhub
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@memhubwhat do you remember about me and my current projects?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
memshare
English | 简体中文
One shared memory about you, for all of your AI assistants.
The repository is called memshare; the server, CLI and MCP connection are named
memhub.
If you split your work across AI assistants — Claude Code for coding, Gemini for everyday questions, ChatGPT for research, Grok for social posts — you have probably noticed they don't know each other. The goals, habits and project updates you told one of them are unknown to the next, so you keep repeating yourself.
memhub is a self-hosted remote MCP server that keeps the long-lived facts about you in plain Markdown, readable and writable by any MCP-capable assistant. Think of it as a filing cabinet shared by all your assistants: every line records who wrote it and when.
Claude / ChatGPT / Gemini / Grok (OAuth) Claude Code / Gemini CLI / Codex (static token)
\ /
└──── HTTPS /mcp (Streamable HTTP) ─┘
│
memhub (this repo)
auth → per-identity permissions → 7 MCP tools
│
Markdown files (single source of truth, one git commit per write)
SQLite FTS5 index (rebuildable from files, Chinese word segmentation)Features
Markdown is the single source of truth. One fact per line, easy for humans to read and edit. Every write is a
git commit, and an hourly timer can push the memory to your own private GitHub repo as a backup.Traceable sources. The
[gemini · 2026-10-13]suffix on each line is appended by the server from the authenticated identity; models cannot forge it.A small tool set designed for models. Fewer tools means every vendor's model uses them correctly. Tool descriptions are the prompt: they say when to call and when not to.
Rules enforced server-side. Duplicate check before writing (near matches come back as candidates so the model uses
updateinstead); explicit confirmation to writeprofile.md; 16 KB per-file limit; regex blocking of ID numbers, card numbers, passwords and API keys.Per-identity authorization. Chat apps use OAuth 2.1 (DCR + PKCE); CLIs use static bearer tokens. Which paths each identity may read or write is set with globs in
clients.yaml.Daily conversation journal. Assistants append each finished topic — what you asked, where you got stuck — to one shared file per day, so you can ask an AI to review it with you the next morning.
No external services at runtime. No LLM API calls, no CDN, no remote fonts, no downloads.
Related MCP server: stafett
The seven tools
Tool | Purpose |
| Call first in every new conversation. Returns profile and preferences facts plus a |
| Full-text search over facts (also matches file descriptions and aliases), with Chinese word segmentation |
| Full file content plus a |
| Append a long-lived fact the user explicitly stated; near duplicates return candidates instead of writing |
| Replace exactly one existing fact, with optimistic concurrency via |
| Delete one fact line (never a whole file) |
| Append "what was asked, where it got stuck, what was decided" for a finished topic to |
What the memory looks like
memory/
├── profile.md identity and long-term goals (writes need confirmation)
├── preferences.md how you like answers, long-term preferences
├── _inbox.md facts not yet filed
├── topics/fitness.md topics: fitness, investing, tech…
├── areas/project-x.md projects
├── people/friend.md facts about other people (the subject is always named)
└── journal/2026-10-17.md daily conversation journal (append-only)---
name: fitness
description: Training, weight and diet habits
aliases: [workout, gym]
updated: '2026-10-13'
---
- Runs three times a week [claude-code · 2026-10-13]
- Currently on a muscle-gain program, target weight 70 kg [gemini · 2026-10-14]Quick start (local)
Requires Python 3.12, uv and Git. Every command takes an explicit config file; relative paths resolve against that file's directory, and missing keys are errors — there are no implicit defaults.
git clone https://github.com/gaw008/memshare.git && cd memshare
uv sync --locked
# Generate random tokens for the two CLI identities (only if .env does not exist yet):
uv run python - <<'PY'
import json, secrets
from pathlib import Path
p = Path('.env')
with p.open('x', encoding='utf-8') as f:
f.write("STATIC_TOKENS='" + json.dumps({secrets.token_urlsafe(48): app for app in ('claude-code', 'gemini-cli')}) + "'\n")
p.chmod(0o600)
PY
uv run memhub --config memhub.toml init # create the separate memory git repo (./dev-memory)
uv run memhub --config memhub.toml set-password # set the OAuth login password (argon2 hash stored in .env)
uv run memhub --config memhub.toml serve # listens on 127.0.0.1:8787Connect Claude Code locally (use the token mapped to claude-code in .env):
claude mcp add --transport http --scope user memhub \
http://127.0.0.1:8787/mcp --header 'Authorization: Bearer <claude-code-token>'Then start a new session and say "call memhub's get_context first".
Deploy publicly and connect chat apps
Chat apps such as ChatGPT, Claude (web and mobile), Gemini and Grok can only reach a public HTTPS URL.
Deploy. See docs/DEPLOY.md. The reference setup is one Ubuntu server with systemd and a Cloudflare Tunnel (no open inbound ports), with install and update scripts and an hourly backup timer. First replace
mem.example.comandYOUR_GITHUB_USERinmemhub.prod.tomlwith your own values.Connect each app. See docs/CLIENTS.md for Claude, ChatGPT, Gemini, Grok, Claude Code and Gemini CLI. During OAuth, chat apps land on memhub's login page: enter your password and pick "which app is this" — that choice fixes the connection's identity and permissions.
Add custom instructions to each assistant (see the template below). Not every vendor honors MCP initialize instructions, so custom instructions are the reliable path.
I use a personal memory server called memhub (MCP tools). Rules:
1. At the start of every new conversation, call get_context before answering.
2. For questions about my personal situation (health, projects, family, preferences), search first.
3. When I state a new long-lived fact (goal, habit, decision, project progress, something about a person), call remember; if an existing fact changed, use update.
4. Do not store small talk, your guesses, or your advice (unless I explicitly adopt it).
5. Ask me before writing to profile.
6. When a topic wraps up, call log with one line: what I asked, where I got stuck or what I decided.After a new tool is added to memhub, some chat apps keep using a cached tool list. Refresh or reconnect the connector in that app's settings and start a new conversation.
Configuration
File | Contents |
| Dev / production parameters: directories, port, timezone (decides which day a journal entry belongs to), file limit, context token budget, rate limit, allowed hosts, sensitive-data regexes, and more |
| Secrets: CLI static tokens and the OAuth password hash. Never committed; see |
| Path globs each identity may read and write. By default every identity can read and write everything |
Authorization management and bulk import:
uv run memhub --config memhub.toml clients list
uv run memhub --config memhub.toml clients revoke '<client_id>'
uv run memhub --config memhub.toml import --source gemini \
--path topics/fitness.md --description 'Fitness and training' facts.txtEach non-empty line of the import file is one fact, and goes through the same permission, sensitive-data and duplicate checks as remember. profile.md cannot be imported.
Security and limits
The access log records only time, identity, tool name and paths — never fact contents, search queries or tokens.
Per-token rate limiting (60 requests per minute by default); excess requests get HTTP 429.
Sensitive-data blocking only covers the regex patterns in the config. It is not a vault; don't store secrets here.
An identity is the app label the user picks and binds at login. It does not authenticate that the vendor's client is genuine.
Single-process write lock plus atomic file replacement; there is no transaction handling for multiple processes or concurrent external edits. After editing Markdown by hand, restart the service to rebuild the index.
The OAuth database and
.envare credential state and are not part of the Markdown backup; back up your server state yourself.Vendor support as of 2026-10: Claude and ChatGPT let you choose DCR; Gemini's consumer app officially supports DCR but has region, language and account-type restrictions; Grok has not published full OAuth registration details, so verify compatibility yourself. See docs/AUTH-RESEARCH.md.
Development
uv run pytest -q
# After dependency changes, export requirements.txt for the server:
uv export --no-hashes --no-dev --no-emit-project --output-file requirements.txtTests keep their temporary files and memory repos in .test-tmp/ and never touch real memory. Stack: Python 3.12, the official MCP Python SDK (Streamable HTTP at /mcp, health check at /healthz), SQLite FTS5, jieba.
License
This server cannot be deployed
Maintenance
Related MCP Connectors
One memory, every AI. A shared, user-owned markdown memory your AI clients read and write over MCP.
- mcpOAuthai.butlerbrain
Persistent memory for AI assistants. Save once; recall from Claude, ChatGPT, or any MCP client.
Persistent AI memory shared across Claude, ChatGPT, coding agents, and compatible MCP clients.
Persistent, portable memory for AI assistants — your private memory graph, from any MCP client.
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceAn MCP server that enables multiple AI models (Claude, ChatGPT, Gemini) to share and persist context via a local-first vault of markdown files and SQLite index, allowing seamless cross-AI memory.-
- FlicenseNot gradedqualityCmaintenanceA remote MCP server that gives AI assistants a shared memory, enabling structured handoffs, journaling, and notes for seamless continuation across sessions.-
- AlicenseAqualityDmaintenanceA personal memory engine and MCP server that stores durable facts in markdown files managed via git, enabling hybrid search (lexical + semantic) through an MCP interface for persistent context across LLM sessions.31MIT
- AlicenseAqualityBmaintenancePersistent memory server for MCP clients that lets AI assistants remember facts about users across sessions via a single markdown file, with tools to read, save, search, update, delete, and organize memory.10MIT