neruva-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.
- neruva_mcp-0.1.0/LICENSE +21 -0
- neruva_mcp-0.1.0/MANIFEST.in +9 -0
- neruva_mcp-0.1.0/PKG-INFO +80 -0
- neruva_mcp-0.1.0/README.md +54 -0
- neruva_mcp-0.1.0/pyproject.toml +52 -0
- neruva_mcp-0.1.0/setup.cfg +4 -0
- neruva_mcp-0.1.0/src/neruva_mcp/__init__.py +6 -0
- neruva_mcp-0.1.0/src/neruva_mcp/py.typed +0 -0
- neruva_mcp-0.1.0/src/neruva_mcp/server.py +321 -0
- neruva_mcp-0.1.0/src/neruva_mcp.egg-info/PKG-INFO +80 -0
- neruva_mcp-0.1.0/src/neruva_mcp.egg-info/SOURCES.txt +13 -0
- neruva_mcp-0.1.0/src/neruva_mcp.egg-info/dependency_links.txt +1 -0
- neruva_mcp-0.1.0/src/neruva_mcp.egg-info/entry_points.txt +2 -0
- neruva_mcp-0.1.0/src/neruva_mcp.egg-info/requires.txt +2 -0
- neruva_mcp-0.1.0/src/neruva_mcp.egg-info/top_level.txt +1 -0
neruva_mcp-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Clouthier Simulation Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: neruva-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Model Context Protocol server for Neruva — vector memory + HD-native substrate (KGs, analogy, causal do-operator, EFE planning).
|
|
5
|
+
Author-email: Clouthier Simulation Labs <info@neruva.io>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://neruva.io/integrations/
|
|
8
|
+
Project-URL: Documentation, https://neruva.io/docs/
|
|
9
|
+
Project-URL: Source, https://github.com/CloutSimLabs/neruva
|
|
10
|
+
Keywords: mcp,model-context-protocol,neruva,vector-database,agent-memory,knowledge-graph,ai
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: mcp>=1.0.0
|
|
24
|
+
Requires-Dist: httpx>=0.27
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# neruva-mcp
|
|
28
|
+
|
|
29
|
+
Model Context Protocol server for [Neruva](https://neruva.io) — vector memory + HD-native substrate. Same 8 tools as the TypeScript package, for Python-only MCP hosts (e.g. Codex, custom agents).
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install neruva-mcp
|
|
35
|
+
export NERUVA_API_KEY=... # from https://app.neruva.io
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or zero-install via `uvx`:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
uvx neruva-mcp
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Use
|
|
45
|
+
|
|
46
|
+
Add to your MCP host's config. Example for Claude Code:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
claude mcp add neruva -- uvx neruva-mcp -e NERUVA_API_KEY=YOUR_KEY
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or run directly:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
NERUVA_API_KEY=YOUR_KEY neruva-mcp
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Tools
|
|
59
|
+
|
|
60
|
+
| Tool | What it does |
|
|
61
|
+
|---|---|
|
|
62
|
+
| `memory_upsert` | Insert/update vectors in a namespace (Pinecone-compatible) |
|
|
63
|
+
| `memory_query` | Top-K cosine search |
|
|
64
|
+
| `memory_delete` | Delete by id |
|
|
65
|
+
| `hd_kg_add_fact` | Add (subject, relation, object) to a KG |
|
|
66
|
+
| `hd_kg_query` | Query KG for object of (subject, relation) |
|
|
67
|
+
| `hd_analogy` | Four-term analogy in HD feature space |
|
|
68
|
+
| `hd_causal_query` | Observational / interventional query on stored SCM |
|
|
69
|
+
| `hd_plan` | EFE active-inference planner |
|
|
70
|
+
|
|
71
|
+
## Env
|
|
72
|
+
|
|
73
|
+
| Variable | Default |
|
|
74
|
+
|---|---|
|
|
75
|
+
| `NERUVA_API_KEY` | required |
|
|
76
|
+
| `NERUVA_URL` | `https://api.neruva.io` |
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
MIT — Clouthier Simulation Labs.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# neruva-mcp
|
|
2
|
+
|
|
3
|
+
Model Context Protocol server for [Neruva](https://neruva.io) — vector memory + HD-native substrate. Same 8 tools as the TypeScript package, for Python-only MCP hosts (e.g. Codex, custom agents).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install neruva-mcp
|
|
9
|
+
export NERUVA_API_KEY=... # from https://app.neruva.io
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Or zero-install via `uvx`:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
uvx neruva-mcp
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Use
|
|
19
|
+
|
|
20
|
+
Add to your MCP host's config. Example for Claude Code:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
claude mcp add neruva -- uvx neruva-mcp -e NERUVA_API_KEY=YOUR_KEY
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or run directly:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
NERUVA_API_KEY=YOUR_KEY neruva-mcp
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Tools
|
|
33
|
+
|
|
34
|
+
| Tool | What it does |
|
|
35
|
+
|---|---|
|
|
36
|
+
| `memory_upsert` | Insert/update vectors in a namespace (Pinecone-compatible) |
|
|
37
|
+
| `memory_query` | Top-K cosine search |
|
|
38
|
+
| `memory_delete` | Delete by id |
|
|
39
|
+
| `hd_kg_add_fact` | Add (subject, relation, object) to a KG |
|
|
40
|
+
| `hd_kg_query` | Query KG for object of (subject, relation) |
|
|
41
|
+
| `hd_analogy` | Four-term analogy in HD feature space |
|
|
42
|
+
| `hd_causal_query` | Observational / interventional query on stored SCM |
|
|
43
|
+
| `hd_plan` | EFE active-inference planner |
|
|
44
|
+
|
|
45
|
+
## Env
|
|
46
|
+
|
|
47
|
+
| Variable | Default |
|
|
48
|
+
|---|---|
|
|
49
|
+
| `NERUVA_API_KEY` | required |
|
|
50
|
+
| `NERUVA_URL` | `https://api.neruva.io` |
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
MIT — Clouthier Simulation Labs.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "neruva-mcp"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Model Context Protocol server for Neruva — vector memory + HD-native substrate (KGs, analogy, causal do-operator, EFE planning)."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Clouthier Simulation Labs", email = "info@neruva.io" },
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"mcp",
|
|
17
|
+
"model-context-protocol",
|
|
18
|
+
"neruva",
|
|
19
|
+
"vector-database",
|
|
20
|
+
"agent-memory",
|
|
21
|
+
"knowledge-graph",
|
|
22
|
+
"ai",
|
|
23
|
+
]
|
|
24
|
+
classifiers = [
|
|
25
|
+
"Development Status :: 4 - Beta",
|
|
26
|
+
"Intended Audience :: Developers",
|
|
27
|
+
"License :: OSI Approved :: MIT License",
|
|
28
|
+
"Operating System :: OS Independent",
|
|
29
|
+
"Programming Language :: Python :: 3",
|
|
30
|
+
"Programming Language :: Python :: 3.10",
|
|
31
|
+
"Programming Language :: Python :: 3.11",
|
|
32
|
+
"Programming Language :: Python :: 3.12",
|
|
33
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
34
|
+
]
|
|
35
|
+
dependencies = [
|
|
36
|
+
"mcp>=1.0.0",
|
|
37
|
+
"httpx>=0.27",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
Homepage = "https://neruva.io/integrations/"
|
|
42
|
+
Documentation = "https://neruva.io/docs/"
|
|
43
|
+
Source = "https://github.com/CloutSimLabs/neruva"
|
|
44
|
+
|
|
45
|
+
[project.scripts]
|
|
46
|
+
neruva-mcp = "neruva_mcp.server:main"
|
|
47
|
+
|
|
48
|
+
[tool.setuptools.packages.find]
|
|
49
|
+
where = ["src"]
|
|
50
|
+
|
|
51
|
+
[tool.setuptools.package-data]
|
|
52
|
+
neruva_mcp = ["py.typed"]
|
|
File without changes
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
"""Neruva MCP server.
|
|
2
|
+
|
|
3
|
+
Exposes Neruva Memory + HD Substrate to any MCP-aware host as a small
|
|
4
|
+
set of tools. Pure thin wrapper over the REST API at api.neruva.io --
|
|
5
|
+
this process holds NO algorithmic state and imports nothing from the
|
|
6
|
+
substrate core. The hard work happens server-side; this is just glue.
|
|
7
|
+
|
|
8
|
+
Env:
|
|
9
|
+
NERUVA_API_KEY required, your key from app.neruva.io
|
|
10
|
+
NERUVA_URL optional, defaults to https://api.neruva.io
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import asyncio
|
|
16
|
+
import json
|
|
17
|
+
import os
|
|
18
|
+
import sys
|
|
19
|
+
from typing import Any
|
|
20
|
+
from urllib.parse import quote
|
|
21
|
+
|
|
22
|
+
import httpx
|
|
23
|
+
from mcp.server import Server
|
|
24
|
+
from mcp.server.stdio import stdio_server
|
|
25
|
+
from mcp.types import TextContent, Tool
|
|
26
|
+
|
|
27
|
+
API_KEY = os.environ.get("NERUVA_API_KEY")
|
|
28
|
+
BASE_URL = os.environ.get("NERUVA_URL", "https://api.neruva.io").rstrip("/")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _enc(s: str) -> str:
|
|
32
|
+
return quote(s, safe="")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
async def _call(
|
|
36
|
+
client: httpx.AsyncClient,
|
|
37
|
+
method: str,
|
|
38
|
+
path: str,
|
|
39
|
+
body: Any | None = None,
|
|
40
|
+
) -> Any:
|
|
41
|
+
headers = {"Api-Key": API_KEY or ""}
|
|
42
|
+
if body is not None:
|
|
43
|
+
headers["Content-Type"] = "application/json"
|
|
44
|
+
r = await client.request(method, BASE_URL + path, headers=headers, json=body)
|
|
45
|
+
if r.status_code >= 400:
|
|
46
|
+
raise RuntimeError(f"{method} {path} -> {r.status_code}: {r.text}")
|
|
47
|
+
try:
|
|
48
|
+
return r.json()
|
|
49
|
+
except Exception:
|
|
50
|
+
return r.text
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
TOOLS: list[Tool] = [
|
|
54
|
+
Tool(
|
|
55
|
+
name="memory_upsert",
|
|
56
|
+
description="Insert or update vectors in a Neruva Memory namespace. Pinecone-compatible payload.",
|
|
57
|
+
inputSchema={
|
|
58
|
+
"type": "object",
|
|
59
|
+
"properties": {
|
|
60
|
+
"index": {"type": "string", "description": "Index name"},
|
|
61
|
+
"namespace": {"type": "string", "description": "Namespace (one per agent)"},
|
|
62
|
+
"vectors": {
|
|
63
|
+
"type": "array",
|
|
64
|
+
"description": "Vectors: {id, values, metadata?}",
|
|
65
|
+
"items": {
|
|
66
|
+
"type": "object",
|
|
67
|
+
"properties": {
|
|
68
|
+
"id": {"type": "string"},
|
|
69
|
+
"values": {"type": "array", "items": {"type": "number"}},
|
|
70
|
+
"metadata": {"type": "object"},
|
|
71
|
+
},
|
|
72
|
+
"required": ["id", "values"],
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
"required": ["index", "namespace", "vectors"],
|
|
77
|
+
},
|
|
78
|
+
),
|
|
79
|
+
Tool(
|
|
80
|
+
name="memory_query",
|
|
81
|
+
description="Cosine-search a namespace by vector. Returns top-K matches with metadata.",
|
|
82
|
+
inputSchema={
|
|
83
|
+
"type": "object",
|
|
84
|
+
"properties": {
|
|
85
|
+
"index": {"type": "string"},
|
|
86
|
+
"namespace": {"type": "string"},
|
|
87
|
+
"vector": {"type": "array", "items": {"type": "number"}},
|
|
88
|
+
"topK": {"type": "integer", "default": 10},
|
|
89
|
+
"includeMetadata": {"type": "boolean", "default": True},
|
|
90
|
+
},
|
|
91
|
+
"required": ["index", "namespace", "vector"],
|
|
92
|
+
},
|
|
93
|
+
),
|
|
94
|
+
Tool(
|
|
95
|
+
name="memory_delete",
|
|
96
|
+
description="Delete vectors by id from a namespace.",
|
|
97
|
+
inputSchema={
|
|
98
|
+
"type": "object",
|
|
99
|
+
"properties": {
|
|
100
|
+
"index": {"type": "string"},
|
|
101
|
+
"namespace": {"type": "string"},
|
|
102
|
+
"ids": {"type": "array", "items": {"type": "string"}},
|
|
103
|
+
},
|
|
104
|
+
"required": ["index", "namespace", "ids"],
|
|
105
|
+
},
|
|
106
|
+
),
|
|
107
|
+
Tool(
|
|
108
|
+
name="hd_kg_add_fact",
|
|
109
|
+
description="Add a (subject, relation, object) fact to a knowledge graph. Persists across restarts.",
|
|
110
|
+
inputSchema={
|
|
111
|
+
"type": "object",
|
|
112
|
+
"properties": {
|
|
113
|
+
"kg": {"type": "string", "description": "Knowledge-graph name"},
|
|
114
|
+
"subject": {"type": "string"},
|
|
115
|
+
"relation": {"type": "string"},
|
|
116
|
+
"object": {"type": "string"},
|
|
117
|
+
},
|
|
118
|
+
"required": ["kg", "subject", "relation", "object"],
|
|
119
|
+
},
|
|
120
|
+
),
|
|
121
|
+
Tool(
|
|
122
|
+
name="hd_kg_query",
|
|
123
|
+
description="Query a knowledge graph for the object of (subject, relation). Returns object + confidence.",
|
|
124
|
+
inputSchema={
|
|
125
|
+
"type": "object",
|
|
126
|
+
"properties": {
|
|
127
|
+
"kg": {"type": "string"},
|
|
128
|
+
"subject": {"type": "string"},
|
|
129
|
+
"relation": {"type": "string"},
|
|
130
|
+
},
|
|
131
|
+
"required": ["kg", "subject", "relation"],
|
|
132
|
+
},
|
|
133
|
+
),
|
|
134
|
+
Tool(
|
|
135
|
+
name="hd_analogy",
|
|
136
|
+
description=(
|
|
137
|
+
"Solve a four-term analogy in HD feature space: a is to b as c is to ? "
|
|
138
|
+
"Items are integer feature IDs in [0, 2^n_feat). Returns the cleaned-up "
|
|
139
|
+
"candidate plus cosine, runner-up cosine, and a confidence gap."
|
|
140
|
+
),
|
|
141
|
+
inputSchema={
|
|
142
|
+
"type": "object",
|
|
143
|
+
"properties": {
|
|
144
|
+
"n_feat": {"type": "integer", "description": "Number of binary features. Item space size is 2^n_feat."},
|
|
145
|
+
"a": {"type": "integer"},
|
|
146
|
+
"b": {"type": "integer"},
|
|
147
|
+
"c": {"type": "integer"},
|
|
148
|
+
"seed": {"type": "integer", "default": 4301},
|
|
149
|
+
},
|
|
150
|
+
"required": ["n_feat", "a", "b", "c"],
|
|
151
|
+
},
|
|
152
|
+
),
|
|
153
|
+
Tool(
|
|
154
|
+
name="hd_causal_query",
|
|
155
|
+
description=(
|
|
156
|
+
"Run an observational or interventional query against a stored causal model. "
|
|
157
|
+
"query_type is 'observation' or 'intervention' -- arithmetically distinct."
|
|
158
|
+
),
|
|
159
|
+
inputSchema={
|
|
160
|
+
"type": "object",
|
|
161
|
+
"properties": {
|
|
162
|
+
"scm": {"type": "string", "description": "Causal-model name"},
|
|
163
|
+
"query_type": {"type": "string", "enum": ["observation", "intervention"]},
|
|
164
|
+
"condition_var": {"type": "integer"},
|
|
165
|
+
"condition_value": {"type": "integer"},
|
|
166
|
+
"query_var": {"type": "integer"},
|
|
167
|
+
"query_value": {"type": "integer"},
|
|
168
|
+
},
|
|
169
|
+
"required": [
|
|
170
|
+
"scm",
|
|
171
|
+
"query_type",
|
|
172
|
+
"condition_var",
|
|
173
|
+
"condition_value",
|
|
174
|
+
"query_var",
|
|
175
|
+
"query_value",
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
),
|
|
179
|
+
Tool(
|
|
180
|
+
name="hd_plan",
|
|
181
|
+
description="Plan a sequence of actions toward a goal using the EFE active-inference planner.",
|
|
182
|
+
inputSchema={
|
|
183
|
+
"type": "object",
|
|
184
|
+
"properties": {
|
|
185
|
+
"model": {"type": "string", "description": "Planner-model name"},
|
|
186
|
+
"start": {"type": "object", "description": "Start state"},
|
|
187
|
+
"goal": {"type": "object", "description": "Goal state"},
|
|
188
|
+
"horizon": {"type": "integer", "default": 4},
|
|
189
|
+
},
|
|
190
|
+
"required": ["model", "start", "goal"],
|
|
191
|
+
},
|
|
192
|
+
),
|
|
193
|
+
]
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
async def _dispatch(client: httpx.AsyncClient, name: str, args: dict[str, Any]) -> Any:
|
|
197
|
+
if name == "memory_upsert":
|
|
198
|
+
return await _call(
|
|
199
|
+
client,
|
|
200
|
+
"POST",
|
|
201
|
+
f"/v1/indexes/{_enc(args['index'])}/namespaces/{_enc(args['namespace'])}/upsert",
|
|
202
|
+
{"vectors": args["vectors"]},
|
|
203
|
+
)
|
|
204
|
+
if name == "memory_query":
|
|
205
|
+
return await _call(
|
|
206
|
+
client,
|
|
207
|
+
"POST",
|
|
208
|
+
f"/v1/indexes/{_enc(args['index'])}/namespaces/{_enc(args['namespace'])}/query",
|
|
209
|
+
{
|
|
210
|
+
"vector": args["vector"],
|
|
211
|
+
"topK": args.get("topK", 10),
|
|
212
|
+
"includeMetadata": args.get("includeMetadata", True),
|
|
213
|
+
},
|
|
214
|
+
)
|
|
215
|
+
if name == "memory_delete":
|
|
216
|
+
return await _call(
|
|
217
|
+
client,
|
|
218
|
+
"POST",
|
|
219
|
+
f"/v1/indexes/{_enc(args['index'])}/namespaces/{_enc(args['namespace'])}/delete",
|
|
220
|
+
{"ids": args["ids"]},
|
|
221
|
+
)
|
|
222
|
+
if name == "hd_kg_add_fact":
|
|
223
|
+
return await _call(
|
|
224
|
+
client,
|
|
225
|
+
"POST",
|
|
226
|
+
f"/v1/hd/kg/{_enc(args['kg'])}/facts",
|
|
227
|
+
{
|
|
228
|
+
"facts": [
|
|
229
|
+
{
|
|
230
|
+
"subject": args["subject"],
|
|
231
|
+
"relation": args["relation"],
|
|
232
|
+
"object": args["object"],
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
)
|
|
237
|
+
if name == "hd_kg_query":
|
|
238
|
+
return await _call(
|
|
239
|
+
client,
|
|
240
|
+
"POST",
|
|
241
|
+
f"/v1/hd/kg/{_enc(args['kg'])}/query",
|
|
242
|
+
{"subject": args["subject"], "relation": args["relation"]},
|
|
243
|
+
)
|
|
244
|
+
if name == "hd_analogy":
|
|
245
|
+
return await _call(
|
|
246
|
+
client,
|
|
247
|
+
"POST",
|
|
248
|
+
"/v1/hd/analogy",
|
|
249
|
+
{
|
|
250
|
+
"n_feat": args["n_feat"],
|
|
251
|
+
"a": args["a"],
|
|
252
|
+
"b": args["b"],
|
|
253
|
+
"c": args["c"],
|
|
254
|
+
"seed": args.get("seed", 4301),
|
|
255
|
+
},
|
|
256
|
+
)
|
|
257
|
+
if name == "hd_causal_query":
|
|
258
|
+
return await _call(
|
|
259
|
+
client,
|
|
260
|
+
"POST",
|
|
261
|
+
f"/v1/hd/causal/{_enc(args['scm'])}/query",
|
|
262
|
+
{
|
|
263
|
+
"query_type": args["query_type"],
|
|
264
|
+
"condition_var": args["condition_var"],
|
|
265
|
+
"condition_value": args["condition_value"],
|
|
266
|
+
"query_var": args["query_var"],
|
|
267
|
+
"query_value": args["query_value"],
|
|
268
|
+
},
|
|
269
|
+
)
|
|
270
|
+
if name == "hd_plan":
|
|
271
|
+
return await _call(
|
|
272
|
+
client,
|
|
273
|
+
"POST",
|
|
274
|
+
f"/v1/hd/plan/{_enc(args['model'])}",
|
|
275
|
+
{
|
|
276
|
+
"start": args["start"],
|
|
277
|
+
"goal": args["goal"],
|
|
278
|
+
"horizon": args.get("horizon", 4),
|
|
279
|
+
},
|
|
280
|
+
)
|
|
281
|
+
raise ValueError(f"unknown tool: {name}")
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
async def _run() -> None:
|
|
285
|
+
if not API_KEY:
|
|
286
|
+
print(
|
|
287
|
+
"[neruva-mcp] NERUVA_API_KEY not set. Get one at https://app.neruva.io",
|
|
288
|
+
file=sys.stderr,
|
|
289
|
+
)
|
|
290
|
+
sys.exit(1)
|
|
291
|
+
|
|
292
|
+
server: Server = Server("neruva")
|
|
293
|
+
|
|
294
|
+
@server.list_tools()
|
|
295
|
+
async def list_tools() -> list[Tool]:
|
|
296
|
+
return TOOLS
|
|
297
|
+
|
|
298
|
+
async with httpx.AsyncClient(timeout=60.0) as client:
|
|
299
|
+
|
|
300
|
+
@server.call_tool()
|
|
301
|
+
async def call_tool(name: str, arguments: dict[str, Any]) -> list[TextContent]:
|
|
302
|
+
try:
|
|
303
|
+
result = await _dispatch(client, name, arguments or {})
|
|
304
|
+
return [TextContent(type="text", text=json.dumps(result, indent=2))]
|
|
305
|
+
except Exception as e:
|
|
306
|
+
return [TextContent(type="text", text=f"error: {e}")]
|
|
307
|
+
|
|
308
|
+
async with stdio_server() as (read_stream, write_stream):
|
|
309
|
+
await server.run(
|
|
310
|
+
read_stream,
|
|
311
|
+
write_stream,
|
|
312
|
+
server.create_initialization_options(),
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
def main() -> None:
|
|
317
|
+
asyncio.run(_run())
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
if __name__ == "__main__":
|
|
321
|
+
main()
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: neruva-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Model Context Protocol server for Neruva — vector memory + HD-native substrate (KGs, analogy, causal do-operator, EFE planning).
|
|
5
|
+
Author-email: Clouthier Simulation Labs <info@neruva.io>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://neruva.io/integrations/
|
|
8
|
+
Project-URL: Documentation, https://neruva.io/docs/
|
|
9
|
+
Project-URL: Source, https://github.com/CloutSimLabs/neruva
|
|
10
|
+
Keywords: mcp,model-context-protocol,neruva,vector-database,agent-memory,knowledge-graph,ai
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: mcp>=1.0.0
|
|
24
|
+
Requires-Dist: httpx>=0.27
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# neruva-mcp
|
|
28
|
+
|
|
29
|
+
Model Context Protocol server for [Neruva](https://neruva.io) — vector memory + HD-native substrate. Same 8 tools as the TypeScript package, for Python-only MCP hosts (e.g. Codex, custom agents).
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install neruva-mcp
|
|
35
|
+
export NERUVA_API_KEY=... # from https://app.neruva.io
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or zero-install via `uvx`:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
uvx neruva-mcp
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Use
|
|
45
|
+
|
|
46
|
+
Add to your MCP host's config. Example for Claude Code:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
claude mcp add neruva -- uvx neruva-mcp -e NERUVA_API_KEY=YOUR_KEY
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or run directly:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
NERUVA_API_KEY=YOUR_KEY neruva-mcp
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Tools
|
|
59
|
+
|
|
60
|
+
| Tool | What it does |
|
|
61
|
+
|---|---|
|
|
62
|
+
| `memory_upsert` | Insert/update vectors in a namespace (Pinecone-compatible) |
|
|
63
|
+
| `memory_query` | Top-K cosine search |
|
|
64
|
+
| `memory_delete` | Delete by id |
|
|
65
|
+
| `hd_kg_add_fact` | Add (subject, relation, object) to a KG |
|
|
66
|
+
| `hd_kg_query` | Query KG for object of (subject, relation) |
|
|
67
|
+
| `hd_analogy` | Four-term analogy in HD feature space |
|
|
68
|
+
| `hd_causal_query` | Observational / interventional query on stored SCM |
|
|
69
|
+
| `hd_plan` | EFE active-inference planner |
|
|
70
|
+
|
|
71
|
+
## Env
|
|
72
|
+
|
|
73
|
+
| Variable | Default |
|
|
74
|
+
|---|---|
|
|
75
|
+
| `NERUVA_API_KEY` | required |
|
|
76
|
+
| `NERUVA_URL` | `https://api.neruva.io` |
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
MIT — Clouthier Simulation Labs.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
src/neruva_mcp/__init__.py
|
|
6
|
+
src/neruva_mcp/py.typed
|
|
7
|
+
src/neruva_mcp/server.py
|
|
8
|
+
src/neruva_mcp.egg-info/PKG-INFO
|
|
9
|
+
src/neruva_mcp.egg-info/SOURCES.txt
|
|
10
|
+
src/neruva_mcp.egg-info/dependency_links.txt
|
|
11
|
+
src/neruva_mcp.egg-info/entry_points.txt
|
|
12
|
+
src/neruva_mcp.egg-info/requires.txt
|
|
13
|
+
src/neruva_mcp.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
neruva_mcp
|