Skip to main content

MESA — Memory Engine for Structured Agents

MESA CI Release License: MIT Python: 3.11+

MESA is an LLM-independent, source-linked memory engine for AI applications. It stores documents with exact provenance (document, revision, passage) and returns verifiable, scoped evidence over HTTP, Python SDK, and MCP. MESA returns evidence; it never writes the final answer or hallucinates sources.

Package version: 0.9.0. V4 is the current API. Production qualification remains at the release candidate stage: NO-GO until the release gates pass.

Installation

pip install "mesa-memory[adapters]"

Supported on Linux and macOS natively. On Windows, run via Docker or WSL.

Start the server

mesa start

Starts the local server on http://127.0.0.1:8000, initializes storage at ~/.mesa/data, and creates credentials at ~/.mesa/credentials.json (mode 0600).

Add and search documents

In another terminal, add and search documents immediately:

mesa add document.txt --source file://document.txt
mesa search "your query"

Python SDK

from mesa_client import Mesa

mesa = Mesa()
mesa.add(open("document.txt").read(), source="file://document.txt")
print(mesa.context("your query"))

Mesa() uses MESA_API_KEY and MESA_BASE_URL when they are set, otherwise the local credentials in ~/.mesa/credentials.json.

Connect MCP clients

Generate a ready-to-paste configuration block for Claude Desktop or any MCP client:

mesa mcp-config

Internal models (optional)

Models stay off by default. Documents are stored and found through BM25 lexical search without any model running. FactExtractionService owns canonical V4 extraction when models are enabled.

To enable semantic vector search and fact extraction with local Ollama, add to ~/.mesa/.env:

MESA_MODEL_ENABLED=true
MESA_LLM_MODEL=ollama:qwen2.5:7b
MESA_EMBEDDING_MODEL=ollama:bge-m3

Local openai_compatible servers (such as vLLM started with --port 8001, at MESA_LLM_BASE_URL=http://127.0.0.1:8001/v1; MESA itself uses port 8000) are also allowed with MESA_EXTERNAL_PROVIDER_ENABLED=false on a local endpoint (localhost, 127.0.0.1, ::1, host.docker.internal) and require no API key (D31). For cloud model providers (OpenAI, Anthropic), set MESA_EXTERNAL_PROVIDER_ENABLED=true and provide the required API keys.

Graph toggle

To run without the Kùzu graph database, set:

MESA_GRAPH_ENABLED=false

GRAPH lanes end SKIPPED, and turning the flag back on later backfills the graph at startup.

Docker

Run MESA in a single-user local container (D32):

docker compose -f docker-compose.v4.yml up --build -d

Credentials are written to /var/lib/mesa/credentials.json in the container volume:

docker compose -f docker-compose.v4.yml exec mesa-v4 cat /var/lib/mesa/credentials.json
docker compose -f docker-compose.v4.yml exec -T mesa-v4 mesa add - --source file://document.txt < document.txt
docker compose -f docker-compose.v4.yml exec mesa-v4 mesa search "your query"

No variables are required; models and external providers default off. If you set MESA_API_KEY and MESA_PRINCIPAL_ID for existing HTTP clients, the server accepts that key too, and the mesa commands inside the container use it first; add -e MESA_API_KEY= after exec to use the local credentials instead. The image includes adapters; build with --build-arg MESA_EXTRAS=ml,adapters to add local sentence-transformers. Ollama defaults to http://host.docker.internal:11434 (the Docker host).

Google Colab

Run MESA with GPU-accelerated Ollama in Colab: Colab Quickstart

Development

uv sync --locked --python 3.11

See testing for local tests, and docs/testing.md for test markers.

Documentation

License

MIT.

Metadata

Release files for mesa-memory 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mesa-memory 0.9.0
File Size Uploaded Provenance Actions
mesa_memory-0.9.0.tar.gz 1.6 MB Without provenance Details for mesa_memory-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mesa-memory 0.9.0
File Interpreter ABI Platform Actions
mesa_memory-0.9.0-py3-none-any.whl Python 3 none any Details for mesa_memory-0.9.0-py3-none-any.whl

Total release size: 2.8 MB

Release files / mesa_memory-0.9.0.tar.gz

Download URL mesa_memory-0.9.0.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
6a15d9e87d30f0df58f067a0740248577041bb91529f626ad8da6fbf3788404c
BLAKE2b-256 checksum
How to use checksums
3023ec7ab7eb0791d68a331668b6686dc105ddf66c3e93b14db9fef673cc4cc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mesa_memory-0.9.0-py3-none-any.whl

Download URL mesa_memory-0.9.0-py3-none-any.whl
Size 1.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
498bf063aa23397723b513e2e11d480748989ac1b7c24e50cd8cf8a331e3482a
BLAKE2b-256 checksum
How to use checksums
2c307ad8923b5dcccbda980af53ccf746d5a3e0c9e8a785cf6a9012e2a20c42e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for mesa-memory 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page