Skip to main content

MemoryNode Python SDK

Synchronous typed access to the existing MemoryNode FastAPI service, plus stdio and local shared Streamable HTTP MCP. The SDK and MCP process never access SQLite or start the API.

from memorynode import MemoryNodeClient

with MemoryNodeClient("http://127.0.0.1:8000", timeout=10) as client:
    assert client.status.check().ok
    result = client.proposals.extract(
        actor_id="demo-user",
        project_id="memorynode-demo",
        content="以后回答使用中文",
    )
    memories = client.memories.search("语言偏好")

Resources:

  • status.check()
  • sources.get()
  • proposals.create/extract/list/get/related_memories/approve/reject()
  • events.get/list_recent()
  • memories.search/list/get/explain/revoke/feedback/set_expiry()

Every method accepts timeout= and request_id=. The SDK sends a generated X-Request-ID by default and retains it in errors for client-side correlation; the current server does not provide end-to-end request tracing. Unknown response fields are accepted, while missing or invalid required fields raise MemoryNodeResponseError. Server failures and suspicious details are redacted.

Phase 1 compatibility methods health(), extract_proposals(), search_memories(), and explain_memory() still return JSON-compatible dicts. The MCP entry point remains memorynode-mcp (or python -m memorynode). Default discovery exposes memory_propose, memory_search, memory_get, memory_explain, memory_list, and memory_feedback. Governance tools are hidden unless true TOML booleans in local config.toml enable them.

The memorynode CLI provides init, start, stop, restart, status, doctor, mcp, data commands, and version. The 0.8.0 wheel includes the FastAPI backend and static governance console:

memorynode init
memorynode start
memorynode status
memorynode stop

No source checkout or Node.js runtime is required. API and console default to 127.0.0.1:8000 and 127.0.0.1:3000; their distinct ports are configurable by CLI, environment, or TOML. The console receives only the API origin from its runtime config endpoint, and CORS allows only the configured console origin.

Development:

py -3.13 -m pip install -e ".[test]"
python -m pytest -q
python ../../scripts/build_release.py

Related memories remain reviewer-facing candidates, not automatic conflict decisions. Expiration remains request-driven.

memorynode mcp remains the stdio default. For a shared local endpoint, first run memorynode init and store the bearer token printed once, then run:

memorynode start
memorynode mcp --transport http --host 127.0.0.1 --port 8765

Connect MCP clients to http://127.0.0.1:8765/mcp using Authorization: Bearer <token>. HTTP accepts only 127.0.0.1; it rejects a missing or invalid token before MCP handling. Existing configurations can create a replacement token with --print-token-once. Only a token hash is persisted, and mcp.log records sanitized connection/call metadata, never tokens, headers, content, queries, parameters, or responses. The static console does not yet include an MCP overview because it cannot safely read local log files.

For install/uninstall, data handling, backup/restore/import/export, governance, and troubleshooting guidance, see the repository README, SECURITY.md, and TROUBLESHOOTING.md.

Release files for memorynode 0.8.1

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

Source distribution (sdist)

Source distribution for memorynode 0.8.1
File Size Uploaded
memorynode-0.8.1.tar.gz 632.0 kB Details

Built distribution (wheel)

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

Total release size: 1.3 MB

Release files / memorynode-0.8.1.tar.gz

Download URL memorynode-0.8.1.tar.gz
Size 632.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9b9cb7a374579c484752a5aab4f7756b2052023015b0a21663e85afbd9f13f7f
BLAKE2b-256 checksum
How to use checksums
c5054b9b6baa2ff737566560195183910e7880e8262fdb19809eef9e53b0addc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 16, 2026.

Transparency log

Release files / memorynode-0.8.1-py3-none-any.whl

Download URL memorynode-0.8.1-py3-none-any.whl
Size 652.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78c74648248470518e28fa51887beba2d097266b93abf15eef3d21ff4186bcfa
BLAKE2b-256 checksum
How to use checksums
ff988c353a4d6234901c3f6f199f836506318de220b80bc45a5286b2fd451ef1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.8.1 This release

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

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