Networked memory service for AI agents, built on imprint-mem.
Project description
imprint-server
Networked memory service for AI agents, built on imprint-mem.
Exposes the full imprint-mem API over HTTP/REST and MCP SSE. Supports SQLite for local development and Postgres for production multi-worker deployments.
Install
pip install imprint-server
Quick start
# SQLite (local, zero infrastructure)
imprint-server serve
# Postgres (production)
IMPRINT_STORE=postgres://user:pass@host/db \
IMPRINT_AUTH_DISABLED=false \
imprint-server serve
On first start with auth enabled and an empty key store, the server generates and prints a master API key. Copy it -- it is not stored.
Docker
# Start Postgres + imprint-server via Docker Compose
docker compose -f imprint-server/docker-compose.yml up
# Or build and run the image directly
docker build -t imprint-server -f imprint-server/Dockerfile .
docker run -p 8000:8000 imprint-server
MCP (Claude Code, Cursor, Continue)
Set two environment variables before starting:
IMPRINT_MCP_AGENT_ID=my-agent \
IMPRINT_MCP_USER_ID=my-user \
imprint-server serve
Then add http://localhost:8000/mcp/sse as an MCP server in your client.
Six tools are available: imprint_begin_session, imprint_get_policy,
imprint_observe, imprint_recall, imprint_direct, imprint_end_session.
Python client
from imprint.client import ImprintClient
# Requires: pip install imprint-mem[client]
async with ImprintClient("http://localhost:8000", api_key="sk-imp-...") as client:
# Compile a behavioral policy for a user.
policy = await client.get_policy("my-agent", "user-1")
print(policy.text)
# Record a turn.
await client.observe("my-agent", "user-1",
agent_output="Here is a bullet list.",
user_response="No bullet points please.")
# Session-scoped usage (enables learning signal on close):
async with client.session("my-agent", "user-1", context="coding") as sess:
policy = await sess.get_policy()
await sess.observe("output", "response")
sess.set_outcome(0.9)
# Agent-scoped shortcut (avoids repeating agent_id):
agent = client.agent("my-agent")
policy = await agent.get_policy("user-1")
CLI
imprint-server serve # start the HTTP server
imprint-server migrate # run schema migrations only (no server)
imprint-server keys create # generate a new API key
imprint-server keys list # list all keys (hashes + labels)
imprint-server keys revoke HASH # revoke a key by its SHA-256 hash
REST API
POST /v1/agents/{agent_id}/observe
POST /v1/agents/{agent_id}/policy
GET /v1/agents/{agent_id}/memories/{user_id}
DELETE /v1/agents/{agent_id}/memories/{user_id}
POST /v1/agents/{agent_id}/memories/{user_id}/consolidate
POST /v1/agents/{agent_id}/memories/{user_id}/directions
GET /v1/agents/{agent_id}/events/{user_id}
GET /v1/agents/{agent_id}/health/{user_id}
GET /v1/memories/{memory_id}/lineage
POST /v1/agents/{agent_id}/sessions
POST /v1/agents/{agent_id}/sessions/{id}/observe
POST /v1/agents/{agent_id}/sessions/{id}/policy
POST /v1/agents/{agent_id}/sessions/{id}/close
GET /v1/agents
POST /v1/agents
GET /v1/agents/{agent_id}
PATCH /v1/agents/{agent_id}/config
DELETE /v1/agents/{agent_id}
POST /v1/agents/{agent_id}/scopes/consolidate
GET /health
GET /metrics
GET /mcp/sse
Configuration
All settings via environment variables (prefix IMPRINT_). See
.env.example for the full list with defaults and comments.
Key settings:
| Variable | Default | Description |
|---|---|---|
IMPRINT_STORE |
sqlite:///~/.imprint/imprint.db |
SQLite path or Postgres URL |
IMPRINT_AUTH_DISABLED |
true |
Set false to require API keys |
IMPRINT_DEFAULT_MODE |
balanced |
frugal, balanced, or eager |
IMPRINT_MCP_AGENT_ID |
`` | Agent ID for the MCP endpoint |
IMPRINT_MCP_USER_ID |
`` | User namespace for the MCP endpoint |
IMPRINT_PORT |
8000 |
Bind port |
IMPRINT_WORKERS |
1 |
Uvicorn worker count (Postgres only for >1) |
Development
just server-dev # serve with SQLite, auth disabled
just server-mcp-dev # serve with MCP enabled
just server-check # lint, typecheck, test
just server-integration-test # Postgres tests via Docker Compose
just test-all # full suite: library + server + Postgres
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file imprint_server-0.2.0.tar.gz.
File metadata
- Download URL: imprint_server-0.2.0.tar.gz
- Upload date:
- Size: 58.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
777cef9692013958542edfec898caa93bc7713d6611f5860e34b48a575fd4054
|
|
| MD5 |
ddb8bdece6e7c14af0ed6b52b2043a83
|
|
| BLAKE2b-256 |
d9f5ff71530d76a6622d6128e13dacb98fa501ec811e26926aa89d3b1f052374
|
Provenance
The following attestation bundles were made for imprint_server-0.2.0.tar.gz:
Publisher:
cd.yml on rkv0id/imprint
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
imprint_server-0.2.0.tar.gz -
Subject digest:
777cef9692013958542edfec898caa93bc7713d6611f5860e34b48a575fd4054 - Sigstore transparency entry: 1580027877
- Sigstore integration time:
-
Permalink:
rkv0id/imprint@80692c93169480219e7124ad8a2fe5471da9a33e -
Branch / Tag:
refs/tags/server-v0.2.0 - Owner: https://github.com/rkv0id
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@80692c93169480219e7124ad8a2fe5471da9a33e -
Trigger Event:
push
-
Statement type:
File details
Details for the file imprint_server-0.2.0-py3-none-any.whl.
File metadata
- Download URL: imprint_server-0.2.0-py3-none-any.whl
- Upload date:
- Size: 47.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
358e8b0f40c7ff706e8e68d8dd9e7f1fe6d08e0eda7c314f1d9b74074efbab18
|
|
| MD5 |
73e02b67b0c812a875b447e4e2551bd7
|
|
| BLAKE2b-256 |
e689fa97dd03ae7f9545d251b20eac6f0d0e9f103be31a1f365a7efdde130542
|
Provenance
The following attestation bundles were made for imprint_server-0.2.0-py3-none-any.whl:
Publisher:
cd.yml on rkv0id/imprint
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
imprint_server-0.2.0-py3-none-any.whl -
Subject digest:
358e8b0f40c7ff706e8e68d8dd9e7f1fe6d08e0eda7c314f1d9b74074efbab18 - Sigstore transparency entry: 1580027946
- Sigstore integration time:
-
Permalink:
rkv0id/imprint@80692c93169480219e7124ad8a2fe5471da9a33e -
Branch / Tag:
refs/tags/server-v0.2.0 - Owner: https://github.com/rkv0id
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@80692c93169480219e7124ad8a2fe5471da9a33e -
Trigger Event:
push
-
Statement type: