Generated banner for membase
Generated logo for membase

membase

Memory serverOfficial Unibase project

Created by Unibase

Published in unibaseio/membase. Publisher page

139 GitHub stars

What it is

npm workspaces: @unibaseio/membase (typescript/), @unibaseio/membase-cli (cli/) and @unibaseio/membase-ai-sdk (integrations/ai-sdk/).
— the description by Unibase

AutoGineer overview, from the brain’s own files

Membase acts as a centralized memory layer for AI agents, allowing users to store facts, documents, and media in a single location that is accessible across various AI models and tools. By decoupling memory from specific AI providers, it ensures that knowledge is persistent and reusable, preventing the need to re-explain context when switching between different agents or platforms. Membase supports both a hosted service and a local execution mode, providing flexibility for data privacy and integration requirements. It features a robust CLI, Python and TypeScript SDKs, and an MCP server, enabling seamless connectivity with popular AI development environments like Claude Code, Cursor, and various agent frameworks.

How it works

Memory model: SQL database

AutoGineer overview, from the brain’s own files

Membase functions as a memory server that stores information in a structured format. Users can add data such as facts, documents, or media files through the CLI or SDK. This data is then indexed and made available to AI agents via an MCP server or API. The system manages memory isolation through project-specific contexts and supports both cloud-hosted storage and local storage options where the memory resides on the user's machine.

Folders
FolderRoleFiles
.githubagent-config1
assetsattachments11
docsdocs1
scriptsscripts3
teststests8
clifolder9
integrationsfolder130
membasefolder23
typescriptfolder12

Requirements

Runtimes: Node.js, Python >=3.10

Databases: PostgreSQL

API keys (by name): MEMBASE_API_KEY, OPENAI_API_KEY

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Google Antigravity, Kiro, OpenCode, Amp, Roo Code, Cline, JetBrains Junie, Devin (ex-Windsurf)

Set it up

  1. Add membase to .mcp.json:

    {
      "mcpServers": {
        "membase": {
          "type": "http",
          "url": "https://api.app.membase.com/mcp-http"
        }
      }
    }
    
  2. Or add it with the Claude Code CLI:

    claude mcp add --transport http membase https://api.app.membase.com/mcp-http
  3. Your data is sent to api.app.membase.com.

  4. Not scanned by AutoGineerIts dependencies are installed by pip or uv when you run it and were not scanned by AutoGineer (1 declared). https://pypi.org/project/unibaseio-membase/
  5. Created by Unibase. Published in unibaseio/membase. Licence: MIT License.

Usage

AutoGineer overview, from the brain’s own files

  • Integrate Membase into AI agent workflows to provide persistent long-term memory.
  • Use the CLI to import chat exports from various platforms into a unified knowledge base.
  • Connect AI coding assistants to Membase via MCP to maintain project-specific context.
  • Manage and query multi-modal data including text, documents, and media files.
  • Utilize the SDK to build custom agent integrations that read and write to the Membase memory layer.
“membase --local add "The project uses Postgres for the primary database."”
Stores the fact in the local memory instance for future retrieval by any connected AI agent.
“membase --local search "What database are we using?"”
Returns the relevant fact from the local memory store, providing the agent with accurate project context.

Documentation by Unibase

<p align="center"> <img src="https://raw.githubusercontent.com/unibaseio/membase/main/assets/membase-logo.png" width="72" alt="Membase"> </p>

<h1 align="center">Membase</h1>

<p align="center"> <b>One memory. Every AI. Only yours.</b><br> Teach it once. Every AI remembers. </p>

<p align="center"> <a href="https://pypi.org/project/unibaseio-membase/"><img src="https://img.shields.io/pypi/v/unibaseio-membase?label=pypi" alt="PyPI"></a> <a href="https://www.npmjs.com/package/@unibaseio/membase"><img src="https://img.shields.io/npm/v/@unibaseio/membase?label=npm" alt="npm"></a> <a href="https://github.com/unibaseio/membase/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT"></a> </p>

<p align="center"> <a href="https://membase.com">Website</a> · <a href="https://docs.membase.com">Docs</a> · <a href="https://app.membase.com">Web app</a> · <a href="https://discord.gg/nB9EfPGsSf">Discord</a> · <a href="https://x.com/Unibase_AI">X</a> </p>

<p align="center"> <img src="https://raw.githubusercontent.com/unibaseio/membase/main/assets/hero.svg" width="840" alt="Add sources, manage one memory, use it from every AI and app"> </p>

Membase is the memory layer for AI agents. It keeps one memory for everything you and your agents know, and every AI you use reads it. You stop re-explaining yourself each time you switch models or tools.

  • Add. Facts, documents, web pages and chat exports from Claude or ChatGPT go into one memory.

  • Manage. Memories keep projects apart; search them, ask them questions, forget what should go.

  • Use. Your code, Claude Code, Cursor, Codex and ChatGPT read the same memory through the SDK or MCP.

This repository is the developer side: Python and TypeScript clients, the membase command line and an MCP server. The memory lives in your Membase account, which the web app and browser extension also fill, or on your machine with unibaseio-membase[local].

Write once, read from any AI

<p align="center"> <img src="https://raw.githubusercontent.com/unibaseio/membase/main/assets/in-action.svg" width="840" alt="Your app writes a memory; any AI reads it, here Claude Code"> </p>

Recordings: Python SDK (57 s) · Claude Code (1 min 33 s). The answer above is illustrative.

Accuracy

<p align="center"> <img src="https://raw.githubusercontent.com/unibaseio/membase/main/assets/results.svg" width="840" alt="LoCoMo 93.1%, LongMemEval_S 92.6%, DMR 92.2%"> </p>

93.1% on LoCoMo, 92.6% on LongMemEval_S and 92.2% on DMR, using about 3× fewer tokens than the full history on LoCoMo and 11× fewer on LongMemEval_S. Method and results: membase.com/research

Quickstart

<p align="center"> <img src="https://raw.githubusercontent.com/unibaseio/membase/main/assets/architecture.svg" width="840" alt="Hosted, local in process, or local over HTTP"> </p>

pip install unibaseio-membase              # hosted · Python 3.10+ · needs MEMBASE_API_KEY
pip install 'unibaseio-membase[local]'     # local  · Python 3.12 or 3.13 · needs OPENAI_API_KEY
pip install 'unibaseio-membase[media]'     # local + photos, videos and audio
npm install @unibaseio/membase              # TypeScript · Node 18+
npm install -g @unibaseio/membase-cli       # the `membase` command (hosted) without Python
from membase import Membase

m = Membase()                    # hosted
# m = Membase(local=True)        # local, in ~/.membase

m.memories.add("We picked Postgres for the ledger service.")   # a fact
m.search("what database is the ledger on?")                    # {"items": [...], "partial": [...]}
m.add("Design notes …", custom_id="design-1")                   # a document
m.profile_facts.list()                                         # who the user is (Your profile ticked)
m.capabilities()                                               # what this key may do, and the rules

No call names a Memory: reads cover every Memory the key reaches, and writes land in its write target (a key that reaches several Memories and has none is refused with WriteTargetRequiredError). Ids are typed (mem_… a fact, doc_… a document, med_… a photo or video), lists are {items, has_more, partial}, and a removal without confirm=True raises ConfirmationRequiredError. Local memory answers the same routes with the same shapes.

Every method, its REST route and MCP tool, and the access it needs: SDK reference. Upgrading from 0.3: see the changelog. The Python package is unibaseio-membase (import membase); membase on PyPI is unrelated.

Command line

membase --local add "We picked Postgres for the ledger"
membase --local search "what did we pick for the ledger?"
membase --local memories list
membase --local ask "Which database is the ledger on?"
membase --local import ~/Downloads/claude-export.json     # Claude, ChatGPT, markdown or JSON chats
membase --local agent ingest trace.json --agent coder
membase --local agent search "fix flaky deploy" --agent coder
membase --local media add ~/Movies/trip.mp4                # shots, speech and speakers
membase --local media search "someone skiing"   # any language

Without --local (or --store DIR, both before the command) commands use the hosted API; agent, import and serve need unibaseio-membase[local], and media add and media ask (local only) need unibaseio-membase[media]: see Media memory. A local store with several Memories writes where MEMBASE_WRITE_TARGET names.

MCP

<p align="center"> <img src="https://raw.githubusercontent.com/unibaseio/membase/main/assets/mcp.svg" width="840" alt="MCP clients, hosted or local server, same tools"> </p>

claude mcp add membase -- membase --local mcp                                   # local
claude mcp add --transport http membase https://api.app.membase.com/mcp-http \
  --header "Authorization: Bearer $MEMBASE_API_KEY"                             # hosted

Hosted without the header, the connection signs you in and is read-only. Setup for Claude, ChatGPT, Cursor, Codex and other clients: Connect your AI.

Gemini CLI, as an extension (it signs you in on first use; /mcp auth membase signs in again):

gemini extensions install https://github.com/unibaseio/membase

Cline: add the server to cline_mcp_settings.json; llms-install.md has the entry, with and without a developer key.

Docs

License

MIT; see LICENSE. unibaseio-membase[local] also installs unibaseio-membase-core, the compiled engine, under its own Unibase license.

docs/reference.md

Membase local engine

pip install 'unibaseio-membase[local]' runs the memory on your machine. For the hosted API and the methods, see the Membase docs.

What the local engine stores

<p align="center"> <img src="../assets/memory-types.svg" width="840" alt="Conversations, documents and agent traces"> </p>

Local memory over HTTP

membase --local serve            # http://127.0.0.1:8787/v1

The hosted memory API's routes, answered by the local engine with the same requests, answers and refusals: point any client's base URL at it. Set MEMBASE_LOCAL_TOKEN to require it as a bearer token.

  • Reads cover every Memory (container) in the store. Writes land in its write target: the one MEMBASE_WRITE_TARGET names (made if missing), else the store's only Memory, else a new default one. A store with several Memories and no MEMBASE_WRITE_TARGET refuses a write with 422 write_target_required, as the hosted API refuses a key that reaches several.

  • Ids are typed (mem_…, doc_…, med_…); lists are {items, has_more, partial}; unknown fields (a container, say) are a 422; a removal without confirm=true is a 428.

  • The engine learns before it answers, so a write's receipt and every document say status: "succeeded". A fact added with POST /v1/memories/add is kept as a note (a document of kind note) whose deletion forgets what it taught, as hosted.

  • /v1/capabilities names every action (the media ones with the media extra installed); local memory has no standing rules, so rules is empty.

  • Profile facts (/v1/profile-facts) live in the store's profile, apart from every Memory. A statement added locally is user_stated; one kept with add --static before 0.4 reads as imported.

Where local memory differs: /v1/ask is open to every caller (hosted, only a credential granted it may ask) and reads one Memory, the one whose facts match best.

Local settings

Stores: ~/.membase/memory.db (the default Memory), ~/.membase/containers/<id>/ (others), ~/.membase/profile/ (profile facts). Settings come from the environment, or from a .env file in the current directory or a parent.

SettingDefault
OPENAI_API_KEYchat and embeddings
MEMBASE_LLM_PROVIDERfrom your keysopenai, anthropic, ollama or openai-compat for chat; set the models below to match
MEMBASE_LLM_ENDPOINTbase URL for ollama or openai-compat
MEMBASE_EMBED_PROVIDERopenaiopenai-compat uses MEMBASE_LLM_ENDPOINT
MEMBASE_EMBED_MODELtext-embedding-3-smallembeddings
MEMBASE_EPISODE_MODELgpt-4.1-miniconversations into episodes
MEMBASE_DECIDER_MODELgpt-4o-minipicks the episodes a search returns
MEMBASE_READER_MODELgpt-4oask answers
MEMBASE_KNOWLEDGE_MODELgpt-4o-minidocuments into topic trees
MEMBASE_AGENT_MODELgpt-4o-miniagent traces
MEMBASE_LANGenzh for Chinese extraction prompts

MEMBASE_LOCAL=1 makes local the default when MEMBASE_API_KEY is not set. MEMBASE_WRITE_TARGET names the Memory writes go to (see above).

Media memory

pip install 'unibaseio-membase[media]' adds photos, videos and audio recordings, kept apart from documents and memories: they have their own routes, search and ask, and /v1/search and /v1/ask do not read them. Listing, reading, searching and deleting are the hosted media routes; storing a file and asking are local only (in process, or membase serve). It needs only a model provider key: no local model is downloaded.

An image becomes a caption. A video is cut into shots (caption, time span, thumbnail each) and its sound track into speaker turns matched to the person on screen; an audio file into speaker turns. Search runs in any language over captions and speech.

RoutePythonMCP toolCommand line
POST /v1/media/add {path | url, title?, custom_id?} (local only)m.media.add(path, url=)add_mediamedia add FILE | --url
GET /v1/media?limit=m.media.list()list_mediamedia list
GET /v1/media/{id}m.media.get(id)get_mediamedia get ID
POST /v1/media/{id}/delete?confirm=m.media.delete(id, confirm=)delete_mediamedia delete ID [--confirm]
POST /v1/media/search {q, kind?, limit?}m.media.search(q, kind=)search_mediamedia search Q [--kind]
GET /v1/media/{id}/file, …/thumbs/{name} (Range answers 206)m.media.file(id, thumb=, range=) (TS media.file(id, {thumb, range}))— (REST only)—
POST /v1/media/ask {message} (local only)m.media.ask(message)ask_mediamedia ask MESSAGE
GET /v1/media/{id}/file, /thumbs/{name}

path is a file on the machine running the engine; the item lands in the write target. Items and moments name their file and thumbnails as routes (file_url, thumb_url), which answer a Range with 206. add returns the stored item once it is processed, which takes minutes for a long video. kind is image or video hosted; local memory also has audio and text. ask reads the Memory whose media match best. membase mcp offers the hosted media tools (list, get, search, delete) over hosted memory and over local memory with the extra installed; add_media and ask_media only locally.

SettingDefault
MEMBASE_MEDIA_CAPTION_MODELgpt-4o-miniimage and shot captions
MEMBASE_MEDIA_SUMMARY_MODELgpt-4o-minivideo and recording summaries
MEMBASE_MEDIA_RERANK_MODELgpt-4o-miniquery translation, grading search results
MEMBASE_MEDIA_ASK_MODELgpt-4.1media ask answers
MEMBASE_MEDIA_SPEAKER_MODELgpt-4.1matching voices to people on screen
MEMBASE_MEDIA_TRANSCRIBE_MODELgpt-4o-transcribe-diarizespeech with speakers

Captions and transcription need an OpenAI-compatible API (OPENAI_API_KEY, or openai-compat with MEMBASE_LLM_ENDPOINT); the rest uses the chat and embedding providers above.

Repository

membase/ is the Python package (client.py, cli.py, local/ for local memory and membase serve, mcp/ for membase mcp, media/ for media memory, which the rest only mounts); typescript/ is the npm package @unibaseio/membase and cli/ the npm package @unibaseio/membase-cli. membase-ai and membase-sdk (PyPI and npm) are earlier names.

210 files · 192 not served here

Advantages

  • Provides a unified memory source that works across different AI models and tools, eliminating redundant context setup. evidence: README.md
  • Supports both hosted and local-first deployment options to accommodate different privacy and infrastructure needs. evidence: README.md

Limitations

  • Local memory features require specific Python versions (3.12 or 3.13) and additional dependencies. evidence: pyproject.toml
  • Operations involving multiple memories require an explicit write target to be defined to avoid errors. evidence: README.md

Security

Risk level: No risk found

This brain runs

MCP servers (1)

  • gemini-extension.json (membase): https://api.app.membase.com/mcp-http · uses the network

Attribution and licence

Created by
Unibase
Declared authors
  • Unibase (declared in pyproject.toml)
Publisher
Unibase (Official Unibase project)
Source
unibaseio/membase · commit 5910023
Licence
MIT License (files served here)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Unibase.

Install from source

192 of its files are not served here, so there is no ZIP. unibaseio/membase at 5910023