Retainer
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Retainer
Open-source memory for AI agents that work with customer relationships.
Retainer keeps a living record of every person, company and deal a business works with. Agents read conversations with their own models and write what matters: typed fields, plain-language facts and a log of events, each linked to who wrote it and where it came from. Agents read it back through MCP or a REST API.
The optional web app lets people review agent proposals, browse records with provenance, edit fields, and retract facts and events.
Schema as data: objects and fields are stored as rows, so a workspace, or an agent working in it, can add fields and objects at runtime.
Agent-written memory: Retainer never calls a language model. It validates writes, resolves conflicts between agents and people, keeps history and makes it searchable.
Self-hosted: one Docker image and Postgres.
Status: 0.1.0, the first release, is not yet published to npm or GitHub Container Registry; see the changelog. Guides are in docs/; the design is in ARCHITECTURE.md.
Run it
docker compose -f docker/compose.yml up --build
curl localhost:8787/healthOn first boot the server creates a default workspace and prints an admin
API key once. Manage workspaces and keys with the operator CLI, which talks
to the database directly:
docker compose -f docker/compose.yml exec retainer retainer workspace create --name "Acme Clinic" --template clinic
docker compose -f docker/compose.yml exec retainer retainer key create --workspace acme-clinic \
--name "Front-desk agent" --actor agent:front-desk --scopes read,write,schema:writeSend the key as Authorization: Bearer <key> to the REST API under /v1.
To erase a person on request (POST /v1/records/:id/forget), set
RETAINER_SUPPRESSION_KEY to a long random secret (at least 32 characters)
and keep it stable: erased emails and phones are stored only as an HMAC under
this key, so a new key lets them back in. openssl rand -hex 32 makes one.
The consolidator runs per workspace every RETAINER_CONSOLIDATE_INTERVAL_MINUTES
(default 60).
Related MCP server: Agent Memory
Open the web app
The Docker image serves the app at localhost:8787/app. Create a separate personal key for each reviewer:
docker compose -f docker/compose.yml exec retainer retainer key create --workspace acme-clinic \
--name "Dana (web)" --actor user:dana --scopes read,write,adminEnter that key on the sign-in screen. It is kept in an HTTP-only, same-site cookie, never browser storage. Use HTTPS outside localhost; Secure cookies require it. Revoking the API key ends access immediately. Signing out clears the browser cookie; it does not revoke the key.
For TLS termination at a reverse proxy, set RETAINER_PUBLIC_ORIGIN to the
external origin (for example https://retainer.example). CSRF checks compare
the browser Origin to this configured value; forwarded headers are not trusted.
The setting also controls the cookie's public host and Secure handling.
Non-user keys can browse read-only. People with a write key can create,
delete and merge records and review suggested merges; erasing a person for a
privacy request (forget) needs an admin key. ⌘K searches records, facts
and events across the workspace.
Connect an agent
Agents connect over MCP (Streamable HTTP) at /mcp, with the same key as a
bearer token. The key decides the workspace and who the agent's writes are
attributed to, so give each agent its own key. For example, in Claude Code:
claude mcp add --transport http retainer http://localhost:8787/mcp \
--header "Authorization: Bearer <key>"For clients that only speak stdio, use the @retainer/mcp bridge (once it is
published to npm; until then, run it from a checkout as
Connecting agents describes):
claude mcp add retainer \
--env RETAINER_URL=http://localhost:8787 --env RETAINER_API_KEY=<key> \
-- npx -y @retainer/mcpWith a Retainer account, Claude Code users can install the Retainer plugin instead. It signs in over OAuth and logs what your chats teach Claude about your customers and work:
/plugin marketplace add Tamloot-cc/Retainer
/plugin install retainer@retainerTools: describe_schema, list_templates, apply_template,
query_records, get_record, search, get_context, upsert_record,
log_event, remember and propose_schema_change. See
Connecting agents for the workflow an agent should follow,
and the SDK guide to call the REST API from code.
Develop
Requires Node 26 and pnpm 12 (run npm install -g corepack, then corepack
picks pnpm from package.json).
pnpm install
cp .env.example .env
docker compose -f docker/compose.yml up -d postgres
pnpm db:migrate
pnpm build
pnpm dev
# In another terminal (Vite proxies REST and auth requests to port 8787):
pnpm dev:webOpen localhost:5173/app. To serve the production
build from the API process locally, set RETAINER_WEB_DIR to the absolute
path of packages/web/dist in .env.
Command | What it does |
| Start the frontend dev server |
| Browser tests against the built app and real Postgres |
| Build every package |
| Type-check every package |
| Run tests (integration tests need Postgres at |
| Biome lint and format check |
| Create a migration from |
| Apply migrations |
| Run the operator CLI against |
| Check versions and changelog before a release (how) |
Packages
Package | License | Contents |
| AGPL-3.0 | API, MCP endpoint, workers, schema engine |
| MIT | Field types, composite value shapes, actors |
| MIT | TypeScript client |
| MIT | Optional review and records web app |
| MIT | stdio bridge for MCP clients |
| MIT | Claude Code plugin: MCP server and CRM logging |
License
The server is licensed under AGPL-3.0. The SDK, shared types and
MCP bridge, web app and Claude Code plugin are MIT-licensed; see each package's LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Persistent, inspectable memory for AI agents with lineage, correction, and a hosted MCP endpoint.
A second brain for your AI agent. Shared memory for your team's AI agents, plus public and private knowledge bases — works with ChatGPT, Claude, Cursor and any MCP client.
Persistent knowledge graph for AI-augmented teams. Store decisions, findings, and standing rules across agent sessions with semantic search and typed connections. Includes cross-session memory, audit trail, workspace isolation, and secret detection. Built for teams running agents that need to remember. Free until launch with team tier as default, anon trial available.
An agent-native database over MCP: shared, validated, structured records in every AI chat.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides persistent knowledge graph memory for AI agents, enabling them to store, recall, and query facts about people, projects, and relationships across sessions.MIT
- AlicenseNot gradedqualityBmaintenanceProvides a self-hosted shared memory service that lets AI agents capture and recall durable facts, decisions, and context across multiple tools and MCP-capable clients.3MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to store, search, and link typed knowledge entities such as memories, people, projects, tasks, and documents over a Streamable HTTP MCP endpoint. Combines hybrid BM25 and vector search with a knowledge graph, and separates short-lived session context from durable memory that future agents can trust.10AGPL 3.0
- AlicenseNot gradedqualityBmaintenanceEnables self-hosted, persistent AI identity and long-term memory across clients, models, and agent surfaces, with multi-resident isolation, shared world knowledge, governed memory writes, correction and forgetting, keyword or optional semantic recall, and MCP or HTTP access.67MIT