@hydradb/mcp 1.0.0 → 1.1.1
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/README.md +72 -55
- package/dist/adapters.d.ts +37 -0
- package/dist/adapters.js +113 -0
- package/dist/adapters.js.map +1 -0
- package/dist/config.d.ts +26 -0
- package/dist/config.js +55 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +5 -0
- package/dist/context.js.map +1 -0
- package/dist/descriptions.d.ts +116 -0
- package/dist/descriptions.js +157 -58
- package/dist/descriptions.js.map +1 -0
- package/dist/hydra/client.d.ts +152 -0
- package/dist/hydra/client.js +197 -0
- package/dist/hydra/client.js.map +1 -0
- package/dist/hydra/envelope.d.ts +15 -0
- package/dist/hydra/envelope.js +28 -0
- package/dist/hydra/envelope.js.map +1 -0
- package/dist/hydra/errors.d.ts +37 -0
- package/dist/hydra/errors.js +58 -0
- package/dist/hydra/errors.js.map +1 -0
- package/dist/hydra/index.d.ts +11 -0
- package/dist/hydra/index.js +11 -0
- package/dist/hydra/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +23 -0
- package/dist/logger.js +11 -3
- package/dist/logger.js.map +1 -0
- package/dist/server.d.ts +37 -0
- package/dist/server.js +385 -286
- package/dist/server.js.map +1 -0
- package/dist/tool-names.d.ts +19 -0
- package/dist/tool-names.js +40 -2
- package/dist/tool-names.js.map +1 -0
- package/dist/types.d.ts +64 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/package.json +5 -4
- package/dist/client.js +0 -144
package/README.md
CHANGED
|
@@ -4,7 +4,20 @@ MCP (Model Context Protocol) server for [Hydra DB](https://hydradb.com), the sta
|
|
|
4
4
|
|
|
5
5
|
## Available Tools
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The tool names follow the canonical HydraDB vocabulary. Every previous name still
|
|
8
|
+
works as a **deprecated alias** (marked as such in its description) so existing
|
|
9
|
+
`mcp.json` files keep working — but new integrations should use the canonical
|
|
10
|
+
names below.
|
|
11
|
+
|
|
12
|
+
| Canonical tool | Deprecated alias(es) |
|
|
13
|
+
|---|---|
|
|
14
|
+
| `hydradb_query` | `hydra_db_search` |
|
|
15
|
+
| `hydradb_ingest` | `hydra_db_store`, `hydra_db_ingest_conversation` |
|
|
16
|
+
| `hydradb_list` | `hydra_db_list_memories`, `hydra_db_list_sources` |
|
|
17
|
+
| `hydradb_inspect` | `hydra_db_fetch_content` |
|
|
18
|
+
| `hydradb_delete` | `hydra_db_delete_memory` |
|
|
19
|
+
|
|
20
|
+
### **hydradb_query**
|
|
8
21
|
|
|
9
22
|
Search through Hydra DB memories. Returns relevant chunks with graph-enriched context including entity paths and knowledge graph relations.
|
|
10
23
|
|
|
@@ -15,41 +28,32 @@ Search through Hydra DB memories. Returns relevant chunks with graph-enriched co
|
|
|
15
28
|
| `mode` | string | No | Recall mode: `fast` for quick semantic search, `thinking` for deeper personalised recall with graph traversal (default: `thinking`) |
|
|
16
29
|
| `graph_context` | boolean | No | Whether to include knowledge graph relations in results (default: true) |
|
|
17
30
|
|
|
18
|
-
### **
|
|
31
|
+
### **hydradb_ingest**
|
|
19
32
|
|
|
20
|
-
Save
|
|
33
|
+
Save information to Hydra DB memory. Hydra DB automatically extracts insights, preferences, and builds a knowledge graph from the stored content. Provide `text` to store a note/document, or `turns` to ingest a conversation.
|
|
21
34
|
|
|
22
35
|
| Parameter | Type | Required | Description |
|
|
23
36
|
|-----------|------|----------|-------------|
|
|
24
|
-
| `text` | string |
|
|
37
|
+
| `text` | string | No\* | The information to store in memory |
|
|
25
38
|
| `title` | string | No | Title for the memory entry (default: `MCP Memory`) |
|
|
26
39
|
| `source_id` | string | No | Source identifier to group related memories together (e.g. session ID) |
|
|
27
40
|
| `infer` | boolean | No | Whether Hydra DB should extract insights and build knowledge graph (default: true) |
|
|
28
41
|
| `is_markdown` | boolean | No | Whether the text is in markdown format (default: false) |
|
|
42
|
+
| `turns` | array | No\* | Conversation turns (each with a `user` and `assistant` field) to ingest instead of `text` |
|
|
43
|
+
| `user_name` | string | No | Name of the user for personalisation, used with `turns` (default: `User`) |
|
|
29
44
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Ingest user-assistant conversation turns into Hydra DB memory. Hydra DB extracts insights, preferences, and knowledge graph entities from the conversation.
|
|
33
|
-
|
|
34
|
-
| Parameter | Type | Required | Description |
|
|
35
|
-
|-----------|------|----------|-------------|
|
|
36
|
-
| `turns` | array | Yes | Array of conversation turns, each with a `user` and `assistant` field |
|
|
37
|
-
| `source_id` | string | Yes | Source identifier to group all turns from the same session together |
|
|
38
|
-
| `user_name` | string | No | Name of the user for personalisation (default: `User`) |
|
|
45
|
+
\* Provide exactly one of `text` or `turns`.
|
|
39
46
|
|
|
40
|
-
### **
|
|
47
|
+
### **hydradb_list**
|
|
41
48
|
|
|
42
|
-
List
|
|
43
|
-
|
|
44
|
-
### **hydra_db_delete_memory**
|
|
45
|
-
|
|
46
|
-
Delete a specific user memory from Hydra DB by its memory ID. This action is irreversible.
|
|
49
|
+
List stored memories or ingested knowledge sources in Hydra DB.
|
|
47
50
|
|
|
48
51
|
| Parameter | Type | Required | Description |
|
|
49
52
|
|-----------|------|----------|-------------|
|
|
50
|
-
| `
|
|
53
|
+
| `kind` | string | No | Which family to list: `memory` or `knowledge` (default: `memory`) |
|
|
54
|
+
| `source_ids` | array | No | For `knowledge`, an array of specific source IDs to filter by. If omitted, lists all |
|
|
51
55
|
|
|
52
|
-
### **
|
|
56
|
+
### **hydradb_inspect**
|
|
53
57
|
|
|
54
58
|
Fetch the full content of a specific source by its source ID.
|
|
55
59
|
|
|
@@ -58,29 +62,36 @@ Fetch the full content of a specific source by its source ID.
|
|
|
58
62
|
| `source_id` | string | Yes | The source ID to fetch content for |
|
|
59
63
|
| `mode` | string | No | Fetch mode: `content` for text, `url` for presigned URL, `both` for both (default: `content`) |
|
|
60
64
|
|
|
61
|
-
### **
|
|
65
|
+
### **hydradb_delete**
|
|
62
66
|
|
|
63
|
-
|
|
67
|
+
Delete a memory or knowledge source from Hydra DB by its ID. This action is irreversible.
|
|
64
68
|
|
|
65
69
|
| Parameter | Type | Required | Description |
|
|
66
70
|
|-----------|------|----------|-------------|
|
|
67
|
-
| `
|
|
71
|
+
| `id` | string | Yes | The ID of the item to delete |
|
|
72
|
+
| `kind` | string | No | Which family the ID belongs to: `memory` or `knowledge` (default: `memory`) |
|
|
68
73
|
|
|
69
74
|
## Configuration
|
|
70
75
|
|
|
71
76
|
### Get Your Credentials
|
|
72
77
|
|
|
73
78
|
1. Get your Hydra DB API Key from [Hydra DB](https://app.hydradb.com)
|
|
74
|
-
2. Get your
|
|
79
|
+
2. Get your database name from the Hydra DB dashboard
|
|
75
80
|
|
|
76
81
|
### Environment Variables
|
|
77
82
|
|
|
78
|
-
| Variable
|
|
79
|
-
|
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
83
|
+
| Variable | Description | Default |
|
|
84
|
+
| -------------------- | ------------------------------------ | ------------------------- |
|
|
85
|
+
| `HYDRADB_API_KEY` | Your Hydra DB API key | *Required* |
|
|
86
|
+
| `HYDRADB_DATABASE` | Your Hydra DB database (tenant scope) | *Required* |
|
|
87
|
+
| `HYDRADB_COLLECTION` | Collection (sub-tenant) for partitioning | `hydra-db-mcp` |
|
|
88
|
+
| `HYDRADB_BASE_URL` | Base URL override | `https://api.hydradb.com` |
|
|
89
|
+
| `HYDRADB_LOG_LEVEL` | Log level: DEBUG, INFO, WARN, ERROR | `ERROR` |
|
|
90
|
+
|
|
91
|
+
The legacy `HYDRA_DB_*` names — `HYDRA_DB_API_KEY`, `HYDRA_DB_TENANT_ID`,
|
|
92
|
+
`HYDRA_DB_SUB_TENANT_ID`, `HYDRA_DB_BASE_URL`, `HYDRA_DB_LOG_LEVEL` — remain
|
|
93
|
+
honoured as **deprecated aliases** (canonical wins when both are set; using an
|
|
94
|
+
alias prints a one-time warning naming its replacement).
|
|
84
95
|
|
|
85
96
|
### Claude Desktop
|
|
86
97
|
|
|
@@ -91,8 +102,8 @@ List all ingested sources in Hydra DB memory. Returns source IDs, titles, types,
|
|
|
91
102
|
"command": "npx",
|
|
92
103
|
"args": ["-y", "@hydradb/mcp@latest"],
|
|
93
104
|
"env": {
|
|
94
|
-
"
|
|
95
|
-
"
|
|
105
|
+
"HYDRADB_API_KEY": "your-api-key",
|
|
106
|
+
"HYDRADB_DATABASE": "your-database"
|
|
96
107
|
}
|
|
97
108
|
}
|
|
98
109
|
}
|
|
@@ -113,8 +124,8 @@ List all ingested sources in Hydra DB memory. Returns source IDs, titles, types,
|
|
|
113
124
|
"command": "npx",
|
|
114
125
|
"args": ["-y", "@hydradb/mcp@latest"],
|
|
115
126
|
"env": {
|
|
116
|
-
"
|
|
117
|
-
"
|
|
127
|
+
"HYDRADB_API_KEY": "your-api-key",
|
|
128
|
+
"HYDRADB_DATABASE": "your-database"
|
|
118
129
|
}
|
|
119
130
|
}
|
|
120
131
|
}
|
|
@@ -133,8 +144,8 @@ Add to `.vscode/mcp.json`:
|
|
|
133
144
|
"command": "npx",
|
|
134
145
|
"args": ["-y", "@hydradb/mcp@latest"],
|
|
135
146
|
"env": {
|
|
136
|
-
"
|
|
137
|
-
"
|
|
147
|
+
"HYDRADB_API_KEY": "your-api-key",
|
|
148
|
+
"HYDRADB_DATABASE": "your-database"
|
|
138
149
|
}
|
|
139
150
|
}
|
|
140
151
|
}
|
|
@@ -143,7 +154,7 @@ Add to `.vscode/mcp.json`:
|
|
|
143
154
|
|
|
144
155
|
### Custom Sub-Tenant
|
|
145
156
|
|
|
146
|
-
To partition data, set the `
|
|
157
|
+
To partition data, set the `HYDRADB_COLLECTION` environment variable:
|
|
147
158
|
|
|
148
159
|
```json
|
|
149
160
|
{
|
|
@@ -152,9 +163,9 @@ To partition data, set the `HYDRA_DB_SUB_TENANT_ID` environment variable:
|
|
|
152
163
|
"command": "npx",
|
|
153
164
|
"args": ["-y", "@hydradb/mcp@latest"],
|
|
154
165
|
"env": {
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
166
|
+
"HYDRADB_API_KEY": "your-api-key",
|
|
167
|
+
"HYDRADB_DATABASE": "your-database",
|
|
168
|
+
"HYDRADB_COLLECTION": "my-project"
|
|
158
169
|
}
|
|
159
170
|
}
|
|
160
171
|
}
|
|
@@ -163,44 +174,50 @@ To partition data, set the `HYDRA_DB_SUB_TENANT_ID` environment variable:
|
|
|
163
174
|
|
|
164
175
|
## How It Works
|
|
165
176
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
- **
|
|
172
|
-
- **
|
|
177
|
+
The server talks to Hydra DB through the generated [`@hydradb/sdk`](https://www.npmjs.com/package/@hydradb/sdk)
|
|
178
|
+
(pinned exactly), behind a thin hand-owned wrapper in `src/hydra`. The wrapper
|
|
179
|
+
owns scope injection, envelope unwrapping and error translation; the tools call
|
|
180
|
+
it and render the results.
|
|
181
|
+
|
|
182
|
+
- **hydradb_query** retrieves relevant memories and returns graph-enriched context (entity paths, chunk relations, extra context). Supports `fast` and `thinking` recall modes.
|
|
183
|
+
- **hydradb_ingest** stores a note (`text`) or a conversation (`turns`) as a memory, with configurable `infer`, `is_markdown`, `title`, and `source_id`. Hydra DB extracts insights and builds a knowledge graph automatically.
|
|
184
|
+
- **hydradb_list** browses stored memories (`kind: memory`) or ingested knowledge sources (`kind: knowledge`, with an optional `source_ids` filter).
|
|
185
|
+
- **hydradb_inspect** retrieves the original ingested content of a source, with mode options (`content`, `url`, or `both`).
|
|
186
|
+
- **hydradb_delete** removes a memory or knowledge source by ID.
|
|
173
187
|
|
|
174
188
|
## Development
|
|
175
189
|
|
|
176
190
|
```bash
|
|
177
191
|
npm ci
|
|
178
192
|
npm run build
|
|
179
|
-
|
|
193
|
+
HYDRADB_API_KEY=your-key HYDRADB_DATABASE=your-database npm start
|
|
180
194
|
```
|
|
181
195
|
|
|
182
196
|
For development with auto-reload:
|
|
183
197
|
|
|
184
198
|
```bash
|
|
185
|
-
|
|
199
|
+
HYDRADB_API_KEY=your-key HYDRADB_DATABASE=your-database npm run dev
|
|
186
200
|
```
|
|
187
201
|
|
|
188
202
|
## Testing
|
|
189
203
|
|
|
190
204
|
```bash
|
|
191
|
-
# unit tests (mocked
|
|
205
|
+
# unit + conformance tests (wrapper driven against a mocked SDK transport)
|
|
192
206
|
npm test
|
|
193
207
|
|
|
194
|
-
#
|
|
195
|
-
|
|
208
|
+
# just the shared conformance vectors
|
|
209
|
+
npm run test:conformance
|
|
210
|
+
|
|
211
|
+
# live integration test against Hydra DB (drives the wrapper end to end)
|
|
212
|
+
RUN_LIVE_TESTS=true HYDRADB_API_KEY=your-key HYDRADB_DATABASE=your-database npm run test:integration
|
|
196
213
|
```
|
|
197
214
|
|
|
198
215
|
## Troubleshooting
|
|
199
216
|
|
|
200
|
-
- **API Key Issues**: Ensure `
|
|
217
|
+
- **API Key Issues**: Ensure `HYDRADB_API_KEY` is set correctly
|
|
201
218
|
- **Connection Errors**: Check your internet connection and API key validity
|
|
202
219
|
- **Tool Not Found**: Make sure the package is installed and the command path is correct
|
|
203
|
-
- **Debug Logging**: Set `
|
|
220
|
+
- **Debug Logging**: Set `HYDRADB_LOG_LEVEL=DEBUG` for verbose output
|
|
204
221
|
|
|
205
222
|
## Contributing / Developer Setup
|
|
206
223
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapters from the SDK's (camelCase) response payloads back into the legacy
|
|
3
|
+
* snake_case shapes this server already renders.
|
|
4
|
+
*
|
|
5
|
+
* These live in the MCP layer — NOT the portable wrapper — because they exist
|
|
6
|
+
* only to keep `src/context.ts` (the high-value, byte-identical recall
|
|
7
|
+
* renderer) and the existing tool output strings unchanged across the v1 → SDK
|
|
8
|
+
* migration. The wrapper returns SDK-native `.data`; the server adapts it here.
|
|
9
|
+
*
|
|
10
|
+
* Note: with `skipValidation`, the SDK transforms known fields to camelCase but
|
|
11
|
+
* leaves the untyped triplet innards (`relation`/`source`/`target`) as raw
|
|
12
|
+
* snake_case — which is exactly what `formatTriplet` reads — so triplets pass
|
|
13
|
+
* through untouched.
|
|
14
|
+
*/
|
|
15
|
+
import type { HydraDB as SDK } from "@hydradb/sdk";
|
|
16
|
+
import type { AddMemoryResponse, RecallResponse } from "./types.js";
|
|
17
|
+
/** SDK retrieval result → the legacy `RecallResponse` fed to `buildRecalledContext`. */
|
|
18
|
+
export declare function toRecallResponse(data: SDK.SearchV2RetrievalResult): RecallResponse;
|
|
19
|
+
/** SDK ingest result → the legacy `AddMemoryResponse` (success/failed counts). */
|
|
20
|
+
export declare function toAddMemoryResponse(data: SDK.IngestionV2SourceUploadResponse): AddMemoryResponse;
|
|
21
|
+
export interface MemoryListItem {
|
|
22
|
+
memory_id: string;
|
|
23
|
+
memory_content: string;
|
|
24
|
+
}
|
|
25
|
+
/** SDK list result → memory rows. Field names vary across v2 records, so read defensively. */
|
|
26
|
+
export declare function toMemoryList(data: SDK.ListV2SourceListResponse): MemoryListItem[];
|
|
27
|
+
export interface SourceListItem {
|
|
28
|
+
id: string;
|
|
29
|
+
title?: string;
|
|
30
|
+
type?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface SourceList {
|
|
33
|
+
sources: SourceListItem[];
|
|
34
|
+
total: number;
|
|
35
|
+
}
|
|
36
|
+
/** SDK list result → knowledge source rows + total. */
|
|
37
|
+
export declare function toSourceList(data: SDK.ListV2SourceListResponse): SourceList;
|
package/dist/adapters.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapters from the SDK's (camelCase) response payloads back into the legacy
|
|
3
|
+
* snake_case shapes this server already renders.
|
|
4
|
+
*
|
|
5
|
+
* These live in the MCP layer — NOT the portable wrapper — because they exist
|
|
6
|
+
* only to keep `src/context.ts` (the high-value, byte-identical recall
|
|
7
|
+
* renderer) and the existing tool output strings unchanged across the v1 → SDK
|
|
8
|
+
* migration. The wrapper returns SDK-native `.data`; the server adapts it here.
|
|
9
|
+
*
|
|
10
|
+
* Note: with `skipValidation`, the SDK transforms known fields to camelCase but
|
|
11
|
+
* leaves the untyped triplet innards (`relation`/`source`/`target`) as raw
|
|
12
|
+
* snake_case — which is exactly what `formatTriplet` reads — so triplets pass
|
|
13
|
+
* through untouched.
|
|
14
|
+
*/
|
|
15
|
+
function toScoredPath(path) {
|
|
16
|
+
return {
|
|
17
|
+
// Triplet innards are already raw snake_case (untyped in the SDK schema).
|
|
18
|
+
triplets: (path.triplets ?? []),
|
|
19
|
+
relevancy_score: path.relevancyScore ?? 0,
|
|
20
|
+
combined_context: path.combinedContext ?? null,
|
|
21
|
+
group_id: path.groupId ?? null,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function toVectorChunk(chunk) {
|
|
25
|
+
return {
|
|
26
|
+
chunk_uuid: chunk.chunkUuid ?? "",
|
|
27
|
+
source_id: chunk.id ?? "",
|
|
28
|
+
chunk_content: chunk.chunkContent ?? "",
|
|
29
|
+
source_title: chunk.sourceTitle,
|
|
30
|
+
source_type: chunk.sourceType,
|
|
31
|
+
source_upload_time: chunk.sourceUploadTime,
|
|
32
|
+
source_last_updated_time: chunk.sourceLastUpdatedTime,
|
|
33
|
+
relevancy_score: chunk.relevancyScore ?? null,
|
|
34
|
+
document_metadata: chunk.additionalMetadata ?? null,
|
|
35
|
+
tenant_metadata: chunk.metadata ?? null,
|
|
36
|
+
extra_context_ids: chunk.extraContextIds ?? null,
|
|
37
|
+
layout: chunk.layout ?? null,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** SDK retrieval result → the legacy `RecallResponse` fed to `buildRecalledContext`. */
|
|
41
|
+
export function toRecallResponse(data) {
|
|
42
|
+
const graph = data.graphContext;
|
|
43
|
+
const additional = {};
|
|
44
|
+
for (const [id, chunk] of Object.entries(data.additionalContext ?? {})) {
|
|
45
|
+
additional[id] = toVectorChunk(chunk);
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
chunks: (data.chunks ?? []).map(toVectorChunk),
|
|
49
|
+
graph_context: graph
|
|
50
|
+
? {
|
|
51
|
+
query_paths: (graph.queryPaths ?? []).map(toScoredPath),
|
|
52
|
+
chunk_relations: (graph.chunkRelations ?? []).map(toScoredPath),
|
|
53
|
+
chunk_id_to_group_ids: graph.chunkIdToGroupIds ?? {},
|
|
54
|
+
}
|
|
55
|
+
: undefined,
|
|
56
|
+
additional_context: additional,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** SDK ingest result → the legacy `AddMemoryResponse` (success/failed counts). */
|
|
60
|
+
export function toAddMemoryResponse(data) {
|
|
61
|
+
return {
|
|
62
|
+
success: data.success ?? false,
|
|
63
|
+
message: data.message ?? "",
|
|
64
|
+
results: [],
|
|
65
|
+
success_count: data.successCount ?? 0,
|
|
66
|
+
failed_count: data.failedCount ?? 0,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function str(record, ...keys) {
|
|
70
|
+
for (const key of keys) {
|
|
71
|
+
const value = record[key];
|
|
72
|
+
if (typeof value === "string")
|
|
73
|
+
return value;
|
|
74
|
+
}
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
function asRecords(value) {
|
|
78
|
+
return Array.isArray(value)
|
|
79
|
+
? value
|
|
80
|
+
: undefined;
|
|
81
|
+
}
|
|
82
|
+
/** SDK list result → memory rows. Field names vary across v2 records, so read defensively. */
|
|
83
|
+
export function toMemoryList(data) {
|
|
84
|
+
// Memory listings surface at top-level `user_memories` — not under an
|
|
85
|
+
// `.inner` wrapper, and not under `sources` (that is the knowledge shape).
|
|
86
|
+
const d = data;
|
|
87
|
+
const records = asRecords(d.user_memories) ??
|
|
88
|
+
asRecords(d.inner?.user_memories) ??
|
|
89
|
+
[];
|
|
90
|
+
return records.map((record) => ({
|
|
91
|
+
memory_id: str(record, "memory_id", "id", "source_id") ?? "",
|
|
92
|
+
memory_content: str(record, "memory_content", "content", "text", "memory", "title") ?? "",
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
/** SDK list result → knowledge source rows + total. */
|
|
96
|
+
export function toSourceList(data) {
|
|
97
|
+
// Knowledge listings surface at top-level `sources`, not under `.inner`.
|
|
98
|
+
const d = data;
|
|
99
|
+
const records = asRecords(d.sources) ??
|
|
100
|
+
asRecords(d.inner?.sources) ??
|
|
101
|
+
[];
|
|
102
|
+
const sources = records.map((record) => ({
|
|
103
|
+
id: str(record, "id", "source_id") ?? "",
|
|
104
|
+
title: str(record, "title"),
|
|
105
|
+
type: str(record, "type", "source_type"),
|
|
106
|
+
}));
|
|
107
|
+
const total = d.total ?? d.inner?.total;
|
|
108
|
+
return {
|
|
109
|
+
sources,
|
|
110
|
+
total: typeof total === "number" ? total : sources.length,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=adapters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.js","sourceRoot":"","sources":["../src/adapters.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAWH,SAAS,YAAY,CAAC,IAAkC;IACvD,OAAO;QACN,0EAA0E;QAC1E,QAAQ,EAAE,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAsC;QACpE,eAAe,EAAE,IAAI,CAAC,cAAc,IAAI,CAAC;QACzC,gBAAgB,EAAE,IAAI,CAAC,eAAe,IAAI,IAAI;QAC9C,QAAQ,EAAE,IAAI,CAAC,OAAO,IAAI,IAAI;KAC9B,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,KAAwB;IAC9C,OAAO;QACN,UAAU,EAAE,KAAK,CAAC,SAAS,IAAI,EAAE;QACjC,SAAS,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE;QACzB,aAAa,EAAE,KAAK,CAAC,YAAY,IAAI,EAAE;QACvC,YAAY,EAAE,KAAK,CAA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1E,CAAC,CAAC,CAAC;AACL,CAAC;AAaD,uDAAuD;AACvD,MAAM,UAAU,YAAY,CAAC,IAAkC;IAC9D,yEAAyE;IACzE,MAAM,CAAC,GAAG,IAA0C,CAAC;IACrD,MAAM,OAAO,GACZ,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;QACpB,SAAS,CAAE,CAAC,CAAC,KAA6C,EAAE,OAAO,CAAC;QACpE,EAAE,CAAC;IACJ,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACxC,EAAE,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE;QACxC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;QAC3B,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC;KACxC,CAAC,CAAC,CAAC;IACJ,MAAM,KAAK,GACV,CAAC,CAAC,KAAK,IAAK,CAAC,CAAC,KAA6C,EAAE,KAAK,CAAC;IACpE,OAAO;QACN,OAAO;QACP,KAAK,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM;KACzD,CAAC;AACH,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server configuration from the environment.
|
|
3
|
+
*
|
|
4
|
+
* Adopts the canonical `HYDRADB_*` names (CONTRACT §1) as PRIMARY, while still
|
|
5
|
+
* honouring the legacy `HYDRA_DB_*` names as deprecated aliases so existing
|
|
6
|
+
* setups keep working. The canonical name wins when both are set; using a
|
|
7
|
+
* deprecated alias emits exactly one stderr warning per process naming the
|
|
8
|
+
* canonical replacement.
|
|
9
|
+
*/
|
|
10
|
+
export interface HydraDBConfig {
|
|
11
|
+
apiKey: string;
|
|
12
|
+
database: string;
|
|
13
|
+
collection: string;
|
|
14
|
+
baseUrl?: string;
|
|
15
|
+
}
|
|
16
|
+
export type EnvSource = Record<string, string | undefined>;
|
|
17
|
+
export type WarnFn = (message: string) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Read a canonical `HYDRADB_*` variable, falling back to the legacy `HYDRA_DB_*`
|
|
20
|
+
* spelling with a once-per-process warning. Exported so every variable this
|
|
21
|
+
* server reads goes through the same rule - `HYDRADB_LOG_LEVEL` is resolved by
|
|
22
|
+
* the logger, which owns its own module state but must not invent a second
|
|
23
|
+
* deprecation policy.
|
|
24
|
+
*/
|
|
25
|
+
export declare function readEnv(env: EnvSource, canonical: string, deprecated: string, warn?: WarnFn): string | undefined;
|
|
26
|
+
export declare function resolveConfig(env?: EnvSource, warn?: WarnFn): HydraDBConfig;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server configuration from the environment.
|
|
3
|
+
*
|
|
4
|
+
* Adopts the canonical `HYDRADB_*` names (CONTRACT §1) as PRIMARY, while still
|
|
5
|
+
* honouring the legacy `HYDRA_DB_*` names as deprecated aliases so existing
|
|
6
|
+
* setups keep working. The canonical name wins when both are set; using a
|
|
7
|
+
* deprecated alias emits exactly one stderr warning per process naming the
|
|
8
|
+
* canonical replacement.
|
|
9
|
+
*/
|
|
10
|
+
const DEFAULT_COLLECTION = "hydra-db-mcp";
|
|
11
|
+
// Process-lifetime dedupe so each deprecated alias warns at most once.
|
|
12
|
+
const warnedOnce = new Set();
|
|
13
|
+
function defaultWarn(message) {
|
|
14
|
+
console.error(message);
|
|
15
|
+
}
|
|
16
|
+
function warnOnce(message, warn) {
|
|
17
|
+
if (warnedOnce.has(message))
|
|
18
|
+
return;
|
|
19
|
+
warnedOnce.add(message);
|
|
20
|
+
warn(message);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Read a canonical `HYDRADB_*` variable, falling back to the legacy `HYDRA_DB_*`
|
|
24
|
+
* spelling with a once-per-process warning. Exported so every variable this
|
|
25
|
+
* server reads goes through the same rule - `HYDRADB_LOG_LEVEL` is resolved by
|
|
26
|
+
* the logger, which owns its own module state but must not invent a second
|
|
27
|
+
* deprecation policy.
|
|
28
|
+
*/
|
|
29
|
+
export function readEnv(env, canonical, deprecated, warn = defaultWarn) {
|
|
30
|
+
const canonicalValue = env[canonical];
|
|
31
|
+
if (canonicalValue != null && canonicalValue !== "") {
|
|
32
|
+
return canonicalValue;
|
|
33
|
+
}
|
|
34
|
+
const deprecatedValue = env[deprecated];
|
|
35
|
+
if (deprecatedValue != null && deprecatedValue !== "") {
|
|
36
|
+
warnOnce(`[hydradb-mcp] Environment variable ${deprecated} is deprecated; use ${canonical} instead.`, warn);
|
|
37
|
+
return deprecatedValue;
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
export function resolveConfig(env = process.env, warn = defaultWarn) {
|
|
42
|
+
const apiKey = readEnv(env, "HYDRADB_API_KEY", "HYDRA_DB_API_KEY", warn);
|
|
43
|
+
if (!apiKey) {
|
|
44
|
+
throw new Error("HYDRADB_API_KEY (or its deprecated alias HYDRA_DB_API_KEY) environment variable is required");
|
|
45
|
+
}
|
|
46
|
+
const database = readEnv(env, "HYDRADB_DATABASE", "HYDRA_DB_TENANT_ID", warn);
|
|
47
|
+
if (!database) {
|
|
48
|
+
throw new Error("HYDRADB_DATABASE (or its deprecated alias HYDRA_DB_TENANT_ID) environment variable is required");
|
|
49
|
+
}
|
|
50
|
+
const collection = readEnv(env, "HYDRADB_COLLECTION", "HYDRA_DB_SUB_TENANT_ID", warn) ??
|
|
51
|
+
DEFAULT_COLLECTION;
|
|
52
|
+
const baseUrl = readEnv(env, "HYDRADB_BASE_URL", "HYDRA_DB_BASE_URL", warn);
|
|
53
|
+
return { apiKey, database, collection, baseUrl };
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js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C,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool descriptions for the Hydra DB MCP server.
|
|
3
|
+
* Kept in a separate file for easy editing and localisation.
|
|
4
|
+
*
|
|
5
|
+
* Every canonical tool (CONTRACT §3) and every deprecated alias has an entry.
|
|
6
|
+
* Alias descriptions are prefixed with a DEPRECATED notice naming the canonical
|
|
7
|
+
* replacement so the model prefers the new name.
|
|
8
|
+
*/
|
|
9
|
+
export declare const TOOL_DESCRIPTIONS: {
|
|
10
|
+
readonly hydradb_query: {
|
|
11
|
+
readonly title: "Query Hydra DB";
|
|
12
|
+
readonly description: string;
|
|
13
|
+
readonly params: {
|
|
14
|
+
readonly query: "The search query to find relevant memories and knowledge";
|
|
15
|
+
readonly kind: string;
|
|
16
|
+
readonly max_results: "Maximum number of chunks to return (1-50, default: 10)";
|
|
17
|
+
readonly mode: "Recall mode: 'fast' for quick semantic search, 'thinking' for deeper personalised recall with graph traversal (default: 'thinking')";
|
|
18
|
+
readonly graph_context: "Whether to include knowledge graph relations in results (default: true)";
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
readonly hydradb_ingest: {
|
|
22
|
+
readonly title: "Ingest into Hydra DB";
|
|
23
|
+
readonly description: string;
|
|
24
|
+
readonly params: {
|
|
25
|
+
readonly text: "The information to store in memory";
|
|
26
|
+
readonly title: "Optional title for the memory entry (default: 'MCP Memory')";
|
|
27
|
+
readonly source_id: string;
|
|
28
|
+
readonly infer: "Whether Hydra DB should extract insights and build knowledge graph from this text (default: true)";
|
|
29
|
+
readonly is_markdown: "Whether the text is in markdown format (default: false)";
|
|
30
|
+
readonly turns: "Optional conversation turns to ingest instead of `text`; each has a 'user' and 'assistant' field";
|
|
31
|
+
readonly user_name: "Optional name of the user for personalisation (default: 'User')";
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
readonly hydradb_list: {
|
|
35
|
+
readonly title: "List Hydra DB Context";
|
|
36
|
+
readonly description: string;
|
|
37
|
+
readonly params: {
|
|
38
|
+
readonly kind: "Which context family to list: 'memory' or 'knowledge' (default: 'memory')";
|
|
39
|
+
readonly source_ids: "Optional array of specific source IDs to filter by. If omitted, lists all sources.";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
readonly hydradb_inspect: {
|
|
43
|
+
readonly title: "Inspect Hydra DB Source";
|
|
44
|
+
readonly description: string;
|
|
45
|
+
readonly params: {
|
|
46
|
+
readonly source_id: "The source ID to fetch content for";
|
|
47
|
+
readonly mode: "Fetch mode: 'content' for text, 'url' for presigned URL, 'both' for both (default: 'content')";
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
readonly hydradb_delete: {
|
|
51
|
+
readonly title: "Delete from Hydra DB";
|
|
52
|
+
readonly description: string;
|
|
53
|
+
readonly params: {
|
|
54
|
+
readonly id: "The ID of the item to delete";
|
|
55
|
+
readonly kind: "Which context family the ID belongs to: 'memory' or 'knowledge' (default: 'memory')";
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
readonly hydra_db_search: {
|
|
59
|
+
readonly title: "Search Hydra DB Memory (deprecated)";
|
|
60
|
+
readonly description: string;
|
|
61
|
+
readonly params: {
|
|
62
|
+
readonly query: "The search query to find relevant memories and knowledge";
|
|
63
|
+
readonly kind: string;
|
|
64
|
+
readonly max_results: "Maximum number of chunks to return (1-50, default: 10)";
|
|
65
|
+
readonly mode: "Recall mode: 'fast' for quick semantic search, 'thinking' for deeper personalised recall with graph traversal (default: 'thinking')";
|
|
66
|
+
readonly graph_context: "Whether to include knowledge graph relations in results (default: true)";
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
readonly hydra_db_store: {
|
|
70
|
+
readonly title: "Store to Hydra DB Memory (deprecated)";
|
|
71
|
+
readonly description: string;
|
|
72
|
+
readonly params: {
|
|
73
|
+
readonly text: "The information to store in memory";
|
|
74
|
+
readonly title: "Optional title for the memory entry (default: 'MCP Memory')";
|
|
75
|
+
readonly source_id: string;
|
|
76
|
+
readonly infer: "Whether Hydra DB should extract insights and build knowledge graph from this text (default: true)";
|
|
77
|
+
readonly is_markdown: "Whether the text is in markdown format (default: false)";
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
readonly hydra_db_ingest_conversation: {
|
|
81
|
+
readonly title: "Ingest Conversation (deprecated)";
|
|
82
|
+
readonly description: string;
|
|
83
|
+
readonly params: {
|
|
84
|
+
readonly turns: "Array of conversation turns, each with a 'user' and 'assistant' field";
|
|
85
|
+
readonly source_id: "Source identifier to group all turns from the same session together";
|
|
86
|
+
readonly user_name: "Optional name of the user for personalisation (default: 'User')";
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
readonly hydra_db_list_memories: {
|
|
90
|
+
readonly title: "List Memories (deprecated)";
|
|
91
|
+
readonly description: string;
|
|
92
|
+
};
|
|
93
|
+
readonly hydra_db_list_sources: {
|
|
94
|
+
readonly title: "List Sources (deprecated)";
|
|
95
|
+
readonly description: string;
|
|
96
|
+
readonly params: {
|
|
97
|
+
readonly source_ids: "Optional array of specific source IDs to filter by. If omitted, lists all sources.";
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
readonly hydra_db_fetch_content: {
|
|
101
|
+
readonly title: "Fetch Source Content (deprecated)";
|
|
102
|
+
readonly description: string;
|
|
103
|
+
readonly params: {
|
|
104
|
+
readonly source_id: "The source ID to fetch content for";
|
|
105
|
+
readonly mode: "Fetch mode: 'content' for text, 'url' for presigned URL, 'both' for both (default: 'content')";
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
readonly hydra_db_delete_memory: {
|
|
109
|
+
readonly title: "Delete Memory (deprecated)";
|
|
110
|
+
readonly description: string;
|
|
111
|
+
readonly params: {
|
|
112
|
+
readonly memory_id: "The ID of the memory to delete";
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
export declare const SERVER_INSTRUCTIONS: string;
|