hippmem-mcp 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hippmem_mcp-0.1.0/.env.example +11 -0
- hippmem_mcp-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
- hippmem_mcp-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
- hippmem_mcp-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +22 -0
- hippmem_mcp-0.1.0/.github/workflows/ci.yml +56 -0
- hippmem_mcp-0.1.0/.gitignore +34 -0
- hippmem_mcp-0.1.0/CHANGELOG.md +20 -0
- hippmem_mcp-0.1.0/CODE_OF_CONDUCT.md +51 -0
- hippmem_mcp-0.1.0/CONTRIBUTING.md +78 -0
- hippmem_mcp-0.1.0/COPYRIGHT +5 -0
- hippmem_mcp-0.1.0/LICENSE +202 -0
- hippmem_mcp-0.1.0/NOTICE +4 -0
- hippmem_mcp-0.1.0/PKG-INFO +150 -0
- hippmem_mcp-0.1.0/README.md +127 -0
- hippmem_mcp-0.1.0/SECURITY.md +24 -0
- hippmem_mcp-0.1.0/SUPPORT.md +14 -0
- hippmem_mcp-0.1.0/pyproject.toml +33 -0
- hippmem_mcp-0.1.0/src/hippmem_mcp/__init__.py +5 -0
- hippmem_mcp-0.1.0/src/hippmem_mcp/py.typed +0 -0
- hippmem_mcp-0.1.0/src/hippmem_mcp/server.py +96 -0
- hippmem_mcp-0.1.0/tests/test_server.py +122 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# HIPPMEM MCP server configuration template
|
|
2
|
+
# Copy to .env and fill in real values (optional — defaults work without API key)
|
|
3
|
+
|
|
4
|
+
# --- HIPPMEM engine backend (optional) ---
|
|
5
|
+
# Leave empty to use the deterministic fallback (no API key needed).
|
|
6
|
+
# Set to "openai-compatible" for higher semantic accuracy.
|
|
7
|
+
|
|
8
|
+
# HIPPMEM_EMBEDDING_PROVIDER=
|
|
9
|
+
# HIPPMEM_EMBEDDING_BASE_URL=https://api.openai.com/v1
|
|
10
|
+
# HIPPMEM_EMBEDDING_MODEL=text-embedding-3-small
|
|
11
|
+
# OPENAI_API_KEY=sk-xxxxxxxxxxxx
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Report a bug in hippmem-mcp
|
|
4
|
+
title: ''
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
**Describe the bug**
|
|
10
|
+
A clear and concise description of what the bug is.
|
|
11
|
+
|
|
12
|
+
**To Reproduce**
|
|
13
|
+
Steps to reproduce the behavior:
|
|
14
|
+
1. Install version '...'
|
|
15
|
+
2. Configure with '...'
|
|
16
|
+
3. Call tool '...'
|
|
17
|
+
4. See error
|
|
18
|
+
|
|
19
|
+
**Expected behavior**
|
|
20
|
+
A clear and concise description of what you expected to happen.
|
|
21
|
+
|
|
22
|
+
**Environment**
|
|
23
|
+
- hippmem-mcp version: `pip show hippmem-mcp`
|
|
24
|
+
- Python version: `python --version`
|
|
25
|
+
- OS: [e.g. macOS 15, Ubuntu 24.04]
|
|
26
|
+
- MCP client: [e.g. Claude Desktop, VS Code]
|
|
27
|
+
|
|
28
|
+
**Additional context**
|
|
29
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for hippmem-mcp
|
|
4
|
+
title: ''
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
**Is your feature request related to a problem? Please describe.**
|
|
10
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
11
|
+
|
|
12
|
+
**Describe the solution you'd like**
|
|
13
|
+
A clear and concise description of what you want to happen.
|
|
14
|
+
|
|
15
|
+
**Describe alternatives you've considered**
|
|
16
|
+
A clear and concise description of any alternative solutions or workarounds you've considered.
|
|
17
|
+
|
|
18
|
+
**Additional context**
|
|
19
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
|
|
3
|
+
<!-- Describe your changes clearly and concisely. -->
|
|
4
|
+
|
|
5
|
+
## Motivation and Context
|
|
6
|
+
|
|
7
|
+
<!-- Why is this change needed? What problem does it solve? -->
|
|
8
|
+
|
|
9
|
+
## Type of Change
|
|
10
|
+
|
|
11
|
+
- [ ] Bug fix
|
|
12
|
+
- [ ] New feature
|
|
13
|
+
- [ ] Documentation update
|
|
14
|
+
- [ ] Refactor / performance improvement
|
|
15
|
+
- [ ] CI / tooling
|
|
16
|
+
|
|
17
|
+
## Checklist
|
|
18
|
+
|
|
19
|
+
- [ ] Tests pass (`pytest`)
|
|
20
|
+
- [ ] Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/)
|
|
21
|
+
- [ ] Commits include `Signed-off-by:` (DCO)
|
|
22
|
+
- [ ] Documentation updated if applicable
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
name: lint (ruff)
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.11"
|
|
18
|
+
- name: Install
|
|
19
|
+
run: pip install ruff
|
|
20
|
+
- name: Lint
|
|
21
|
+
run: ruff check src/ tests/
|
|
22
|
+
|
|
23
|
+
test:
|
|
24
|
+
name: test (Python ${{ matrix.python-version }})
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
strategy:
|
|
27
|
+
matrix:
|
|
28
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v4
|
|
31
|
+
- uses: actions/setup-python@v5
|
|
32
|
+
with:
|
|
33
|
+
python-version: ${{ matrix.python-version }}
|
|
34
|
+
- name: Install
|
|
35
|
+
run: pip install ".[dev]"
|
|
36
|
+
- name: Run tests
|
|
37
|
+
run: pytest tests/ -v
|
|
38
|
+
|
|
39
|
+
publish:
|
|
40
|
+
name: publish to PyPI
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
43
|
+
needs: [lint, test]
|
|
44
|
+
steps:
|
|
45
|
+
- uses: actions/checkout@v4
|
|
46
|
+
- uses: actions/setup-python@v5
|
|
47
|
+
with:
|
|
48
|
+
python-version: "3.11"
|
|
49
|
+
- name: Build
|
|
50
|
+
run: |
|
|
51
|
+
pip install build
|
|
52
|
+
python -m build
|
|
53
|
+
- name: Publish
|
|
54
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
55
|
+
with:
|
|
56
|
+
password: ${{ secrets.PYPI_TOKEN }}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Python build artifacts
|
|
2
|
+
__pycache__
|
|
3
|
+
*.pyc
|
|
4
|
+
*.egg-info
|
|
5
|
+
dist/
|
|
6
|
+
|
|
7
|
+
# Virtual environment
|
|
8
|
+
.venv
|
|
9
|
+
venv/
|
|
10
|
+
|
|
11
|
+
# IDE
|
|
12
|
+
.idea/
|
|
13
|
+
.vscode/
|
|
14
|
+
*.swp
|
|
15
|
+
*.swo
|
|
16
|
+
|
|
17
|
+
# OS
|
|
18
|
+
.DS_Store
|
|
19
|
+
Thumbs.db
|
|
20
|
+
|
|
21
|
+
# Environment variables (may contain secrets)
|
|
22
|
+
.env
|
|
23
|
+
|
|
24
|
+
# HIPPMEM runtime data (redb database + full-text index)
|
|
25
|
+
*.redb
|
|
26
|
+
fulltext/
|
|
27
|
+
|
|
28
|
+
# Temporary files
|
|
29
|
+
.tmp/
|
|
30
|
+
|
|
31
|
+
# Project-local CLAUDE.md (gitignored per project convention)
|
|
32
|
+
CLAUDE.md
|
|
33
|
+
scripts/publish.sh
|
|
34
|
+
.publish-venv
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are recorded here.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [0.1.0] — unreleased
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Initial release: MCP server for HIPPMEM associative memory.
|
|
14
|
+
- `write_memory` tool — write a memory; engine auto-discovers associations (entity, causal, semantic, topic, temporal).
|
|
15
|
+
- `retrieve_memories` tool — multi-channel associative recall via spreading activation with explanation traces.
|
|
16
|
+
- FastMCP high-level API with lifespan management.
|
|
17
|
+
- Stdio transport for Claude Desktop and other MCP-compatible tools.
|
|
18
|
+
- Deterministic fallback backend — zero-config, no API key, no network required.
|
|
19
|
+
|
|
20
|
+
[0.1.0]: https://github.com/hippmem/hippmem-mcp/releases/tag/v0.1.0
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Conduct
|
|
4
|
+
|
|
5
|
+
We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.
|
|
6
|
+
|
|
7
|
+
Please avoid using overtly sexual aliases or other nicknames that might detract from a friendly, safe and welcoming environment for all.
|
|
8
|
+
|
|
9
|
+
Please be kind and courteous. There’s no need to be mean or rude.
|
|
10
|
+
|
|
11
|
+
Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.
|
|
12
|
+
|
|
13
|
+
Please keep unstructured critique to a minimum. If you have solid ideas you want to experiment with, make a fork and see how it works.
|
|
14
|
+
|
|
15
|
+
We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behavior. We interpret the term “harassment” as including the definition in the Citizen Code of Conduct; if you have any lack of clarity about what might be included in that concept, please read their definition. In particular, we don’t tolerate behavior that excludes people in socially marginalized groups.
|
|
16
|
+
|
|
17
|
+
Private harassment is also unacceptable. No matter who you are, if you feel you have been or are being harassed or made uncomfortable by a community member, please contact the moderation team immediately. Whether you’re a regular contributor or a newcomer, we care about making this community a safe place for you and we’ve got your back.
|
|
18
|
+
|
|
19
|
+
Likewise any spamming, trolling, flaming, baiting or other attention-stealing behavior is not welcome.
|
|
20
|
+
|
|
21
|
+
## Moderation
|
|
22
|
+
|
|
23
|
+
These are the policies for upholding our community’s standards of conduct. If you feel that a thread needs moderation, please contact the moderation team.
|
|
24
|
+
|
|
25
|
+
Remarks that violate the Rust standards of conduct, including hateful, hurtful, oppressive, or exclusionary remarks, are not allowed. (Cursing is allowed, but never targeting another user, and never in a hateful manner.)
|
|
26
|
+
|
|
27
|
+
Remarks that moderators find inappropriate, whether listed in the code of conduct or not, are also not allowed.
|
|
28
|
+
|
|
29
|
+
Moderators will first respond to such remarks with a warning.
|
|
30
|
+
|
|
31
|
+
If the warning is unheeded, the user will be “kicked,” i.e., kicked out of the communication channel to cool off.
|
|
32
|
+
|
|
33
|
+
If the user comes back and continues to make trouble, they will be banned, i.e., indefinitely excluded.
|
|
34
|
+
|
|
35
|
+
Moderators may choose at their discretion to un-ban the user if it was a first offense and they offer the offended party a genuine apology.
|
|
36
|
+
|
|
37
|
+
If a moderator bans someone and you think it was unjustified, please take it up with that moderator, or with a different moderator, in private. Complaints about bans in-channel are not allowed.
|
|
38
|
+
|
|
39
|
+
Moderators are held to a higher standard than other community members. If a moderator creates an inappropriate situation, they should expect less leeway than others.
|
|
40
|
+
|
|
41
|
+
In the Rust community we strive to go the extra step to look out for each other. Don’t just aim to be technically unimpeachable, try to be your best self. In particular, avoid flirting with offensive or sensitive issues, particularly if they’re off-topic; this all too often leads to unnecessary fights, hurt feelings, and damaged trust; worse, it can drive people away from the community entirely.
|
|
42
|
+
|
|
43
|
+
And if someone takes issue with something you said or did, resist the urge to be defensive. Just stop doing what it was they complained about and apologize. Even if you feel you were misinterpreted or unfairly accused, chances are good there was something you could’ve communicated better — remember that it’s your responsibility to make your fellow community members comfortable. Everyone wants to get along and we are all here first and foremost because we want to talk about cool technology. You will find that people will be eager to assume good intent and forgive as long as you earn their trust.
|
|
44
|
+
|
|
45
|
+
The enforcement policies listed above apply to all official HIPPMEM venues, including GitHub repositories under the `hippmem` organization. For other projects adopting the Rust Code of Conduct, please contact the maintainers of those projects for enforcement.
|
|
46
|
+
|
|
47
|
+
Adapted from the [Node.js Policy on Trolling](https://www.rust-lang.org/policies/code-of-conduct) as well as the Contributor Covenant v1.3.0.
|
|
48
|
+
|
|
49
|
+
## Contact
|
|
50
|
+
|
|
51
|
+
To report a conduct issue, email **hippmem@gmail.com**.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Contributing to hippmem-mcp
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in contributing to hippmem-mcp! This document explains how to report issues, submit changes, and follow the project conventions.
|
|
4
|
+
|
|
5
|
+
## Reporting Bugs
|
|
6
|
+
|
|
7
|
+
- Open an issue at <https://github.com/hippmem/hippmem-mcp/issues>.
|
|
8
|
+
- Include the hippmem-mcp version (`pip show hippmem-mcp`), Python version (`python --version`), OS, and a minimal reproduction.
|
|
9
|
+
- For security vulnerabilities, do **not** open a public issue — see [SECURITY.md](SECURITY.md).
|
|
10
|
+
|
|
11
|
+
## Submitting a Pull Request
|
|
12
|
+
|
|
13
|
+
1. Fork the repository.
|
|
14
|
+
2. Create a branch from `main`:
|
|
15
|
+
```bash
|
|
16
|
+
git checkout -b my-fix
|
|
17
|
+
```
|
|
18
|
+
3. Make your changes. Keep PRs focused — one logical change per PR.
|
|
19
|
+
4. Ensure tests pass (see [Development Setup](#development-setup)).
|
|
20
|
+
5. Commit using [Conventional Commits](https://www.conventionalcommits.org/):
|
|
21
|
+
```
|
|
22
|
+
feat: add new tool for batch memory retrieval
|
|
23
|
+
fix: handle empty query gracefully
|
|
24
|
+
docs: update configuration examples
|
|
25
|
+
refactor: extract lifespan into separate module
|
|
26
|
+
test: add edge case tests for write_memory
|
|
27
|
+
chore: bump dependencies
|
|
28
|
+
```
|
|
29
|
+
6. Open a PR against `main` and describe the change, the motivation, and any trade-offs.
|
|
30
|
+
|
|
31
|
+
## Development Setup
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
git clone https://github.com/hippmem/hippmem-mcp.git
|
|
35
|
+
cd hippmem-mcp
|
|
36
|
+
pip install -e ".[dev]"
|
|
37
|
+
pytest
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Requires Python ≥ 3.11. No GPU, API key, or network connection is needed — the deterministic fallback backend provides full offline coverage.
|
|
41
|
+
|
|
42
|
+
## Code Style
|
|
43
|
+
|
|
44
|
+
- Follow [PEP 8](https://peps.python.org/pep-0008/) with the idioms visible in the existing code.
|
|
45
|
+
- Use type annotations on all public function signatures.
|
|
46
|
+
- Code comments and documentation are in English.
|
|
47
|
+
- Match the surrounding code's naming, density, and idioms.
|
|
48
|
+
- Avoid `assert` for runtime validation — raise explicit exceptions.
|
|
49
|
+
|
|
50
|
+
## Commit Format
|
|
51
|
+
|
|
52
|
+
Follow [Conventional Commits](https://www.conventionalcommits.org/):
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
<type>: <short imperative summary>
|
|
56
|
+
|
|
57
|
+
<optional body explaining why and what trade-offs>
|
|
58
|
+
|
|
59
|
+
<optional footer>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Types: `feat`, `fix`, `docs`, `refactor`, `test`, `chore`, `perf`.
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
|
|
66
|
+
hippmem-mcp is licensed under Apache 2.0 (see [COPYRIGHT](COPYRIGHT)). By contributing, you agree that your contributions will be licensed under the same terms.
|
|
67
|
+
|
|
68
|
+
## DCO (Developer Certificate of Origin)
|
|
69
|
+
|
|
70
|
+
All commits must include a `Signed-off-by:` line certifying that you have the right to submit the contribution:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
feat: add new tool for batch memory retrieval
|
|
74
|
+
|
|
75
|
+
Signed-off-by: Your Name <you@example.com>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Add the line manually to your commit message, or use `git commit -s` to append it automatically. By signing off, you attest to the [Developer Certificate of Origin](https://developercertificate.org/) v1.1.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
hippmem_mcp-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hippmem-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for HIPPMEM — give AI tools long-term associative memory
|
|
5
|
+
Project-URL: Homepage, https://github.com/hippmem/hippmem-mcp
|
|
6
|
+
Project-URL: Repository, https://github.com/hippmem/hippmem-mcp
|
|
7
|
+
Author-email: hippmem <hippmem@gmail.com>
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
License-File: NOTICE
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Requires-Dist: hippmem>=0.1.0
|
|
18
|
+
Requires-Dist: mcp>=1.0.0
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: mcp[cli]>=1.0; extra == 'dev'
|
|
21
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# hippmem-mcp
|
|
25
|
+
|
|
26
|
+
**MCP server for [HIPPMEM](https://github.com/hippmem/hippmem) — give AI tools long-term associative memory.**
|
|
27
|
+
|
|
28
|
+
[](https://github.com/hippmem/hippmem-mcp/actions/workflows/ci.yml)
|
|
29
|
+
[](https://pypi.org/project/hippmem-mcp/)
|
|
30
|
+
[](https://pypi.org/project/hippmem-mcp/)
|
|
31
|
+
[](LICENSE)
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## What is HIPPMEM?
|
|
36
|
+
|
|
37
|
+
[HIPPMEM](https://github.com/hippmem/hippmem) is a native associative memory engine for AI agents, written in Rust. Instead of storing text chunks and searching them by vector similarity, it discovers associations between memories at write time and retrieves them via spreading activation at read time — so the AI recalls not just *what* was said, but *how things connect* and *why*.
|
|
38
|
+
|
|
39
|
+
It runs fully offline with a deterministic fallback backend.
|
|
40
|
+
|
|
41
|
+
## What is hippmem-mcp?
|
|
42
|
+
|
|
43
|
+
hippmem-mcp wraps HIPPMEM as a [Model Context Protocol](https://modelcontextprotocol.io/) server. Configure it once in Claude Desktop (or any MCP-compatible tool), and your AI assistant gains persistent, associative memory across sessions — no API key required.
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
AI Tool (Claude Desktop / VS Code / ...)
|
|
47
|
+
│ MCP protocol (stdio)
|
|
48
|
+
▼
|
|
49
|
+
hippmem-mcp
|
|
50
|
+
│ Python bindings
|
|
51
|
+
▼
|
|
52
|
+
hippmem Engine (Rust)
|
|
53
|
+
│
|
|
54
|
+
▼
|
|
55
|
+
Local storage (redb + Tantivy + HNSW)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Key Features
|
|
59
|
+
|
|
60
|
+
- **Zero config** — `pip install` then one JSON block in your MCP client configuration; deterministic fallback backend works offline
|
|
61
|
+
- **Write-time association discovery** — entities, topics, goals, causal links extracted and scored automatically
|
|
62
|
+
- **Spreading activation retrieval** — multi-channel seed recall (BM25 + entity + semantic + temporal + topic) fused by RRF
|
|
63
|
+
- **Graph evolution** — co-activated connections strengthen (Hebbian learning); stale edges decay
|
|
64
|
+
- **Explanation traces** — every result shows *why* it was recalled via `dimensions` and `matched_dimensions`
|
|
65
|
+
- **Single-file storage** — one redb file + Tantivy full-text index + HNSW vector index; no external database
|
|
66
|
+
|
|
67
|
+
## Install
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install hippmem-mcp
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Requires Python ≥ 3.11.
|
|
74
|
+
|
|
75
|
+
## Configure
|
|
76
|
+
|
|
77
|
+
### Claude Desktop
|
|
78
|
+
|
|
79
|
+
Add to `claude_desktop_config.json`:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"mcpServers": {
|
|
84
|
+
"hippmem": {
|
|
85
|
+
"command": "python",
|
|
86
|
+
"args": ["-m", "hippmem_mcp.server"]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Or use the entry point:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"mcpServers": {
|
|
97
|
+
"hippmem": {
|
|
98
|
+
"command": "hippmem-mcp"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Environment Variables
|
|
105
|
+
|
|
106
|
+
Copy `.env.example` to `.env` and configure:
|
|
107
|
+
|
|
108
|
+
| Variable | Default | Description |
|
|
109
|
+
|----------|---------|-------------|
|
|
110
|
+
| `HIPPMEM_EMBEDDING_PROVIDER` | *(empty = deterministic)* | Embedding backend: `openai-compatible` or leave empty for offline fallback |
|
|
111
|
+
| `HIPPMEM_EMBEDDING_BASE_URL` | `https://api.openai.com/v1` | API endpoint when using remote embeddings |
|
|
112
|
+
| `HIPPMEM_EMBEDDING_MODEL` | `text-embedding-3-small` | Model name for embeddings |
|
|
113
|
+
| `OPENAI_API_KEY` | *(none)* | API key for OpenAI-compatible embedding services |
|
|
114
|
+
|
|
115
|
+
The deterministic fallback backend requires no API key, no GPU, and no network connection.
|
|
116
|
+
|
|
117
|
+
### Other MCP Clients
|
|
118
|
+
|
|
119
|
+
hippmem-mcp speaks standard MCP over stdio. Configure any [MCP-compatible client](https://modelcontextprotocol.io/clients) the same way — point the `command` to `hippmem-mcp` or `python -m hippmem_mcp.server`.
|
|
120
|
+
|
|
121
|
+
## Tools
|
|
122
|
+
|
|
123
|
+
| Tool | Description |
|
|
124
|
+
|------|-------------|
|
|
125
|
+
| `write_memory` | Write a memory. The engine automatically discovers associations with existing memories. Supports `content_type` (Decision, Preference, ProjectKnowledge, TaskState, Correction, Event, Reflection) and `importance` (0.0–1.0). |
|
|
126
|
+
| `retrieve_memories` | Cross-session associative recall via multi-channel seed retrieval + spreading activation. Returns scored results with `dimensions` explaining *why* each memory was recalled. Supports `top_k` and `max_hops` tuning. |
|
|
127
|
+
|
|
128
|
+
## Development
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
git clone https://github.com/hippmem/hippmem-mcp.git
|
|
132
|
+
cd hippmem-mcp
|
|
133
|
+
pip install -e ".[dev]"
|
|
134
|
+
pytest
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for commit conventions, PR workflow, and DCO requirements.
|
|
138
|
+
|
|
139
|
+
## Documentation
|
|
140
|
+
|
|
141
|
+
- [HIPPMEM main project](https://github.com/hippmem/hippmem) — engine architecture, concepts, and API reference
|
|
142
|
+
- [MCP specification](https://modelcontextprotocol.io/) — Model Context Protocol
|
|
143
|
+
- [Changelog](CHANGELOG.md)
|
|
144
|
+
- [Security policy](SECURITY.md)
|
|
145
|
+
|
|
146
|
+
## License
|
|
147
|
+
|
|
148
|
+
Apache 2.0. See [LICENSE](LICENSE) and [COPYRIGHT](COPYRIGHT).
|
|
149
|
+
|
|
150
|
+
The underlying HIPPMEM engine (`hippmem`) is AGPL-3.0-only. A commercial license is available — contact hippmem@gmail.com.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# hippmem-mcp
|
|
2
|
+
|
|
3
|
+
**MCP server for [HIPPMEM](https://github.com/hippmem/hippmem) — give AI tools long-term associative memory.**
|
|
4
|
+
|
|
5
|
+
[](https://github.com/hippmem/hippmem-mcp/actions/workflows/ci.yml)
|
|
6
|
+
[](https://pypi.org/project/hippmem-mcp/)
|
|
7
|
+
[](https://pypi.org/project/hippmem-mcp/)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## What is HIPPMEM?
|
|
13
|
+
|
|
14
|
+
[HIPPMEM](https://github.com/hippmem/hippmem) is a native associative memory engine for AI agents, written in Rust. Instead of storing text chunks and searching them by vector similarity, it discovers associations between memories at write time and retrieves them via spreading activation at read time — so the AI recalls not just *what* was said, but *how things connect* and *why*.
|
|
15
|
+
|
|
16
|
+
It runs fully offline with a deterministic fallback backend.
|
|
17
|
+
|
|
18
|
+
## What is hippmem-mcp?
|
|
19
|
+
|
|
20
|
+
hippmem-mcp wraps HIPPMEM as a [Model Context Protocol](https://modelcontextprotocol.io/) server. Configure it once in Claude Desktop (or any MCP-compatible tool), and your AI assistant gains persistent, associative memory across sessions — no API key required.
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
AI Tool (Claude Desktop / VS Code / ...)
|
|
24
|
+
│ MCP protocol (stdio)
|
|
25
|
+
▼
|
|
26
|
+
hippmem-mcp
|
|
27
|
+
│ Python bindings
|
|
28
|
+
▼
|
|
29
|
+
hippmem Engine (Rust)
|
|
30
|
+
│
|
|
31
|
+
▼
|
|
32
|
+
Local storage (redb + Tantivy + HNSW)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Key Features
|
|
36
|
+
|
|
37
|
+
- **Zero config** — `pip install` then one JSON block in your MCP client configuration; deterministic fallback backend works offline
|
|
38
|
+
- **Write-time association discovery** — entities, topics, goals, causal links extracted and scored automatically
|
|
39
|
+
- **Spreading activation retrieval** — multi-channel seed recall (BM25 + entity + semantic + temporal + topic) fused by RRF
|
|
40
|
+
- **Graph evolution** — co-activated connections strengthen (Hebbian learning); stale edges decay
|
|
41
|
+
- **Explanation traces** — every result shows *why* it was recalled via `dimensions` and `matched_dimensions`
|
|
42
|
+
- **Single-file storage** — one redb file + Tantivy full-text index + HNSW vector index; no external database
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install hippmem-mcp
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Requires Python ≥ 3.11.
|
|
51
|
+
|
|
52
|
+
## Configure
|
|
53
|
+
|
|
54
|
+
### Claude Desktop
|
|
55
|
+
|
|
56
|
+
Add to `claude_desktop_config.json`:
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"mcpServers": {
|
|
61
|
+
"hippmem": {
|
|
62
|
+
"command": "python",
|
|
63
|
+
"args": ["-m", "hippmem_mcp.server"]
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Or use the entry point:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"mcpServers": {
|
|
74
|
+
"hippmem": {
|
|
75
|
+
"command": "hippmem-mcp"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Environment Variables
|
|
82
|
+
|
|
83
|
+
Copy `.env.example` to `.env` and configure:
|
|
84
|
+
|
|
85
|
+
| Variable | Default | Description |
|
|
86
|
+
|----------|---------|-------------|
|
|
87
|
+
| `HIPPMEM_EMBEDDING_PROVIDER` | *(empty = deterministic)* | Embedding backend: `openai-compatible` or leave empty for offline fallback |
|
|
88
|
+
| `HIPPMEM_EMBEDDING_BASE_URL` | `https://api.openai.com/v1` | API endpoint when using remote embeddings |
|
|
89
|
+
| `HIPPMEM_EMBEDDING_MODEL` | `text-embedding-3-small` | Model name for embeddings |
|
|
90
|
+
| `OPENAI_API_KEY` | *(none)* | API key for OpenAI-compatible embedding services |
|
|
91
|
+
|
|
92
|
+
The deterministic fallback backend requires no API key, no GPU, and no network connection.
|
|
93
|
+
|
|
94
|
+
### Other MCP Clients
|
|
95
|
+
|
|
96
|
+
hippmem-mcp speaks standard MCP over stdio. Configure any [MCP-compatible client](https://modelcontextprotocol.io/clients) the same way — point the `command` to `hippmem-mcp` or `python -m hippmem_mcp.server`.
|
|
97
|
+
|
|
98
|
+
## Tools
|
|
99
|
+
|
|
100
|
+
| Tool | Description |
|
|
101
|
+
|------|-------------|
|
|
102
|
+
| `write_memory` | Write a memory. The engine automatically discovers associations with existing memories. Supports `content_type` (Decision, Preference, ProjectKnowledge, TaskState, Correction, Event, Reflection) and `importance` (0.0–1.0). |
|
|
103
|
+
| `retrieve_memories` | Cross-session associative recall via multi-channel seed retrieval + spreading activation. Returns scored results with `dimensions` explaining *why* each memory was recalled. Supports `top_k` and `max_hops` tuning. |
|
|
104
|
+
|
|
105
|
+
## Development
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
git clone https://github.com/hippmem/hippmem-mcp.git
|
|
109
|
+
cd hippmem-mcp
|
|
110
|
+
pip install -e ".[dev]"
|
|
111
|
+
pytest
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for commit conventions, PR workflow, and DCO requirements.
|
|
115
|
+
|
|
116
|
+
## Documentation
|
|
117
|
+
|
|
118
|
+
- [HIPPMEM main project](https://github.com/hippmem/hippmem) — engine architecture, concepts, and API reference
|
|
119
|
+
- [MCP specification](https://modelcontextprotocol.io/) — Model Context Protocol
|
|
120
|
+
- [Changelog](CHANGELOG.md)
|
|
121
|
+
- [Security policy](SECURITY.md)
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
Apache 2.0. See [LICENSE](LICENSE) and [COPYRIGHT](COPYRIGHT).
|
|
126
|
+
|
|
127
|
+
The underlying HIPPMEM engine (`hippmem`) is AGPL-3.0-only. A commercial license is available — contact hippmem@gmail.com.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Reporting a Vulnerability
|
|
4
|
+
|
|
5
|
+
Please report security vulnerabilities to **hippmem@gmail.com**.
|
|
6
|
+
Do NOT open a public issue.
|
|
7
|
+
|
|
8
|
+
You will receive a response within 48 hours. We will keep you
|
|
9
|
+
informed of the progress toward a fix and public disclosure.
|
|
10
|
+
|
|
11
|
+
## Supported Versions
|
|
12
|
+
|
|
13
|
+
| Version | Supported |
|
|
14
|
+
|---------|--------------------|
|
|
15
|
+
| 0.1.x | :white_check_mark: |
|
|
16
|
+
|
|
17
|
+
## Disclosure Policy
|
|
18
|
+
|
|
19
|
+
We follow a coordinated disclosure process:
|
|
20
|
+
|
|
21
|
+
1. Reporter submits vulnerability via email.
|
|
22
|
+
2. We acknowledge within 48 hours.
|
|
23
|
+
3. We develop and test a fix.
|
|
24
|
+
4. We release the fix and publish an advisory.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Support
|
|
2
|
+
|
|
3
|
+
## Documentation
|
|
4
|
+
|
|
5
|
+
- [HIPPMEM main project](https://github.com/hippmem/hippmem) — engine architecture, concepts, API reference
|
|
6
|
+
- [README](README.md) — install, configure, and tool reference
|
|
7
|
+
- [Changelog](CHANGELOG.md)
|
|
8
|
+
|
|
9
|
+
## Getting Help
|
|
10
|
+
|
|
11
|
+
- **Questions & Discussions**: Open a [GitHub Discussion](https://github.com/hippmem/hippmem-mcp/discussions).
|
|
12
|
+
- **Bug Reports**: Open a [GitHub Issue](https://github.com/hippmem/hippmem-mcp/issues).
|
|
13
|
+
- **Security Issues**: See [SECURITY.md](SECURITY.md) — do NOT open a public issue.
|
|
14
|
+
- **Commercial Licensing**: Contact hippmem@gmail.com.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "hippmem-mcp"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "MCP server for HIPPMEM — give AI tools long-term associative memory"
|
|
9
|
+
authors = [{ name = "hippmem", email = "hippmem@gmail.com" }]
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
license = { text = "Apache-2.0" }
|
|
12
|
+
requires-python = ">=3.11"
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"License :: OSI Approved :: Apache Software License",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"hippmem>=0.1.0",
|
|
22
|
+
"mcp>=1.0.0",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://github.com/hippmem/hippmem-mcp"
|
|
27
|
+
Repository = "https://github.com/hippmem/hippmem-mcp"
|
|
28
|
+
|
|
29
|
+
[project.scripts]
|
|
30
|
+
hippmem-mcp = "hippmem_mcp.server:main"
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
dev = ["pytest>=7", "mcp[cli]>=1.0"]
|
|
File without changes
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"""HIPPMEM MCP server — give AI tools long-term associative memory.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
pip install hippmem-mcp
|
|
5
|
+
hippmem-mcp # stdio transport (for Claude Desktop etc.)
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from dataclasses import dataclass
|
|
9
|
+
from collections.abc import AsyncIterator
|
|
10
|
+
from contextlib import asynccontextmanager
|
|
11
|
+
|
|
12
|
+
from mcp.server.fastmcp import FastMCP
|
|
13
|
+
from hippmem import Engine
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@dataclass
|
|
17
|
+
class AppContext:
|
|
18
|
+
engine: Engine
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@asynccontextmanager
|
|
22
|
+
async def lifespan(server: FastMCP) -> AsyncIterator[AppContext]:
|
|
23
|
+
engine = Engine.open()
|
|
24
|
+
try:
|
|
25
|
+
yield AppContext(engine=engine)
|
|
26
|
+
finally:
|
|
27
|
+
engine.close()
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
mcp = FastMCP("hippmem", lifespan=lifespan)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@mcp.tool()
|
|
34
|
+
def write_memory(
|
|
35
|
+
content: str,
|
|
36
|
+
content_type: str | None = None,
|
|
37
|
+
importance: float | None = None,
|
|
38
|
+
) -> dict:
|
|
39
|
+
"""Write a memory to HIPPMEM.
|
|
40
|
+
|
|
41
|
+
The engine automatically discovers associations (entity, causal,
|
|
42
|
+
semantic, topic, temporal) with existing memories.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
content: The memory text to store.
|
|
46
|
+
content_type: One of Decision, Preference, ProjectKnowledge,
|
|
47
|
+
TaskState, Correction, Event, Reflection.
|
|
48
|
+
importance: 0.0-1.0 importance hint.
|
|
49
|
+
"""
|
|
50
|
+
ctx = mcp.get_context()
|
|
51
|
+
engine = ctx.request_context.lifespan_context.engine
|
|
52
|
+
out = engine.write(content, content_type=content_type, importance=importance)
|
|
53
|
+
return {
|
|
54
|
+
"memory_id": out.memory_id,
|
|
55
|
+
"links_created": out.links_count,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@mcp.tool()
|
|
60
|
+
def retrieve_memories(
|
|
61
|
+
query: str,
|
|
62
|
+
top_k: int = 5,
|
|
63
|
+
max_hops: int | None = None,
|
|
64
|
+
) -> list[dict]:
|
|
65
|
+
"""Retrieve memories via multi-channel associative recall.
|
|
66
|
+
|
|
67
|
+
Finds not just keyword matches, but memories connected by entity,
|
|
68
|
+
causal, semantic, and temporal associations. Returns WHY, not just WHAT.
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
query: Natural-language search query.
|
|
72
|
+
top_k: Maximum number of results.
|
|
73
|
+
max_hops: Graph traversal depth (None = auto).
|
|
74
|
+
"""
|
|
75
|
+
ctx = mcp.get_context()
|
|
76
|
+
engine = ctx.request_context.lifespan_context.engine
|
|
77
|
+
results = engine.retrieve(query, top_k=top_k, max_hops=max_hops)
|
|
78
|
+
return [
|
|
79
|
+
{
|
|
80
|
+
"memory_id": r.memory_id,
|
|
81
|
+
"score": round(r.score, 3),
|
|
82
|
+
"content": r.content,
|
|
83
|
+
"content_type": r.content_type,
|
|
84
|
+
"dimensions": r.dimensions,
|
|
85
|
+
}
|
|
86
|
+
for r in results.results
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def main():
|
|
91
|
+
"""Entry point. Run with stdio transport."""
|
|
92
|
+
mcp.run()
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
if __name__ == "__main__":
|
|
96
|
+
main()
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"""Tests for hippmem-mcp server."""
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
from hippmem_mcp.server import mcp
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TestServerMetadata:
|
|
8
|
+
def test_server_name(self):
|
|
9
|
+
assert mcp.name == "hippmem"
|
|
10
|
+
|
|
11
|
+
def test_version(self):
|
|
12
|
+
from hippmem_mcp import __version__
|
|
13
|
+
assert isinstance(__version__, str)
|
|
14
|
+
assert len(__version__) > 0
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class TestToolsRegistration:
|
|
18
|
+
def test_write_memory_tool(self):
|
|
19
|
+
tools = mcp._tool_manager._tools
|
|
20
|
+
assert "write_memory" in tools
|
|
21
|
+
|
|
22
|
+
def test_retrieve_memories_tool(self):
|
|
23
|
+
tools = mcp._tool_manager._tools
|
|
24
|
+
assert "retrieve_memories" in tools
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class TestWriteMemoryFunctional:
|
|
28
|
+
def test_basic_write(self):
|
|
29
|
+
result = write_memory_standalone("Test memory")
|
|
30
|
+
assert "memory_id" in result
|
|
31
|
+
assert isinstance(result["links_created"], int)
|
|
32
|
+
|
|
33
|
+
def test_write_with_content_type(self):
|
|
34
|
+
result = write_memory_standalone("Decide to use Rust", content_type="Decision")
|
|
35
|
+
assert "memory_id" in result
|
|
36
|
+
|
|
37
|
+
def test_write_empty_content(self):
|
|
38
|
+
result = write_memory_standalone("")
|
|
39
|
+
assert "memory_id" in result
|
|
40
|
+
|
|
41
|
+
def test_write_long_content(self):
|
|
42
|
+
long_text = "The user prefers Rust for development. " * 50
|
|
43
|
+
result = write_memory_standalone(long_text)
|
|
44
|
+
assert "memory_id" in result
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class TestRetrieveMemoriesFunctional:
|
|
48
|
+
def test_retrieve_after_write(self):
|
|
49
|
+
write_memory_standalone("The user prefers Rust for development.")
|
|
50
|
+
results = retrieve_memories_standalone("What does the user prefer?")
|
|
51
|
+
assert len(results) > 0
|
|
52
|
+
r = results[0]
|
|
53
|
+
assert "memory_id" in r
|
|
54
|
+
assert "score" in r
|
|
55
|
+
assert "content" in r
|
|
56
|
+
assert "dimensions" in r
|
|
57
|
+
|
|
58
|
+
def test_retrieve_with_top_k(self):
|
|
59
|
+
for i in range(5):
|
|
60
|
+
write_memory_standalone(f"Memory {i}: test content for retrieval tuning.")
|
|
61
|
+
results = retrieve_memories_standalone("test content", top_k=3)
|
|
62
|
+
assert len(results) <= 3
|
|
63
|
+
|
|
64
|
+
def test_retrieve_no_match(self):
|
|
65
|
+
results = retrieve_memories_standalone("xyzzy_nonexistent_query_12345")
|
|
66
|
+
# Should return results (possibly low-scoring), not throw
|
|
67
|
+
assert isinstance(results, list)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class TestToolSignature:
|
|
71
|
+
def test_write_memory_parameters(self):
|
|
72
|
+
fn = mcp._tool_manager._tools["write_memory"].fn
|
|
73
|
+
import inspect
|
|
74
|
+
sig = inspect.signature(fn)
|
|
75
|
+
params = list(sig.parameters.keys())
|
|
76
|
+
assert "content" in params
|
|
77
|
+
|
|
78
|
+
def test_retrieve_memories_parameters(self):
|
|
79
|
+
fn = mcp._tool_manager._tools["retrieve_memories"].fn
|
|
80
|
+
import inspect
|
|
81
|
+
sig = inspect.signature(fn)
|
|
82
|
+
params = list(sig.parameters.keys())
|
|
83
|
+
assert "query" in params
|
|
84
|
+
assert "top_k" in params
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
# ---------------------------------------------------------------------------
|
|
88
|
+
# Standalone helpers that bypass FastMCP context for functional testing
|
|
89
|
+
# ---------------------------------------------------------------------------
|
|
90
|
+
|
|
91
|
+
def write_memory_standalone(content, content_type=None, importance=None):
|
|
92
|
+
e = _get_test_engine()
|
|
93
|
+
out = e.write(content, content_type=content_type, importance=importance)
|
|
94
|
+
return {"memory_id": out.memory_id, "links_created": out.links_count}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def retrieve_memories_standalone(query, top_k=5):
|
|
98
|
+
e = _get_test_engine()
|
|
99
|
+
results = e.retrieve(query, top_k=top_k)
|
|
100
|
+
return [
|
|
101
|
+
{
|
|
102
|
+
"memory_id": r.memory_id,
|
|
103
|
+
"score": round(r.score, 3),
|
|
104
|
+
"content": r.content,
|
|
105
|
+
"content_type": r.content_type,
|
|
106
|
+
"dimensions": r.dimensions,
|
|
107
|
+
}
|
|
108
|
+
for r in results.results
|
|
109
|
+
]
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
_test_engine = None
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def _get_test_engine():
|
|
116
|
+
global _test_engine
|
|
117
|
+
if _test_engine is None:
|
|
118
|
+
from hippmem import Engine
|
|
119
|
+
import tempfile, os
|
|
120
|
+
tmpdir = tempfile.mkdtemp()
|
|
121
|
+
_test_engine = Engine.open(os.path.join(tmpdir, "test.redb"))
|
|
122
|
+
return _test_engine
|