Local, append-only knowledge storage and retrieval for language models
Project description
Dense Knowledge
Dense Knowledge is a small local server for Model Module Protocol (MMP) files. It gives language models a persistent research memory without requiring a database, embeddings, or a hosted service.
An MMP client reads a compact index first and fetches full entries only when they are relevant. The files remain portable, diffable, and usable offline.
The project currently implements the flat MMP/1.0 format. Hierarchical indexes are planned, but are not written yet.
Install
Python 3.11 or newer is required.
Install the published package:
uv tool install dense-knowledge-mcp
mmp setup
mmp doctor
To install from source instead:
git clone https://github.com/Lucky44k/dense-knowledge-mcp.git
cd dense-knowledge-mcp
./scripts/install.sh
mmp setup
mmp doctor
mmp setup asks where knowledge files should be stored. It can also merge the
server entry into an LM Studio mcp.json. Existing servers are preserved; if an
MMP entry must be replaced, the command requires --force and creates a backup
of the JSON file first.
The non-interactive equivalent is:
mmp setup \
--memory "$HOME/.local/share/mmp/memory" \
--lm-studio-config "/path/to/mcp.json"
The selected paths are saved in the user configuration:
- Linux:
~/.config/mmp/config.toml - macOS:
~/Library/Application Support/mmp/config.toml - Windows:
%APPDATA%\mmp\config.toml
MMP_ROOT or the global --root option can override the configured memory
directory for a single process.
LM Studio
If you prefer to configure LM Studio yourself, the server command is:
mmp-server --root "/absolute/path/to/memory" --transport stdio
Minimal client configuration:
{
"mcpServers": {
"mmp": {
"command": "mmp-server",
"args": [
"--root",
"/absolute/path/to/memory",
"--transport",
"stdio"
]
}
}
}
Restart the MCP connection after changing the configuration. mmp doctor
checks the installation, memory directory, stored packages, and the configured
LM Studio file.
Command line
Create and inspect a package:
mmp create quantum_physics.mmp "quantum physics"
mmp list
mmp open quantum_physics.mmp
mmp search quantum_physics.mmp "Bell inequality tests"
mmp read quantum_physics.mmp e1
Structured entries can be passed inline or read from a JSON file:
mmp write quantum_physics.mmp --rev 0 --from entries.json
mmp validate quantum_physics.mmp
An entry in entries.json looks like this:
[
{
"summary": "Bell inequality separates local realism from quantum predictions",
"tags": ["BI", "nonlocality", "experimental tests"],
"status": "F",
"srcs": [
{
"author_or_venue": "Bell",
"title": "On the Einstein Podolsky Rosen paradox",
"year": "1964",
"identifier": "doi:10.1103/PhysicsPhysiqueFizika.1.195"
}
],
"legend": {
"BI": "Bell inequality"
},
"content": "def: BI = bound on local hidden variable correlations\nfact: quantum predictions -> violation of local realism bound"
}
]
Source objects are registered and deduplicated automatically. Existing source
IDs such as "s1" may be reused in later writes.
Important validation rules:
- summaries contain 3–15 English words
- tags are a JSON array, never one comma-separated string
- entries with status
ForCrequire sources - unsourced entries use status
Hand cannot containfact:ornum:lines - contested entries use status
Cand include at least onectr:line
Run mmp --help or mmp <command> --help for the complete CLI reference.
Retrieval and updates
The MCP server exposes nine tools:
mmp_list,mmp_create,mmp_open,mmp_search, andmmp_readmmp_write,mmp_update,mmp_deprecate, andmmp_validate
Search uses BM25 over index metadata with legend expansion and a full-body fallback. Updates never overwrite an entry: the replacement receives a new ID, the previous entry is marked deprecated, and its body remains available.
All writes use optimistic revision numbers and atomic file replacement. A stale revision is reported to the caller, but does not discard an append that can be applied safely.
Safety
Content returned from an MMP file is wrapped as untrusted reference data:
<mmp_data file="..." trust="untrusted">
...
</mmp_data>
The server rejects common instruction-like contamination during writes. It
never follows ref: links automatically, and its tool descriptions tell the
client that stored content is data rather than instructions. These measures
reduce prompt-injection risk; they do not make untrusted research material
equivalent to trusted instructions.
Keep personal packages out of source control. The default memory/ directory
is ignored by Git.
Development
python -m venv .venv
source .venv/bin/activate
python -m pip install -e ".[dev]"
pytest
ruff check src tests
python -m build
See CONTRIBUTING.md for contribution notes and SECURITY.md for private vulnerability reports.
Releases follow Semantic Versioning. The package version
is defined in src/mmp/__init__.py; Git tags use the corresponding v1.2.3
form. Release notes are kept in CHANGELOG.md.
Licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
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 dense_knowledge_mcp-1.1.0.tar.gz.
File metadata
- Download URL: dense_knowledge_mcp-1.1.0.tar.gz
- Upload date:
- Size: 100.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
066b0117b9596415747870e2780aa37a1d2b859710bb5514fdc491fd8819c6b9
|
|
| MD5 |
4391e2318fe8dff3a4403d1ed7a4062c
|
|
| BLAKE2b-256 |
9283f4f16d7ee01e7c3e3232597a9322c3dee6889c0143f1ea81a221d4b614c4
|
Provenance
The following attestation bundles were made for dense_knowledge_mcp-1.1.0.tar.gz:
Publisher:
publish.yml on Lucky44k/dense-knowledge-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dense_knowledge_mcp-1.1.0.tar.gz -
Subject digest:
066b0117b9596415747870e2780aa37a1d2b859710bb5514fdc491fd8819c6b9 - Sigstore transparency entry: 2283257426
- Sigstore integration time:
-
Permalink:
Lucky44k/dense-knowledge-mcp@24514feb7f54078d16a48e31d53c49667d253625 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/Lucky44k
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@24514feb7f54078d16a48e31d53c49667d253625 -
Trigger Event:
release
-
Statement type:
File details
Details for the file dense_knowledge_mcp-1.1.0-py3-none-any.whl.
File metadata
- Download URL: dense_knowledge_mcp-1.1.0-py3-none-any.whl
- Upload date:
- Size: 28.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1481148cb1c1f60b2d6fdd01bae2667cdd4fe0f938842abc1013ac345be4dd0f
|
|
| MD5 |
dbcaebeaeb453dfb561a98078b2cd4cf
|
|
| BLAKE2b-256 |
1215719fc8939210975da5073dc07b95b428e9d4e00b00644a81c381fcb5a087
|
Provenance
The following attestation bundles were made for dense_knowledge_mcp-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on Lucky44k/dense-knowledge-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dense_knowledge_mcp-1.1.0-py3-none-any.whl -
Subject digest:
1481148cb1c1f60b2d6fdd01bae2667cdd4fe0f938842abc1013ac345be4dd0f - Sigstore transparency entry: 2283257542
- Sigstore integration time:
-
Permalink:
Lucky44k/dense-knowledge-mcp@24514feb7f54078d16a48e31d53c49667d253625 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/Lucky44k
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@24514feb7f54078d16a48e31d53c49667d253625 -
Trigger Event:
release
-
Statement type: