Skip to main content

mnueron — Python SDK

Wraps the hosted mnueron API at https://www.mnueron.com. Grab a bearer token from Settings → API Tokens after signing up.

pip install mnueron
from mnueron import Mnueron

with Mnueron(api_key="mnu_...") as client:
    # Save a memory
    mem = client.save(
        "User prefers concise replies over long explanations",
        namespace="my-app",
        tags=["preferences"],
    )

    # Full-text search (BM25 server-side)
    for r in client.search("how does the user like responses?",
                           namespace="my-app", k=5):
        print(r.content, r.score)

    # List recent memories
    recent = client.list(namespace="my-app", limit=20)

    # Partial update — metadata is MERGED, pass {"key": None} to remove
    client.update(mem.id, tags=["preferences", "tone"],
                  metadata={"confidence": 0.9})

    # Delete
    client.delete(mem.id)

Async version

import asyncio
from mnueron import AsyncMnueron

async def main():
    async with AsyncMnueron(api_key="mnu_...") as client:
        await client.save("...", namespace="my-app")
        results = await client.search("...", namespace="my-app")

asyncio.run(main())

Configuration via env vars

export MNUERON_API_KEY=mnu_xxxxxxxxxxxxxxxxxxxxx
# Optional — default is https://www.mnueron.com
export MNUERON_API_URL=https://www.mnueron.com
from mnueron import Mnueron
client = Mnueron()   # picks up env vars

API reference

Method Returns Notes
save(content, *, namespace, tags, source, source_ref, metadata) Memory Single save. Triggers backend redaction + fact extraction (if enabled) + memory.saved webhooks.
search(query, *, namespace, k, created_after, created_before, updated_after, updated_before, metadata_filter) List[Memory] BM25 search. All filters stack.
bulk_search(queries, *, namespace, k, ...) List[BulkSearchResult] v0.2.3 — up to 25 queries in one HTTP call.
list(*, namespace, limit, offset, created_after, ...) List[Memory] Newest-first list with date + metadata filters.
get(memory_id) Memory | None Returns None on 404.
update(memory_id, *, content, tags, namespace, metadata) Memory v0.2.2 partial update. Metadata merged, history recorded under metadata.history.
delete(memory_id) None Fires memory.deleted webhook.
namespaces() List[Namespace] Counts per namespace.
health() bool Liveness probe.
list_webhooks() / create_webhook(...) / get_webhook(id) / update_webhook(id, ...) / delete_webhook(id) — v0.3.1 webhook management. create_webhook() returns the signing secret once.

All methods raise MnueronError(status, message) on HTTP errors.

Date filters

created_after, created_before, updated_after, updated_before are epoch milliseconds (int(time.time() * 1000)). Inclusive on the boundary.

import time
yesterday = int((time.time() - 86400) * 1000)
client.list(created_after=yesterday, namespace="my-app")

Metadata filter (v0.2.4)

JSON object passed to Postgres @> containment. Top-level keys only.

client.search("billing", metadata_filter={"speaker": "sarah"})

Bulk search (v0.2.3)

results = client.bulk_search(
    ["onboarding", "billing edge cases", "JWT setup"],
    namespace="work", k=5,
)
for r in results:
    print(r.query, "→", len(r.hits))

Webhooks (v0.3.1)

mnueron can POST signed deliveries to your HTTPS endpoint on memory.saved, memory.updated, memory.deleted, or summary.created.

hook = client.create_webhook(
    "https://example.com/mnueron-hook",
    events=["memory.saved", "memory.deleted"],
    description="forward saves into our event bus",
)
print("Store this once — it won't appear again:", hook.secret)

Verify signatures on incoming deliveries:

from mnueron import verify_webhook_signature

def handler(request):
    sig = request.headers["X-Mnueron-Signature"]
    if not verify_webhook_signature(secret, request.body, sig):
        return Response(status_code=401)
    # ... process payload

Use with OpenAI / Anthropic clients

from openai import OpenAI
from mnueron import Mnueron

mem = Mnueron()              # MNUERON_API_KEY in env
llm = OpenAI()

context = mem.search(user_message, namespace="user-123", k=5)
prompt_context = "\n".join(m.content for m in context)

response = llm.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
        {"role": "system", "content": f"Relevant context:\n{prompt_context}"},
        {"role": "user", "content": user_message},
    ],
)

mem.save(response.choices[0].message.content,
         namespace="user-123", source="auto",
         metadata={"extract_facts": True})   # opt into v0.2.9 extraction

Same shape works with Anthropic, Mistral, Gemini, or any other client.

Local mode

This SDK only speaks to the hosted backend. For local-only / no-account mode, install the mnueron CLI from npm and run the MCP server directly:

npm install -g mnueron
mnueron setup

Same six MCP tools (memory_save, memory_recall, memory_list, memory_get, memory_delete, memory_get_thread) are wired into Claude Desktop, Claude Code, Cursor, Windsurf, Cline, Continue, Zed, Goose, and OpenCode by the setup wizard.

License

MIT.

Metadata

Release files for mnueron 0.3.2

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

Source distribution (sdist)

Source distribution for mnueron 0.3.2
File Size Uploaded Provenance Actions
mnueron-0.3.2.tar.gz 8.8 kB Without provenance Details for mnueron-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mnueron 0.3.2
File Interpreter ABI Platform Actions
mnueron-0.3.2-py3-none-any.whl Python 3 none any Details for mnueron-0.3.2-py3-none-any.whl

Total release size: 17.2 kB

Release files / mnueron-0.3.2.tar.gz

Download URL mnueron-0.3.2.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b509ca7846c4b6353f67016482989667b06d2bcb5b9bd50414226cbdf5450b5f
BLAKE2b-256 checksum
How to use checksums
ec8cbeb9e23b004c1ae2fd3fff12a27458d7317390e60900c28564ee2ae588eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.6

Release files / mnueron-0.3.2-py3-none-any.whl

Download URL mnueron-0.3.2-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34094120d5987eb5433e7736fe027cdc0c8387a9dd656157032d7f2be35985cf
BLAKE2b-256 checksum
How to use checksums
a7e25601c0d75bde6665d86d9db090da2e998fe19c9f4547b53244a6007d739e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.6

Security for mnueron 0.3.2

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.

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files No provenance

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