Skip to main content

Graph memory MCP server for codebases (MRAgent-style reconstruction)

Project description

Delfos

A graph-memory MCP server for codebases. Delfos implements the active reconstruction model from "Memory is Reconstructed, Not Retrieved: Graph Memory for LLM Agents" (arXiv 2606.06036) over a code repository, and exposes it as tools any MCP-compatible agent (Claude Code, Cursor, etc.) can consume — no knowledge of the graph internals required.

Memory access is an iterative, LLM-driven traversal of a persistent Cue → Tag → Content graph rather than one-shot retrieval. See ARCHITECTURE.md for the architecture overview and docs/decisions.md for the design decisions and rationale.

Architecture

Two layers meet at a single boundary — the GraphStore ABC. No component ever touches the C++ engine directly. The summary below is the short version; the full contributor-facing walkthrough is ARCHITECTURE.md.

  • libdelfos/ — the C++ storage engine: an in-memory CSR directed property graph (graph.hpp), an HNSW vector index over USearch (vector_index.hpp), and crash-safe snapshot persistence via FlatBuffers + USearch native format (snapshot.hpp). Exposed to Python as the delfos._delfos extension through nanobind bindings.
  • delfos.schema — the code-specific Cue-Tag-Content schema as Pydantic models (CueNode, TagNode, ContentNode), the Edge model, and the closed enum vocabularies. Cue and content nodes carry source_file + git_sha provenance (for delete-and-reindex; tags are shared across files and carry none) and optional embedding metadata (embedding_model) for embedding versioning.
  • delfos.store — the GraphStore abstract base class (the single database boundary every other component goes through) and NativeGraphStore, the concrete backend over the C++ engine.
  • delfos.indexer — the construction pipeline (parser, extractor, embedder, pipeline) that turns a repository into graph nodes and edges.

Configuration

Delfos is configured via DELFOS_* environment variables, resolved with this precedence (highest first):

  1. Real environment variables
  2. A .env file at the repo root passed to --repo / DELFOS_REPO — loaded explicitly at startup (copy .env.example to .env and edit)
  3. .delfos/config.toml (non-secret settings only — keep API keys out of it)
  4. .delfos/manifest.json, recorded at index time (embed.model/embed.dim only — these must match what the index was built with)
  5. Built-in defaults (nomic-embed-text, dim 768)
Variable Purpose
DELFOS_EMBED_MODEL Embedding model name
DELFOS_EMBED_DIM Embedding output dimension (must match the model)
DELFOS_EMBED_BASE_URL OpenAI-compatible embedding endpoint (unset = OpenAI)
DELFOS_EMBED_API_KEY Embedding endpoint API key (required when DELFOS_EMBED_BASE_URL is unset)
DELFOS_LLM_MODEL Chat model for the reconstruct hop planner
DELFOS_LLM_BASE_URL OpenAI-compatible chat endpoint (unset = OpenAI)
DELFOS_LLM_API_KEY Chat endpoint API key
DELFOS_REPO Repo whose .delfos/ workspace to serve (delfos-mcp only)
DELFOS_VERBOSE 1 for per-file DEBUG logging

A query against an already-indexed repo needs only credentials — the model and dimension come from the manifest. DELFOS_EMBED_BASE_URL and DELFOS_LLM_BASE_URL each point at their own endpoint independently; there is no fallback between them.

Development

This project uses uv.

uv sync                 # install Python deps + dev tools
uv pip install -e .     # build + install the _delfos C++ extension
uv run ruff check .     # lint
uv run ruff format .    # format
uv run pyright          # type-check (strict)
uv run pytest           # run tests

C++ engine

The standalone C++ build/test flow uses the Ninja generator (brew install ninja):

cmake --preset debug                              # configure (ASan + UBSan)
cmake --build build/debug
ctest --test-dir build/debug --output-on-failure

Note: CMake 4.x dropped compatibility with cmake_minimum_required < 3.5, which the vendored USearch dependency still declares. The build passes -DCMAKE_POLICY_VERSION_MINIMUM=3.5 (wired into pyproject.toml and the CMake presets) to configure under modern CMake.

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

delfos-0.1.0.tar.gz (187.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

delfos-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (280.3 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

delfos-0.1.0-cp312-abi3-macosx_11_0_arm64.whl (197.6 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

File details

Details for the file delfos-0.1.0.tar.gz.

File metadata

  • Download URL: delfos-0.1.0.tar.gz
  • Upload date:
  • Size: 187.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for delfos-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4881829fabb987b252373a8452715c12889d8140f6ea5ad3f12f4668895649cc
MD5 e184c8dd60005a5812fc7215f1c537bc
BLAKE2b-256 1245b01aa3cc255752ae4ba45c18a8b8a7590520c7f1fd5b272c9ec0b3a0b5d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for delfos-0.1.0.tar.gz:

Publisher: release.yml on MiltMont/Delfos

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file delfos-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for delfos-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 145f1a775988ba179a0c1b36880e2b135b052c70c9ceff1e9c1665c3d48d33eb
MD5 80efceb787807680ccc2624f2138ba08
BLAKE2b-256 391d3af3c5f2b2172df8e75e12005ec0958c5c7170332059df94eaf1b23c0678

See more details on using hashes here.

Provenance

The following attestation bundles were made for delfos-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on MiltMont/Delfos

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file delfos-0.1.0-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for delfos-0.1.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 72031c94b5feca45f8dedb63a058bbd956f9a3c59da36264be2d42064be7ff1d
MD5 c9d1f08815878ff32031c04e84a17156
BLAKE2b-256 d515cfd889607e2add36634b7b635bca775ac186307c512078511cc592362a68

See more details on using hashes here.

Provenance

The following attestation bundles were made for delfos-0.1.0-cp312-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on MiltMont/Delfos

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page