hebbrix-mcp 0.3.1__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.
@@ -0,0 +1,25 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.so
5
+ .Python
6
+ venv/
7
+ .venv/
8
+ env/
9
+ ENV/
10
+ .env
11
+ .env.local
12
+ build/
13
+ dist/
14
+ *.egg-info/
15
+ *.egg
16
+ .pytest_cache/
17
+ .mypy_cache/
18
+ .ruff_cache/
19
+ .coverage
20
+ htmlcov/
21
+ .DS_Store
22
+ .idea/
23
+ .vscode/
24
+ *.swp
25
+ *.swo
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hebbrix
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,294 @@
1
+ Metadata-Version: 2.4
2
+ Name: hebbrix-mcp
3
+ Version: 0.3.1
4
+ Summary: Hebbrix MCP server — long-term memory and knowledge graph for any MCP-compatible agent (Claude Desktop, Cline, Cursor, etc.)
5
+ Project-URL: Homepage, https://www.hebbrix.com
6
+ Project-URL: Documentation, https://www.hebbrix.com/integrations/mcp
7
+ Project-URL: Repository, https://github.com/Hebbrix/hebbrix-mcp
8
+ Project-URL: Issues, https://github.com/Hebbrix/hebbrix-mcp/issues
9
+ Author-email: Hebbrix <support@hebbrix.com>
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: ai-agents,claude,cline,cursor,hebbrix,long-term-memory,mcp,memory,model-context-protocol
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: httpx>=0.27
25
+ Requires-Dist: mcp[cli]>=1.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
28
+ Requires-Dist: pytest>=8.0; extra == 'dev'
29
+ Requires-Dist: ruff>=0.5; extra == 'dev'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # hebbrix-mcp
33
+
34
+ **Long-term memory and a knowledge graph for any MCP-compatible agent.**
35
+
36
+ Your agent forgets everything when the session ends. This server fixes that — and goes further than a plain memory store:
37
+
38
+ - **Memory** — store, search, correct, and version facts across sessions
39
+ - **Knowledge graph** — entities, relationships, timelines, and "what was true at time X"
40
+ - **Reasoning** — ask how confident the agent should be before acting, and log outcomes so it improves
41
+
42
+ Works with Claude Desktop, Claude Code, Cursor, Cline, Continue, and any other MCP client. Backed by [Hebbrix](https://www.hebbrix.com).
43
+
44
+ ---
45
+
46
+ ## Quick start (10 seconds, no account)
47
+
48
+ **1. Install**
49
+
50
+ ```bash
51
+ pip install hebbrix-mcp
52
+ ```
53
+
54
+ **2. Add to your MCP client** — no API key needed:
55
+
56
+ <details open>
57
+ <summary><b>Claude Desktop</b> — <code>~/Library/Application Support/Claude/claude_desktop_config.json</code></summary>
58
+
59
+ ```json
60
+ {
61
+ "mcpServers": {
62
+ "hebbrix": { "command": "hebbrix-mcp" }
63
+ }
64
+ }
65
+ ```
66
+ </details>
67
+
68
+ <details>
69
+ <summary><b>Claude Code</b></summary>
70
+
71
+ ```bash
72
+ claude mcp add hebbrix -- hebbrix-mcp
73
+ ```
74
+ </details>
75
+
76
+ <details>
77
+ <summary><b>Cursor</b> — <code>~/.cursor/mcp.json</code></summary>
78
+
79
+ ```json
80
+ {
81
+ "mcpServers": {
82
+ "hebbrix": { "command": "hebbrix-mcp" }
83
+ }
84
+ }
85
+ ```
86
+ </details>
87
+
88
+ <details>
89
+ <summary><b>Cline / Continue / other</b></summary>
90
+
91
+ Point your MCP servers config at the `hebbrix-mcp` command (stdio). Same shape as above.
92
+ </details>
93
+
94
+ **3. Restart the client.** Done — your agent now has persistent memory.
95
+
96
+ ### What just happened?
97
+
98
+ On first run with no API key, the server mints a **free agent account** automatically (no email, no dashboard, ~1 second) and saves the credentials to `~/.hebbrix/config.json`. The account includes:
99
+
100
+ | | |
101
+ |---|---|
102
+ | Learning events (writes) | 300 |
103
+ | Retrievals (searches) | 2,000 |
104
+ | Expiry | 14 days after last activity, if unclaimed |
105
+
106
+ Every tool result includes a `hebbrix_usage` block (tier, usage, expiry), so the agent always knows where it stands and will tell you when it's time to claim.
107
+
108
+ ### Keep it forever (one command)
109
+
110
+ ```bash
111
+ hebbrix-mcp claim --email you@example.com
112
+ ```
113
+
114
+ You'll get a 6-digit code by email; enter it and the account switches to the **free monthly tier with no expiry**. Same API key, all memories carry over. Confirming decision outcomes (`hebbrix_log_decision`) also extends the trial — the system rewards exactly the usage that makes it smarter.
115
+
116
+ ---
117
+
118
+ ## Using your own API key
119
+
120
+ Already have a Hebbrix account? Get a key at [hebbrix.com/dashboard/api-keys](https://www.hebbrix.com/dashboard/api-keys) and pass it instead:
121
+
122
+ ```json
123
+ {
124
+ "mcpServers": {
125
+ "hebbrix": {
126
+ "command": "hebbrix-mcp",
127
+ "env": {
128
+ "HEBBRIX_API_KEY": "mem_sk_...",
129
+ "HEBBRIX_COLLECTION_ID": "your-default-collection-uuid"
130
+ }
131
+ }
132
+ }
133
+ }
134
+ ```
135
+
136
+ The env var always wins over saved agent-mode credentials.
137
+
138
+ ---
139
+
140
+ ## Tools
141
+
142
+ 15 tools, one resource, one prompt. A server-level instruction block teaches the model when to reach for each, so a well-behaved agent searches before answering and remembers what matters — without being told.
143
+
144
+ ### Memory
145
+
146
+ | Tool | What it does |
147
+ |---|---|
148
+ | `hebbrix_remember(content, tags?, collection_id?, verbatim?)` | Store a fact, decision, or preference. `verbatim=true` skips fact-extraction |
149
+ | `hebbrix_search(query, limit?, collection_id?)` | Semantic search (hybrid vector + BM25 + graph retrieval) |
150
+ | `hebbrix_get(memory_id)` | Fetch one memory with metadata |
151
+ | `hebbrix_update(memory_id, content?, importance?)` | Correct a memory **in place** — old versions are kept |
152
+ | `hebbrix_forget(memory_id)` | Delete a memory |
153
+ | `hebbrix_list(limit?, collection_id?)` | List recent memories |
154
+ | `hebbrix_history(memory_id)` | See how a memory changed over time |
155
+
156
+ ### Knowledge graph
157
+
158
+ Reads are available on **every tier** (including agent mode). Graph writes and inference need a Pro plan.
159
+
160
+ | Tool | What it does |
161
+ |---|---|
162
+ | `hebbrix_search_entities(entity_type?, limit?, collection_id?)` | List known entities (people, orgs, tools, places) |
163
+ | `hebbrix_entity_timeline(entity_name, collection_id?)` | What was true about an entity, and when |
164
+ | `hebbrix_graph_query(query?, entity?, relation_type?, depth?, timestamp?)` | Query relationships — pass a `timestamp` to ask about a point in time |
165
+ | `hebbrix_contradictions(memory_id?)` | Surface facts that conflict with each other |
166
+
167
+ ### Reasoning & account
168
+
169
+ | Tool | What it does |
170
+ |---|---|
171
+ | `hebbrix_confidence(query, collection_id?)` | How confident should the agent be before acting? Grounded in memory + past outcomes |
172
+ | `hebbrix_log_decision(description, outcome?, decision_type?)` | Record a decision and how it turned out — feeds future confidence |
173
+ | `hebbrix_list_collections()` | List the memory spaces this key can use |
174
+ | `hebbrix_account_status()` | Tier, usage, limits, and expiry |
175
+
176
+ **Also:** the `hebbrix://profile` resource and the `context` prompt inject the user's compiled profile into the conversation.
177
+
178
+ ---
179
+
180
+ ## Running modes
181
+
182
+ ### 1. Local (default) — stdio
183
+
184
+ What the quick start above does. One process per client, credentials from env or `~/.hebbrix/config.json`.
185
+
186
+ ### 2. Self-hosted HTTP — one instance, your machines
187
+
188
+ ```bash
189
+ HEBBRIX_API_KEY=mem_sk_... hebbrix-mcp --transport streamable-http
190
+ # serves http://127.0.0.1:8080/mcp
191
+ ```
192
+
193
+ ```json
194
+ { "mcpServers": { "hebbrix": { "url": "http://127.0.0.1:8080/mcp" } } }
195
+ ```
196
+
197
+ ### 3. Hosted multi-tenant — one instance, many users
198
+
199
+ The server holds **no key at all**; every request authenticates with its own `Authorization` header:
200
+
201
+ ```bash
202
+ HEBBRIX_MCP_MULTI_TENANT=1 HEBBRIX_MCP_HOST=0.0.0.0 hebbrix-mcp --transport streamable-http
203
+ ```
204
+
205
+ ```json
206
+ { "mcpServers": { "hebbrix": {
207
+ "url": "https://your-host/mcp",
208
+ "headers": { "Authorization": "Bearer mem_sk_..." }
209
+ }}}
210
+ ```
211
+
212
+ In this mode there is no default collection — pass `collection_id` on tool calls.
213
+
214
+ ---
215
+
216
+ ## Configuration
217
+
218
+ All optional. With nothing set, the server starts in agent mode.
219
+
220
+ | Variable | Default | Purpose |
221
+ |---|---|---|
222
+ | `HEBBRIX_API_KEY` | *(agent mode mints one)* | Your Hebbrix bearer token |
223
+ | `HEBBRIX_COLLECTION_ID` | *(agent mode sets one)* | Default collection for writes/reads |
224
+ | `HEBBRIX_API_BASE` | `https://api.hebbrix.com/v1` | API endpoint override |
225
+ | `HEBBRIX_CONFIG` | `~/.hebbrix/config.json` | Where agent-mode credentials are saved |
226
+ | `HEBBRIX_MCP_HOST` | `127.0.0.1` | Bind host (HTTP transports) |
227
+ | `HEBBRIX_MCP_PORT` | `8080` | Bind port (HTTP transports) |
228
+ | `HEBBRIX_MCP_MULTI_TENANT` | off | Hosted mode: per-request header auth |
229
+
230
+ ---
231
+
232
+ ## How it works
233
+
234
+ ```
235
+ ┌──────────────────┐ MCP (stdio or HTTP) ┌─────────────┐ HTTPS ┌──────────┐
236
+ │ Claude / Cursor / │ ───────────────────────→│ hebbrix-mcp │─────────────→│ Hebbrix │
237
+ │ Cline / any agent │ tool calls │ (this) │ REST API │ cloud │
238
+ └──────────────────┘ └─────────────┘ └──────────┘
239
+ ```
240
+
241
+ This package owns **zero state**. Tool calls become REST calls against your Hebbrix account; memories, embeddings, the knowledge graph, and retrieval all live in the Hebbrix backend. Delete this package and your memories are still there.
242
+
243
+ ### Limits degrade gracefully
244
+
245
+ Agent-mode accounts never break mid-task. When a limit is reached you get a structured error, not a failure:
246
+
247
+ | Code | Meaning | What still works |
248
+ |---|---|---|
249
+ | `WRITE_LIMIT_REACHED` | 300 lifetime writes used | Reads, searches, confirmations |
250
+ | `READ_LIMIT_REACHED` | 2,000 lifetime retrievals used | Claim to continue |
251
+ | `SHADOW_READ_ONLY` | Unclaimed past 14 days | Reads (7-day grace window) |
252
+ | `SHADOW_EXPIRED` | Past the grace window | Nothing — account is reaped |
253
+ | `CLAIM_REQUIRED_FOR_BATCH` | Batch writes need a claimed account | Everything else |
254
+
255
+ Every error carries a `resolve` field with the exact command to fix it, so agents can relay it to you verbatim.
256
+
257
+ ---
258
+
259
+ ## Troubleshooting
260
+
261
+ **"HTTP 401" on every call** — the key is wrong or revoked. Unset `HEBBRIX_API_KEY`, delete `~/.hebbrix/config.json`, and restart to re-provision; or paste a fresh key from the dashboard.
262
+
263
+ **Agent mode won't start (`auto-signup unavailable`)** — signup may be at daily capacity (it's capped) or your network blocks the API. Set `HEBBRIX_API_KEY` from the dashboard instead.
264
+
265
+ **`claim` says `EMAIL_IN_USE`** — v1 claiming needs an email with no existing Hebbrix account. Use a fresh address (a `you+agent@gmail.com` alias works).
266
+
267
+ **A memory doesn't show up in search immediately** — indexing is asynchronous; typical convergence is under 30 seconds.
268
+
269
+ **Multi-tenant mode returns errors about collections** — there's no default collection in hosted mode; pass `collection_id` explicitly.
270
+
271
+ ---
272
+
273
+ ## Development
274
+
275
+ ```bash
276
+ git clone https://github.com/Hebbrix/hebbrix-mcp
277
+ cd hebbrix-mcp
278
+ ./quick_setup.sh # venv + editable install
279
+ source venv/bin/activate
280
+ pytest tests/ -q # 11 offline tests, no network needed
281
+ hebbrix-mcp # starts in agent mode on stdio
282
+ ```
283
+
284
+ See [CHANGELOG.md](CHANGELOG.md) for release history and [CONTRIBUTING.md](CONTRIBUTING.md) for how to contribute.
285
+
286
+ ## License
287
+
288
+ MIT — see [LICENSE](LICENSE).
289
+
290
+ ## Related
291
+
292
+ - [Hebbrix documentation](https://www.hebbrix.com/docs)
293
+ - [MCP integration guide](https://www.hebbrix.com/integrations/mcp)
294
+ - [Model Context Protocol](https://modelcontextprotocol.io)
@@ -0,0 +1,263 @@
1
+ # hebbrix-mcp
2
+
3
+ **Long-term memory and a knowledge graph for any MCP-compatible agent.**
4
+
5
+ Your agent forgets everything when the session ends. This server fixes that — and goes further than a plain memory store:
6
+
7
+ - **Memory** — store, search, correct, and version facts across sessions
8
+ - **Knowledge graph** — entities, relationships, timelines, and "what was true at time X"
9
+ - **Reasoning** — ask how confident the agent should be before acting, and log outcomes so it improves
10
+
11
+ Works with Claude Desktop, Claude Code, Cursor, Cline, Continue, and any other MCP client. Backed by [Hebbrix](https://www.hebbrix.com).
12
+
13
+ ---
14
+
15
+ ## Quick start (10 seconds, no account)
16
+
17
+ **1. Install**
18
+
19
+ ```bash
20
+ pip install hebbrix-mcp
21
+ ```
22
+
23
+ **2. Add to your MCP client** — no API key needed:
24
+
25
+ <details open>
26
+ <summary><b>Claude Desktop</b> — <code>~/Library/Application Support/Claude/claude_desktop_config.json</code></summary>
27
+
28
+ ```json
29
+ {
30
+ "mcpServers": {
31
+ "hebbrix": { "command": "hebbrix-mcp" }
32
+ }
33
+ }
34
+ ```
35
+ </details>
36
+
37
+ <details>
38
+ <summary><b>Claude Code</b></summary>
39
+
40
+ ```bash
41
+ claude mcp add hebbrix -- hebbrix-mcp
42
+ ```
43
+ </details>
44
+
45
+ <details>
46
+ <summary><b>Cursor</b> — <code>~/.cursor/mcp.json</code></summary>
47
+
48
+ ```json
49
+ {
50
+ "mcpServers": {
51
+ "hebbrix": { "command": "hebbrix-mcp" }
52
+ }
53
+ }
54
+ ```
55
+ </details>
56
+
57
+ <details>
58
+ <summary><b>Cline / Continue / other</b></summary>
59
+
60
+ Point your MCP servers config at the `hebbrix-mcp` command (stdio). Same shape as above.
61
+ </details>
62
+
63
+ **3. Restart the client.** Done — your agent now has persistent memory.
64
+
65
+ ### What just happened?
66
+
67
+ On first run with no API key, the server mints a **free agent account** automatically (no email, no dashboard, ~1 second) and saves the credentials to `~/.hebbrix/config.json`. The account includes:
68
+
69
+ | | |
70
+ |---|---|
71
+ | Learning events (writes) | 300 |
72
+ | Retrievals (searches) | 2,000 |
73
+ | Expiry | 14 days after last activity, if unclaimed |
74
+
75
+ Every tool result includes a `hebbrix_usage` block (tier, usage, expiry), so the agent always knows where it stands and will tell you when it's time to claim.
76
+
77
+ ### Keep it forever (one command)
78
+
79
+ ```bash
80
+ hebbrix-mcp claim --email you@example.com
81
+ ```
82
+
83
+ You'll get a 6-digit code by email; enter it and the account switches to the **free monthly tier with no expiry**. Same API key, all memories carry over. Confirming decision outcomes (`hebbrix_log_decision`) also extends the trial — the system rewards exactly the usage that makes it smarter.
84
+
85
+ ---
86
+
87
+ ## Using your own API key
88
+
89
+ Already have a Hebbrix account? Get a key at [hebbrix.com/dashboard/api-keys](https://www.hebbrix.com/dashboard/api-keys) and pass it instead:
90
+
91
+ ```json
92
+ {
93
+ "mcpServers": {
94
+ "hebbrix": {
95
+ "command": "hebbrix-mcp",
96
+ "env": {
97
+ "HEBBRIX_API_KEY": "mem_sk_...",
98
+ "HEBBRIX_COLLECTION_ID": "your-default-collection-uuid"
99
+ }
100
+ }
101
+ }
102
+ }
103
+ ```
104
+
105
+ The env var always wins over saved agent-mode credentials.
106
+
107
+ ---
108
+
109
+ ## Tools
110
+
111
+ 15 tools, one resource, one prompt. A server-level instruction block teaches the model when to reach for each, so a well-behaved agent searches before answering and remembers what matters — without being told.
112
+
113
+ ### Memory
114
+
115
+ | Tool | What it does |
116
+ |---|---|
117
+ | `hebbrix_remember(content, tags?, collection_id?, verbatim?)` | Store a fact, decision, or preference. `verbatim=true` skips fact-extraction |
118
+ | `hebbrix_search(query, limit?, collection_id?)` | Semantic search (hybrid vector + BM25 + graph retrieval) |
119
+ | `hebbrix_get(memory_id)` | Fetch one memory with metadata |
120
+ | `hebbrix_update(memory_id, content?, importance?)` | Correct a memory **in place** — old versions are kept |
121
+ | `hebbrix_forget(memory_id)` | Delete a memory |
122
+ | `hebbrix_list(limit?, collection_id?)` | List recent memories |
123
+ | `hebbrix_history(memory_id)` | See how a memory changed over time |
124
+
125
+ ### Knowledge graph
126
+
127
+ Reads are available on **every tier** (including agent mode). Graph writes and inference need a Pro plan.
128
+
129
+ | Tool | What it does |
130
+ |---|---|
131
+ | `hebbrix_search_entities(entity_type?, limit?, collection_id?)` | List known entities (people, orgs, tools, places) |
132
+ | `hebbrix_entity_timeline(entity_name, collection_id?)` | What was true about an entity, and when |
133
+ | `hebbrix_graph_query(query?, entity?, relation_type?, depth?, timestamp?)` | Query relationships — pass a `timestamp` to ask about a point in time |
134
+ | `hebbrix_contradictions(memory_id?)` | Surface facts that conflict with each other |
135
+
136
+ ### Reasoning & account
137
+
138
+ | Tool | What it does |
139
+ |---|---|
140
+ | `hebbrix_confidence(query, collection_id?)` | How confident should the agent be before acting? Grounded in memory + past outcomes |
141
+ | `hebbrix_log_decision(description, outcome?, decision_type?)` | Record a decision and how it turned out — feeds future confidence |
142
+ | `hebbrix_list_collections()` | List the memory spaces this key can use |
143
+ | `hebbrix_account_status()` | Tier, usage, limits, and expiry |
144
+
145
+ **Also:** the `hebbrix://profile` resource and the `context` prompt inject the user's compiled profile into the conversation.
146
+
147
+ ---
148
+
149
+ ## Running modes
150
+
151
+ ### 1. Local (default) — stdio
152
+
153
+ What the quick start above does. One process per client, credentials from env or `~/.hebbrix/config.json`.
154
+
155
+ ### 2. Self-hosted HTTP — one instance, your machines
156
+
157
+ ```bash
158
+ HEBBRIX_API_KEY=mem_sk_... hebbrix-mcp --transport streamable-http
159
+ # serves http://127.0.0.1:8080/mcp
160
+ ```
161
+
162
+ ```json
163
+ { "mcpServers": { "hebbrix": { "url": "http://127.0.0.1:8080/mcp" } } }
164
+ ```
165
+
166
+ ### 3. Hosted multi-tenant — one instance, many users
167
+
168
+ The server holds **no key at all**; every request authenticates with its own `Authorization` header:
169
+
170
+ ```bash
171
+ HEBBRIX_MCP_MULTI_TENANT=1 HEBBRIX_MCP_HOST=0.0.0.0 hebbrix-mcp --transport streamable-http
172
+ ```
173
+
174
+ ```json
175
+ { "mcpServers": { "hebbrix": {
176
+ "url": "https://your-host/mcp",
177
+ "headers": { "Authorization": "Bearer mem_sk_..." }
178
+ }}}
179
+ ```
180
+
181
+ In this mode there is no default collection — pass `collection_id` on tool calls.
182
+
183
+ ---
184
+
185
+ ## Configuration
186
+
187
+ All optional. With nothing set, the server starts in agent mode.
188
+
189
+ | Variable | Default | Purpose |
190
+ |---|---|---|
191
+ | `HEBBRIX_API_KEY` | *(agent mode mints one)* | Your Hebbrix bearer token |
192
+ | `HEBBRIX_COLLECTION_ID` | *(agent mode sets one)* | Default collection for writes/reads |
193
+ | `HEBBRIX_API_BASE` | `https://api.hebbrix.com/v1` | API endpoint override |
194
+ | `HEBBRIX_CONFIG` | `~/.hebbrix/config.json` | Where agent-mode credentials are saved |
195
+ | `HEBBRIX_MCP_HOST` | `127.0.0.1` | Bind host (HTTP transports) |
196
+ | `HEBBRIX_MCP_PORT` | `8080` | Bind port (HTTP transports) |
197
+ | `HEBBRIX_MCP_MULTI_TENANT` | off | Hosted mode: per-request header auth |
198
+
199
+ ---
200
+
201
+ ## How it works
202
+
203
+ ```
204
+ ┌──────────────────┐ MCP (stdio or HTTP) ┌─────────────┐ HTTPS ┌──────────┐
205
+ │ Claude / Cursor / │ ───────────────────────→│ hebbrix-mcp │─────────────→│ Hebbrix │
206
+ │ Cline / any agent │ tool calls │ (this) │ REST API │ cloud │
207
+ └──────────────────┘ └─────────────┘ └──────────┘
208
+ ```
209
+
210
+ This package owns **zero state**. Tool calls become REST calls against your Hebbrix account; memories, embeddings, the knowledge graph, and retrieval all live in the Hebbrix backend. Delete this package and your memories are still there.
211
+
212
+ ### Limits degrade gracefully
213
+
214
+ Agent-mode accounts never break mid-task. When a limit is reached you get a structured error, not a failure:
215
+
216
+ | Code | Meaning | What still works |
217
+ |---|---|---|
218
+ | `WRITE_LIMIT_REACHED` | 300 lifetime writes used | Reads, searches, confirmations |
219
+ | `READ_LIMIT_REACHED` | 2,000 lifetime retrievals used | Claim to continue |
220
+ | `SHADOW_READ_ONLY` | Unclaimed past 14 days | Reads (7-day grace window) |
221
+ | `SHADOW_EXPIRED` | Past the grace window | Nothing — account is reaped |
222
+ | `CLAIM_REQUIRED_FOR_BATCH` | Batch writes need a claimed account | Everything else |
223
+
224
+ Every error carries a `resolve` field with the exact command to fix it, so agents can relay it to you verbatim.
225
+
226
+ ---
227
+
228
+ ## Troubleshooting
229
+
230
+ **"HTTP 401" on every call** — the key is wrong or revoked. Unset `HEBBRIX_API_KEY`, delete `~/.hebbrix/config.json`, and restart to re-provision; or paste a fresh key from the dashboard.
231
+
232
+ **Agent mode won't start (`auto-signup unavailable`)** — signup may be at daily capacity (it's capped) or your network blocks the API. Set `HEBBRIX_API_KEY` from the dashboard instead.
233
+
234
+ **`claim` says `EMAIL_IN_USE`** — v1 claiming needs an email with no existing Hebbrix account. Use a fresh address (a `you+agent@gmail.com` alias works).
235
+
236
+ **A memory doesn't show up in search immediately** — indexing is asynchronous; typical convergence is under 30 seconds.
237
+
238
+ **Multi-tenant mode returns errors about collections** — there's no default collection in hosted mode; pass `collection_id` explicitly.
239
+
240
+ ---
241
+
242
+ ## Development
243
+
244
+ ```bash
245
+ git clone https://github.com/Hebbrix/hebbrix-mcp
246
+ cd hebbrix-mcp
247
+ ./quick_setup.sh # venv + editable install
248
+ source venv/bin/activate
249
+ pytest tests/ -q # 11 offline tests, no network needed
250
+ hebbrix-mcp # starts in agent mode on stdio
251
+ ```
252
+
253
+ See [CHANGELOG.md](CHANGELOG.md) for release history and [CONTRIBUTING.md](CONTRIBUTING.md) for how to contribute.
254
+
255
+ ## License
256
+
257
+ MIT — see [LICENSE](LICENSE).
258
+
259
+ ## Related
260
+
261
+ - [Hebbrix documentation](https://www.hebbrix.com/docs)
262
+ - [MCP integration guide](https://www.hebbrix.com/integrations/mcp)
263
+ - [Model Context Protocol](https://modelcontextprotocol.io)
@@ -0,0 +1,30 @@
1
+ """Hebbrix MCP server — memory + knowledge graph tools for any MCP-compatible agent.
2
+
3
+ Tool surface (14 tools + a profile resource + a context prompt):
4
+ Memory: hebbrix_remember, hebbrix_search, hebbrix_get, hebbrix_update,
5
+ hebbrix_forget, hebbrix_list, hebbrix_history
6
+ Graph: hebbrix_search_entities, hebbrix_entity_timeline,
7
+ hebbrix_graph_query, hebbrix_contradictions
8
+ Reason: hebbrix_confidence, hebbrix_log_decision
9
+ Scope: hebbrix_list_collections
10
+
11
+ Transports: stdio (default) and streamable-http (--transport streamable-http).
12
+
13
+ AGENT MODE (accountless): with no HEBBRIX_API_KEY and no saved credentials,
14
+ the server mints a shadow account automatically (POST /v1/agent-signup) and
15
+ starts in <10s — no email, no dashboard. Every tool result then carries a
16
+ `hebbrix_usage` block (tier, limits, expiry, claim command) so the agent can
17
+ tell its human when to claim. `hebbrix-mcp claim --email <you>` upgrades to
18
+ the free monthly tier with the same key and all memories intact.
19
+
20
+ Configure with env vars:
21
+ HEBBRIX_API_KEY — optional (agent mode mints one), your bearer token
22
+ HEBBRIX_COLLECTION_ID — optional, default collection for new memories
23
+ HEBBRIX_API_BASE — optional, default https://api.hebbrix.com/v1
24
+ HEBBRIX_MCP_HOST/PORT — optional, streamable-http bind (default 127.0.0.1:8080)
25
+ HEBBRIX_CONFIG — optional, credentials path (default ~/.hebbrix/config.json)
26
+ """
27
+ from .server import mcp, run
28
+
29
+ __version__ = "0.3.1"
30
+ __all__ = ["mcp", "run", "__version__"]