@hebbianvault/mcp 0.2.0
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.
- package/LICENSE +178 -0
- package/README.md +122 -0
- package/dist/assets/lockup.txt +6 -0
- package/dist/banner.d.ts +27 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/banner.js +91 -0
- package/dist/banner.js.map +1 -0
- package/dist/client.d.ts +47 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +135 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +36 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +86 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +120 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/ask.d.ts +21 -0
- package/dist/tools/ask.d.ts.map +1 -0
- package/dist/tools/ask.js +53 -0
- package/dist/tools/ask.js.map +1 -0
- package/dist/tools/capture.d.ts +22 -0
- package/dist/tools/capture.d.ts.map +1 -0
- package/dist/tools/capture.js +85 -0
- package/dist/tools/capture.js.map +1 -0
- package/dist/tools/graph_helpers.d.ts +56 -0
- package/dist/tools/graph_helpers.d.ts.map +1 -0
- package/dist/tools/graph_helpers.js +82 -0
- package/dist/tools/graph_helpers.js.map +1 -0
- package/dist/tools/index.d.ts +14 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +14 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/provenance.d.ts +20 -0
- package/dist/tools/provenance.d.ts.map +1 -0
- package/dist/tools/provenance.js +64 -0
- package/dist/tools/provenance.js.map +1 -0
- package/dist/tools/read_node.d.ts +16 -0
- package/dist/tools/read_node.d.ts.map +1 -0
- package/dist/tools/read_node.js +44 -0
- package/dist/tools/read_node.js.map +1 -0
- package/dist/tools/recent_activity.d.ts +18 -0
- package/dist/tools/recent_activity.d.ts.map +1 -0
- package/dist/tools/recent_activity.js +60 -0
- package/dist/tools/recent_activity.js.map +1 -0
- package/dist/tools/salience.d.ts +17 -0
- package/dist/tools/salience.d.ts.map +1 -0
- package/dist/tools/salience.js +45 -0
- package/dist/tools/salience.js.map +1 -0
- package/dist/tools/search.d.ts +22 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +73 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/traverse.d.ts +21 -0
- package/dist/tools/traverse.d.ts.map +1 -0
- package/dist/tools/traverse.js +117 -0
- package/dist/tools/traverse.js.map +1 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship made available under
|
|
36
|
+
the License, as indicated by a copyright notice that is included in
|
|
37
|
+
or attached to the work (an example is provided in the Appendix below).
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other transformations
|
|
42
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
43
|
+
of this License, Derivative Works shall not include works that remain
|
|
44
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
45
|
+
the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean, as submitted to the Licensor for inclusion
|
|
48
|
+
in the Work by the copyright owner or by an individual or Legal Entity
|
|
49
|
+
authorized to submit on behalf of the copyright owner. For the purposes
|
|
50
|
+
of this definition, "submitted" means any form of electronic, verbal,
|
|
51
|
+
or written communication sent to the Licensor or its representatives,
|
|
52
|
+
including but not limited to communication on electronic mailing lists,
|
|
53
|
+
source code control systems, and issue tracking systems that are managed
|
|
54
|
+
by, or on behalf of, the Licensor for the purpose of discussing and
|
|
55
|
+
improving the Work, but excluding communication that is conspicuously
|
|
56
|
+
marked or designated in writing by the copyright owner as "Not a
|
|
57
|
+
Contribution."
|
|
58
|
+
|
|
59
|
+
"Contributor" shall mean Licensor and any Legal Entity on behalf of
|
|
60
|
+
whom a Contribution has been received by the Licensor and included
|
|
61
|
+
within the Work.
|
|
62
|
+
|
|
63
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
64
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
65
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
66
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
67
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
68
|
+
Work and such Derivative Works in Source or Object form.
|
|
69
|
+
|
|
70
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
71
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
72
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
73
|
+
(except as stated in this section) patent license to make, have made,
|
|
74
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
75
|
+
where such license applies only to those patent claims licensable
|
|
76
|
+
by such Contributor that are necessarily infringed by their
|
|
77
|
+
Contribution(s) alone or by the combined effect of their Contribution(s)
|
|
78
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
79
|
+
institute patent litigation against any entity (including a cross-claim
|
|
80
|
+
or counterclaim in a lawsuit) alleging that the Work or any one of the
|
|
81
|
+
Work embodied in a particular Contribution constitutes direct or
|
|
82
|
+
contributory patent infringement, then any patent licenses granted to
|
|
83
|
+
You under this License for that Work shall terminate as of the date
|
|
84
|
+
such litigation is filed.
|
|
85
|
+
|
|
86
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
87
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
88
|
+
modifications, and in Source or Object form, provided that You
|
|
89
|
+
meet the following conditions:
|
|
90
|
+
|
|
91
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
92
|
+
Works a copy of this License; and
|
|
93
|
+
|
|
94
|
+
(b) You must cause any modified files to carry prominent notices
|
|
95
|
+
stating that You changed the files; and
|
|
96
|
+
|
|
97
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
98
|
+
that You distribute, all copyright, patent, trademark, and
|
|
99
|
+
attribution notices from the Source form of the Work,
|
|
100
|
+
excluding those notices that do not pertain to any part of
|
|
101
|
+
the Derivative Works; and
|
|
102
|
+
|
|
103
|
+
(d) If the Work includes a "NOTICE" text file, You must include a
|
|
104
|
+
readable copy of the attribution notices contained within such
|
|
105
|
+
NOTICE file, in all the Work or Derivative Works that You
|
|
106
|
+
distribute, alongside the copy of the License. You may add Your
|
|
107
|
+
own attribution notices within Derivative Works that You distribute,
|
|
108
|
+
alongside or in addition to the NOTICE text from the Work, provided
|
|
109
|
+
that such additional attribution notices cannot be construed as
|
|
110
|
+
modifying the License.
|
|
111
|
+
|
|
112
|
+
You may add Your own license statement for Your modifications and
|
|
113
|
+
may provide additional grant of rights to use, reproduce, modify,
|
|
114
|
+
prepare Derivative Works of, publicly display, publicly perform,
|
|
115
|
+
sublicense, and distribute the Work and such Derivative Works in
|
|
116
|
+
Source or Object form.
|
|
117
|
+
|
|
118
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
119
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
120
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
121
|
+
this License, without any additional terms or conditions.
|
|
122
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
123
|
+
the terms of any separate license agreement you may have executed
|
|
124
|
+
with Licensor regarding such Contributions.
|
|
125
|
+
|
|
126
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
127
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
128
|
+
except as required for reasonable and customary use in describing the
|
|
129
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
130
|
+
|
|
131
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
132
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
133
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
134
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
135
|
+
implied, including, without limitation, any warranties or conditions
|
|
136
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
137
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
138
|
+
appropriateness of using or reproducing the Work and assume any
|
|
139
|
+
risks associated with Your exercise of permissions under this License.
|
|
140
|
+
|
|
141
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
142
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
143
|
+
unless required by applicable law (such as deliberate and grossly
|
|
144
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
145
|
+
liable to You for damages, including any direct, indirect, special,
|
|
146
|
+
incidental, or exemplary damages of any character arising as a
|
|
147
|
+
result of this License or out of the use or inability to use the
|
|
148
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
149
|
+
work stoppage, computer failure or malfunction, or all other
|
|
150
|
+
commercial damages or losses), even if such Contributor has been
|
|
151
|
+
advised of the possibility of such damages.
|
|
152
|
+
|
|
153
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
154
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
155
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
156
|
+
or other liability obligations and/or rights consistent with this
|
|
157
|
+
License. However, in accepting such obligations, You may offer only
|
|
158
|
+
conditions that are Your own responsibility, not on behalf of any
|
|
159
|
+
other Contributor, and only if You agree to indemnify, defend, and
|
|
160
|
+
hold each Contributor harmless for any liability incurred by, or
|
|
161
|
+
claims asserted against, such Contributor by reason of your accepting
|
|
162
|
+
any such warranty or additional liability.
|
|
163
|
+
|
|
164
|
+
END OF TERMS AND CONDITIONS
|
|
165
|
+
|
|
166
|
+
Copyright 2026 Hebbian / Sales Gladiators BV
|
|
167
|
+
|
|
168
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
169
|
+
you may not use this file except in compliance with the License.
|
|
170
|
+
You may obtain a copy of the License at
|
|
171
|
+
|
|
172
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
173
|
+
|
|
174
|
+
Unless required by applicable law or agreed to in writing, software
|
|
175
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
176
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
177
|
+
See the License for the specific language governing permissions and
|
|
178
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/hebbianvault/hebbian-mcp/main/brand/hebbian-lockup-cyan.png" alt="Hebbian" width="520">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# @hebbianvault/mcp
|
|
6
|
+
|
|
7
|
+
Connect Claude Code, Claude Desktop, Cursor, and any MCP-compatible agent to your Hebbian workspace.
|
|
8
|
+
|
|
9
|
+
One package, configured with a single token. Install in your MCP host, paste a token issued from your Hebbian integrations page (AI Tools tab), and your agent can read from and write to your workspace. This package is a thin client — all the intelligence and access control lives in the Hebbian service.
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Install globally, or use npx — no install needed
|
|
15
|
+
npm install -g @hebbianvault/mcp
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Generate a token from your Hebbian integrations page (AI Tools tab → Generate token).
|
|
19
|
+
|
|
20
|
+
## Configuration
|
|
21
|
+
|
|
22
|
+
### Claude Code (recommended)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
claude mcp add hebbian \
|
|
26
|
+
-e HEBBIAN_API_TOKEN=your_token_here \
|
|
27
|
+
-- npx -y @hebbianvault/mcp
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Claude Desktop
|
|
31
|
+
|
|
32
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"mcpServers": {
|
|
37
|
+
"hebbian": {
|
|
38
|
+
"command": "npx",
|
|
39
|
+
"args": ["-y", "@hebbianvault/mcp"],
|
|
40
|
+
"env": {
|
|
41
|
+
"HEBBIAN_API_TOKEN": "your_token_here"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Cursor
|
|
49
|
+
|
|
50
|
+
Add to `.cursor/mcp.json`:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"mcpServers": {
|
|
55
|
+
"hebbian": {
|
|
56
|
+
"command": "npx",
|
|
57
|
+
"args": ["-y", "@hebbianvault/mcp"],
|
|
58
|
+
"env": {
|
|
59
|
+
"HEBBIAN_API_TOKEN": "your_token_here"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Config file (alternative to env var)
|
|
67
|
+
|
|
68
|
+
Write `~/.config/hebbian/mcp-tenant.json`:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"token": "your_token_here"
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
| Variable | Purpose |
|
|
77
|
+
|---|---|
|
|
78
|
+
| `HEBBIAN_API_TOKEN` | Your token (required). `HEBBIAN_TOKEN` is also accepted. |
|
|
79
|
+
| `HEBBIAN_API_URL` | Override the API base URL (Enterprise self-host). Defaults to the Hebbian SaaS API. |
|
|
80
|
+
| `HEBBIAN_TENANT` | Optional workspace slug — only needed if your account belongs to more than one workspace. |
|
|
81
|
+
|
|
82
|
+
## Token scope
|
|
83
|
+
|
|
84
|
+
Your token decides what the adapter can see and do — a personal-workspace token gives access to your own knowledge; a company-workspace token gives access to the shared company workspace (where your role allows). Scope is decided by the Hebbian service. The adapter just carries your token.
|
|
85
|
+
|
|
86
|
+
## Tools
|
|
87
|
+
|
|
88
|
+
| Tool | What it does |
|
|
89
|
+
|---|---|
|
|
90
|
+
| `hebbian_read_node` | Read a single node by UUID (content, metadata, connected edges) |
|
|
91
|
+
| `hebbian_search` | Find nodes in your workspace matching a query |
|
|
92
|
+
| `hebbian_ask` | Ask a question and get an answer backed by source quotes |
|
|
93
|
+
| `hebbian_capture` | Write a note into your workspace |
|
|
94
|
+
| `hebbian_traverse` | Explore nodes connected to a starting node |
|
|
95
|
+
| `hebbian_provenance` | See where a node's knowledge came from |
|
|
96
|
+
| `hebbian_salience` | See a node's recent activity over time |
|
|
97
|
+
| `hebbian_recent_activity` | Catch up on recent changes in your workspace |
|
|
98
|
+
|
|
99
|
+
Results only ever include what your token is allowed to see.
|
|
100
|
+
|
|
101
|
+
## Security
|
|
102
|
+
|
|
103
|
+
- Tokens are bearer credentials — treat like passwords.
|
|
104
|
+
- Never commit tokens to git. Use env vars or a config file outside your repo.
|
|
105
|
+
- A `401` error means your token is expired or revoked — generate a new one from the AI Tools tab.
|
|
106
|
+
- HTTPS-only transport.
|
|
107
|
+
|
|
108
|
+
## Python
|
|
109
|
+
|
|
110
|
+
A Python sibling package is available as `hebbianvault-mcp` on PyPI. Same 8 tools, same configuration.
|
|
111
|
+
|
|
112
|
+
## Development
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
npm install
|
|
116
|
+
npm run build
|
|
117
|
+
npm test
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
Apache-2.0. See the root [LICENSE](../LICENSE) file.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
·╲ │ ╱· ██╗ ██╗ ███████╗ ██████╗ ██████╗ ██╗ █████╗ ███╗ ██╗
|
|
2
|
+
·╲ ╲│╱ ╱· ██║ ██║ ██╔════╝ ██╔══██╗ ██╔══██╗ ██║ ██╔══██╗ ████╗ ██║
|
|
3
|
+
──●──◉──●── ███████║ █████╗ ██████╔╝ ██████╔╝ ██║ ███████║ ██╔██╗ ██║
|
|
4
|
+
·╱ ╱│╲ ╲· ██╔══██║ ██╔══╝ ██╔══██╗ ██╔══██╗ ██║ ██╔══██║ ██║╚██╗██║
|
|
5
|
+
·╱ │ ╲· ██║ ██║ ███████╗ ██████╔╝ ██████╔╝ ██║ ██║ ██║ ██║ ╚████║
|
|
6
|
+
╚═╝ ╚═╝ ╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═══╝
|
package/dist/banner.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* src/banner.ts
|
|
3
|
+
*
|
|
4
|
+
* Prints the Hebbian cyan lockup banner to STDERR on server startup.
|
|
5
|
+
* STDERR only — stdout carries JSON-RPC and any write there corrupts the MCP protocol.
|
|
6
|
+
*
|
|
7
|
+
* Brand spec: mark region = solid HEBBIAN_CYAN (#00CFE8);
|
|
8
|
+
* wordmark region = gradient #00CFE8 → #1AA3FF.
|
|
9
|
+
* Split column: first column (from left) where the block glyph █ appears.
|
|
10
|
+
*
|
|
11
|
+
* Vendored asset: src/assets/lockup.txt (baked, no network call).
|
|
12
|
+
* Logic ported from ~/.claude/skills/hebbian-logo/color_lockup.py.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Renders the lockup.txt with 24-bit ANSI cyan colouring.
|
|
16
|
+
* Returns the coloured string (does NOT write to stderr itself —
|
|
17
|
+
* printBanner() handles that so callers can test the output).
|
|
18
|
+
*/
|
|
19
|
+
export declare function renderBanner(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Print the cyan lockup banner to stderr.
|
|
22
|
+
* Call once at server startup — before the MCP transport connects.
|
|
23
|
+
* Failure-tolerant: catches all errors and silently skips the banner
|
|
24
|
+
* rather than crashing the server over a cosmetic output issue.
|
|
25
|
+
*/
|
|
26
|
+
export declare function printBanner(): void;
|
|
27
|
+
//# sourceMappingURL=banner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../src/banner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA0BH;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,MAAM,CA0CrC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAOlC"}
|
package/dist/banner.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* src/banner.ts
|
|
3
|
+
*
|
|
4
|
+
* Prints the Hebbian cyan lockup banner to STDERR on server startup.
|
|
5
|
+
* STDERR only — stdout carries JSON-RPC and any write there corrupts the MCP protocol.
|
|
6
|
+
*
|
|
7
|
+
* Brand spec: mark region = solid HEBBIAN_CYAN (#00CFE8);
|
|
8
|
+
* wordmark region = gradient #00CFE8 → #1AA3FF.
|
|
9
|
+
* Split column: first column (from left) where the block glyph █ appears.
|
|
10
|
+
*
|
|
11
|
+
* Vendored asset: src/assets/lockup.txt (baked, no network call).
|
|
12
|
+
* Logic ported from ~/.claude/skills/hebbian-logo/color_lockup.py.
|
|
13
|
+
*/
|
|
14
|
+
import { readFileSync } from "node:fs";
|
|
15
|
+
import { resolve, dirname } from "node:path";
|
|
16
|
+
import { fileURLToPath } from "node:url";
|
|
17
|
+
// ── Constants ──────────────────────────────────────────────────────────────────
|
|
18
|
+
// Colours as [r, g, b] tuples
|
|
19
|
+
const CYAN = [0, 207, 232]; // #00CFE8
|
|
20
|
+
const C0 = [0, 207, 232]; // #00CFE8 (wordmark start)
|
|
21
|
+
const C1 = [26, 163, 255]; // #1AA3FF (wordmark end)
|
|
22
|
+
const RESET = "\x1b[0m";
|
|
23
|
+
// ── Helpers ────────────────────────────────────────────────────────────────────
|
|
24
|
+
function fg(r, g, b) {
|
|
25
|
+
return `\x1b[38;2;${r};${g};${b}m`;
|
|
26
|
+
}
|
|
27
|
+
function lerp(a, b, t) {
|
|
28
|
+
return Math.round(a + (b - a) * t);
|
|
29
|
+
}
|
|
30
|
+
// ── Core render ────────────────────────────────────────────────────────────────
|
|
31
|
+
/**
|
|
32
|
+
* Renders the lockup.txt with 24-bit ANSI cyan colouring.
|
|
33
|
+
* Returns the coloured string (does NOT write to stderr itself —
|
|
34
|
+
* printBanner() handles that so callers can test the output).
|
|
35
|
+
*/
|
|
36
|
+
export function renderBanner() {
|
|
37
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
38
|
+
const lockupPath = resolve(__dirname, "assets", "lockup.txt");
|
|
39
|
+
const raw = readFileSync(lockupPath, "utf-8");
|
|
40
|
+
const lines = raw.replace(/\n$/, "").split("\n");
|
|
41
|
+
// Find the wordmark start column: first column where █ appears in any line.
|
|
42
|
+
let split = 14; // fallback default
|
|
43
|
+
for (const line of lines) {
|
|
44
|
+
const idx = line.indexOf("█");
|
|
45
|
+
if (idx !== -1 && idx < split) {
|
|
46
|
+
split = idx;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const maxLen = Math.max(...lines.map((l) => l.length));
|
|
50
|
+
const wordW = maxLen - split;
|
|
51
|
+
const rendered = lines.map((line) => {
|
|
52
|
+
let out = "";
|
|
53
|
+
for (let ci = 0; ci < line.length; ci++) {
|
|
54
|
+
const ch = line[ci];
|
|
55
|
+
if (ch === " ") {
|
|
56
|
+
out += " ";
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (ci < split) {
|
|
60
|
+
// Mark region — solid HEBBIAN_CYAN
|
|
61
|
+
out += fg(CYAN[0], CYAN[1], CYAN[2]) + ch;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
// Wordmark region — gradient C0 → C1
|
|
65
|
+
const f = wordW > 1 ? (ci - split) / (wordW - 1) : 0;
|
|
66
|
+
const r = lerp(C0[0], C1[0], f);
|
|
67
|
+
const g = lerp(C0[1], C1[1], f);
|
|
68
|
+
const b = lerp(C0[2], C1[2], f);
|
|
69
|
+
out += fg(r, g, b) + ch;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return out + RESET;
|
|
73
|
+
});
|
|
74
|
+
return rendered.join("\n");
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Print the cyan lockup banner to stderr.
|
|
78
|
+
* Call once at server startup — before the MCP transport connects.
|
|
79
|
+
* Failure-tolerant: catches all errors and silently skips the banner
|
|
80
|
+
* rather than crashing the server over a cosmetic output issue.
|
|
81
|
+
*/
|
|
82
|
+
export function printBanner() {
|
|
83
|
+
try {
|
|
84
|
+
const banner = renderBanner();
|
|
85
|
+
process.stderr.write(banner + "\n");
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// Banner is cosmetic — never let it crash the server.
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=banner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.js","sourceRoot":"","sources":["../src/banner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,kFAAkF;AAElF,8BAA8B;AAC9B,MAAM,IAAI,GAA6B,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAG,UAAU;AAClE,MAAM,EAAE,GAA6B,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAK,2BAA2B;AACnF,MAAM,EAAE,GAA6B,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAI,yBAAyB;AACjF,MAAM,KAAK,GAAG,SAAS,CAAC;AAExB,kFAAkF;AAElF,SAAS,EAAE,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS;IACzC,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AACrC,CAAC;AAED,SAAS,IAAI,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS;IAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACrC,CAAC;AAED,kFAAkF;AAElF;;;;GAIG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,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client for the Hebbian API.
|
|
5
|
+
*
|
|
6
|
+
* - Adds Authorization: Bearer header to every request.
|
|
7
|
+
* - Surfaces API errors as structured HebbianApiError with code + message.
|
|
8
|
+
* - No business logic — thin transport wrapper over fetch.
|
|
9
|
+
* - All tool call implementations live in src/tools/*.ts.
|
|
10
|
+
*/
|
|
11
|
+
/** Structured API error returned by the Hebbian API (RFC 7807 variant). */
|
|
12
|
+
export declare class HebbianApiError extends Error {
|
|
13
|
+
readonly statusCode: number;
|
|
14
|
+
readonly errorCode: string;
|
|
15
|
+
readonly detail?: unknown | undefined;
|
|
16
|
+
constructor(statusCode: number, errorCode: string, message: string, detail?: unknown | undefined);
|
|
17
|
+
/** Human-readable string for MCP tool error responses. */
|
|
18
|
+
toToolError(): string;
|
|
19
|
+
}
|
|
20
|
+
export declare class HebbianClient {
|
|
21
|
+
private readonly apiUrl;
|
|
22
|
+
private readonly token;
|
|
23
|
+
private readonly tenant?;
|
|
24
|
+
constructor(apiUrl: string, token: string, tenant?: string);
|
|
25
|
+
/**
|
|
26
|
+
* Execute a GET request against the Hebbian API.
|
|
27
|
+
* @param path Path relative to apiUrl (must start with "/")
|
|
28
|
+
* @param query Optional query parameters
|
|
29
|
+
*/
|
|
30
|
+
get(path: string, query?: Record<string, string | number | boolean | undefined>): Promise<unknown>;
|
|
31
|
+
/**
|
|
32
|
+
* Execute a POST request against the Hebbian API.
|
|
33
|
+
* @param path Path relative to apiUrl (must start with "/")
|
|
34
|
+
* @param body Request body (serialised to JSON)
|
|
35
|
+
*/
|
|
36
|
+
post(path: string, body: Record<string, unknown>): Promise<unknown>;
|
|
37
|
+
/** Build an absolute URL from path + optional query params. */
|
|
38
|
+
private buildUrl;
|
|
39
|
+
/** Standard request headers including bearer auth. */
|
|
40
|
+
private headers;
|
|
41
|
+
/**
|
|
42
|
+
* Parse and validate a fetch response.
|
|
43
|
+
* Throws HebbianApiError on non-2xx status codes.
|
|
44
|
+
*/
|
|
45
|
+
private handleResponse;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,2EAA2E;AAC3E,qBAAa,eAAgB,SAAQ,KAAK;aAEtB,UAAU,EAAE,MAAM;aAClB,SAAS,EAAE,MAAM;aAEjB,MAAM,CAAC,EAAE,OAAO;gBAHhB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjC,OAAO,EAAE,MAAM,EACC,MAAM,CAAC,EAAE,OAAO,YAAA;IAMlC,0DAA0D;IAC1D,WAAW,IAAI,MAAM;CAsBtB;AAUD,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAS;gBAErB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAO1D;;;;OAIG;IACG,GAAG,CACP,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,GAC5D,OAAO,CAAC,OAAO,CAAC;IASnB;;;;OAIG;IACG,IAAI,CACR,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,OAAO,CAAC;IAanB,+DAA+D;IAC/D,OAAO,CAAC,QAAQ;IAehB,sDAAsD;IACtD,OAAO,CAAC,OAAO;IAcf;;;OAGG;YACW,cAAc;CAgC7B"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* src/client.ts
|
|
3
|
+
*
|
|
4
|
+
* HTTPS client for the Hebbian API.
|
|
5
|
+
*
|
|
6
|
+
* - Adds Authorization: Bearer header to every request.
|
|
7
|
+
* - Surfaces API errors as structured HebbianApiError with code + message.
|
|
8
|
+
* - No business logic — thin transport wrapper over fetch.
|
|
9
|
+
* - All tool call implementations live in src/tools/*.ts.
|
|
10
|
+
*/
|
|
11
|
+
/** Structured API error returned by the Hebbian API (RFC 7807 variant). */
|
|
12
|
+
export class HebbianApiError extends Error {
|
|
13
|
+
statusCode;
|
|
14
|
+
errorCode;
|
|
15
|
+
detail;
|
|
16
|
+
constructor(statusCode, errorCode, message, detail) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.statusCode = statusCode;
|
|
19
|
+
this.errorCode = errorCode;
|
|
20
|
+
this.detail = detail;
|
|
21
|
+
this.name = "HebbianApiError";
|
|
22
|
+
}
|
|
23
|
+
/** Human-readable string for MCP tool error responses. */
|
|
24
|
+
toToolError() {
|
|
25
|
+
if (this.statusCode === 401) {
|
|
26
|
+
return (`Authentication failed (${this.errorCode}): ${this.message}. ` +
|
|
27
|
+
"Your token may be expired or revoked. " +
|
|
28
|
+
"Generate a new token from the AI Tools tab in your Hebbian integrations page.");
|
|
29
|
+
}
|
|
30
|
+
if (this.statusCode === 403) {
|
|
31
|
+
return (`Permission denied (${this.errorCode}): ${this.message}. ` +
|
|
32
|
+
"Check that your token scope (employee/company) matches the operation.");
|
|
33
|
+
}
|
|
34
|
+
if (this.statusCode === 404) {
|
|
35
|
+
return `Not found (${this.errorCode}): ${this.message}`;
|
|
36
|
+
}
|
|
37
|
+
if (this.statusCode === 429) {
|
|
38
|
+
return `Rate limit exceeded (${this.errorCode}): ${this.message}. Slow down and retry.`;
|
|
39
|
+
}
|
|
40
|
+
return `API error ${this.statusCode} (${this.errorCode}): ${this.message}`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export class HebbianClient {
|
|
44
|
+
apiUrl;
|
|
45
|
+
token;
|
|
46
|
+
tenant;
|
|
47
|
+
constructor(apiUrl, token, tenant) {
|
|
48
|
+
// Normalise: strip trailing slash
|
|
49
|
+
this.apiUrl = apiUrl.replace(/\/+$/, "");
|
|
50
|
+
this.token = token;
|
|
51
|
+
this.tenant = tenant && tenant.trim().length > 0 ? tenant.trim() : undefined;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Execute a GET request against the Hebbian API.
|
|
55
|
+
* @param path Path relative to apiUrl (must start with "/")
|
|
56
|
+
* @param query Optional query parameters
|
|
57
|
+
*/
|
|
58
|
+
async get(path, query) {
|
|
59
|
+
const url = this.buildUrl(path, query);
|
|
60
|
+
const response = await fetch(url.toString(), {
|
|
61
|
+
method: "GET",
|
|
62
|
+
headers: this.headers(),
|
|
63
|
+
});
|
|
64
|
+
return this.handleResponse(response);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Execute a POST request against the Hebbian API.
|
|
68
|
+
* @param path Path relative to apiUrl (must start with "/")
|
|
69
|
+
* @param body Request body (serialised to JSON)
|
|
70
|
+
*/
|
|
71
|
+
async post(path, body) {
|
|
72
|
+
const url = this.buildUrl(path);
|
|
73
|
+
const response = await fetch(url.toString(), {
|
|
74
|
+
method: "POST",
|
|
75
|
+
headers: {
|
|
76
|
+
...this.headers(),
|
|
77
|
+
"Content-Type": "application/json",
|
|
78
|
+
},
|
|
79
|
+
body: JSON.stringify(body),
|
|
80
|
+
});
|
|
81
|
+
return this.handleResponse(response);
|
|
82
|
+
}
|
|
83
|
+
/** Build an absolute URL from path + optional query params. */
|
|
84
|
+
buildUrl(path, query) {
|
|
85
|
+
const url = new URL(`${this.apiUrl}${path}`);
|
|
86
|
+
if (query) {
|
|
87
|
+
for (const [k, v] of Object.entries(query)) {
|
|
88
|
+
if (v !== undefined) {
|
|
89
|
+
url.searchParams.set(k, String(v));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return url;
|
|
94
|
+
}
|
|
95
|
+
/** Standard request headers including bearer auth. */
|
|
96
|
+
headers() {
|
|
97
|
+
const h = {
|
|
98
|
+
Authorization: `Bearer ${this.token}`,
|
|
99
|
+
Accept: "application/json",
|
|
100
|
+
"User-Agent": "@hebbianvault/mcp/0.2.0",
|
|
101
|
+
};
|
|
102
|
+
// Only sent when the caller's account belongs to more than one workspace.
|
|
103
|
+
// The API resolves the single-membership case from the token alone.
|
|
104
|
+
if (this.tenant) {
|
|
105
|
+
h["X-Hebbian-Tenant"] = this.tenant;
|
|
106
|
+
}
|
|
107
|
+
return h;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Parse and validate a fetch response.
|
|
111
|
+
* Throws HebbianApiError on non-2xx status codes.
|
|
112
|
+
*/
|
|
113
|
+
async handleResponse(response) {
|
|
114
|
+
if (response.ok) {
|
|
115
|
+
const data = await response.json();
|
|
116
|
+
return data;
|
|
117
|
+
}
|
|
118
|
+
// Parse error body for structured error info
|
|
119
|
+
let errBody = {};
|
|
120
|
+
try {
|
|
121
|
+
errBody = (await response.json());
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
// Error body couldn't be parsed — use raw text
|
|
125
|
+
const rawText = await response.text().catch(() => "");
|
|
126
|
+
errBody = { message: rawText || response.statusText };
|
|
127
|
+
}
|
|
128
|
+
const errorCode = errBody.code ?? errBody.error ?? `HTTP_${response.status}`;
|
|
129
|
+
const message = errBody.message ??
|
|
130
|
+
errBody.error ??
|
|
131
|
+
`Request failed with status ${response.status}`;
|
|
132
|
+
throw new HebbianApiError(response.status, errorCode, message, errBody.detail);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,2EAA2E;AAC3E,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAEtB;IACA;IAEA;IAJlB,YACkB,UAAkB,EAClB,SAAiB,EACjC,OAAe,EACC,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AAI,QAAQ,QAAQ,CAAC,MAAM,EAAE,CAAC;QAC7D,MAAM,OAAO,GACX,OAAO,CAAC,OAAO;YACf,OAAO,CAAC,KAAK;YACb,8BAA8B,QAAQ,CAAC,MAAM,EAAE,CAAC;QAElD,MAAM,IAAI,eAAe,CACvB,QAAQ,CAAC,MAAM,EACf,SAAS,EACT,OAAO,EACP,OAAO,CAAC,MAAM,CACf,CAAC;IACJ,CAAC;CACF"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* src/config.ts
|
|
3
|
+
*
|
|
4
|
+
* Configuration loading for @hebbianvault/mcp.
|
|
5
|
+
*
|
|
6
|
+
* Auth: bearer token from HEBBIAN_API_TOKEN env var (preferred) or
|
|
7
|
+
* HEBBIAN_TOKEN (alternative) or config-file JSON path.
|
|
8
|
+
* URL: HEBBIAN_API_URL env var (default: the Hebbian SaaS API). Enterprise
|
|
9
|
+
* self-host customers override this to point at their own VM.
|
|
10
|
+
* Tenant: HEBBIAN_TENANT (optional) — only needed when your account belongs to
|
|
11
|
+
* more than one Hebbian workspace, to disambiguate which one to act in.
|
|
12
|
+
*/
|
|
13
|
+
export interface HebbianConfig {
|
|
14
|
+
/** Base URL of the Hebbian API (configurable for Enterprise self-host). */
|
|
15
|
+
apiUrl: string;
|
|
16
|
+
/** Bearer token for authentication (never log this). */
|
|
17
|
+
token: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional workspace slug. Only required when your account belongs to more
|
|
20
|
+
* than one Hebbian workspace; sent as the X-Hebbian-Tenant header so the API
|
|
21
|
+
* knows which workspace you are acting in. Single-workspace accounts can omit.
|
|
22
|
+
*/
|
|
23
|
+
tenant?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Load configuration from environment variables and optional config file.
|
|
27
|
+
*
|
|
28
|
+
* Priority (highest first):
|
|
29
|
+
* 1. HEBBIAN_API_TOKEN / HEBBIAN_TOKEN env vars
|
|
30
|
+
* 2. HEBBIAN_CONFIG_PATH — path to a JSON config file
|
|
31
|
+
* 3. ~/.config/hebbian/mcp-tenant.json
|
|
32
|
+
*
|
|
33
|
+
* Throws if no token can be resolved — the MCP server cannot start without auth.
|
|
34
|
+
*/
|
|
35
|
+
export declare function loadConfig(): HebbianConfig;
|
|
36
|
+
//# sourceMappingURL=config.d.ts.map
|