@hydradb/mcp 0.0.1 → 1.1.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/README.md +103 -52
- 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 +114 -0
- package/dist/descriptions.js +149 -58
- package/dist/descriptions.js.map +1 -0
- package/dist/hydra/client.d.ts +146 -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 +363 -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,61 +4,106 @@ 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
|
|
|
11
|
-
|
|
24
|
+
| Parameter | Type | Required | Description |
|
|
25
|
+
|-----------|------|----------|-------------|
|
|
26
|
+
| `query` | string | Yes | The search query to find relevant memories |
|
|
27
|
+
| `max_results` | number | No | Maximum number of memory chunks to return (1-50, default: 10) |
|
|
28
|
+
| `mode` | string | No | Recall mode: `fast` for quick semantic search, `thinking` for deeper personalised recall with graph traversal (default: `thinking`) |
|
|
29
|
+
| `graph_context` | boolean | No | Whether to include knowledge graph relations in results (default: true) |
|
|
12
30
|
|
|
13
|
-
|
|
31
|
+
### **hydradb_ingest**
|
|
14
32
|
|
|
15
|
-
|
|
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.
|
|
16
34
|
|
|
17
|
-
|
|
35
|
+
| Parameter | Type | Required | Description |
|
|
36
|
+
|-----------|------|----------|-------------|
|
|
37
|
+
| `text` | string | No\* | The information to store in memory |
|
|
38
|
+
| `title` | string | No | Title for the memory entry (default: `MCP Memory`) |
|
|
39
|
+
| `source_id` | string | No | Source identifier to group related memories together (e.g. session ID) |
|
|
40
|
+
| `infer` | boolean | No | Whether Hydra DB should extract insights and build knowledge graph (default: true) |
|
|
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`) |
|
|
18
44
|
|
|
19
|
-
|
|
45
|
+
\* Provide exactly one of `text` or `turns`.
|
|
20
46
|
|
|
21
|
-
|
|
47
|
+
### **hydradb_list**
|
|
22
48
|
|
|
23
|
-
|
|
49
|
+
List stored memories or ingested knowledge sources in Hydra DB.
|
|
24
50
|
|
|
25
|
-
|
|
51
|
+
| Parameter | Type | Required | Description |
|
|
52
|
+
|-----------|------|----------|-------------|
|
|
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 |
|
|
26
55
|
|
|
27
|
-
### **
|
|
56
|
+
### **hydradb_inspect**
|
|
28
57
|
|
|
29
58
|
Fetch the full content of a specific source by its source ID.
|
|
30
59
|
|
|
31
|
-
|
|
60
|
+
| Parameter | Type | Required | Description |
|
|
61
|
+
|-----------|------|----------|-------------|
|
|
62
|
+
| `source_id` | string | Yes | The source ID to fetch content for |
|
|
63
|
+
| `mode` | string | No | Fetch mode: `content` for text, `url` for presigned URL, `both` for both (default: `content`) |
|
|
64
|
+
|
|
65
|
+
### **hydradb_delete**
|
|
66
|
+
|
|
67
|
+
Delete a memory or knowledge source from Hydra DB by its ID. This action is irreversible.
|
|
32
68
|
|
|
33
|
-
|
|
69
|
+
| Parameter | Type | Required | Description |
|
|
70
|
+
|-----------|------|----------|-------------|
|
|
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`) |
|
|
34
73
|
|
|
35
74
|
## Configuration
|
|
36
75
|
|
|
37
76
|
### Get Your Credentials
|
|
38
77
|
|
|
39
78
|
1. Get your Hydra DB API Key from [Hydra DB](https://app.hydradb.com)
|
|
40
|
-
2. Get your
|
|
79
|
+
2. Get your database name from the Hydra DB dashboard
|
|
41
80
|
|
|
42
81
|
### Environment Variables
|
|
43
82
|
|
|
44
|
-
| Variable
|
|
45
|
-
|
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
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).
|
|
50
95
|
|
|
51
96
|
### Claude Desktop
|
|
52
97
|
|
|
53
98
|
```json
|
|
54
99
|
{
|
|
55
100
|
"mcpServers": {
|
|
56
|
-
|
|
101
|
+
"hydradb": {
|
|
57
102
|
"command": "npx",
|
|
58
|
-
"args": ["-y", "@
|
|
103
|
+
"args": ["-y", "@hydradb/mcp@latest"],
|
|
59
104
|
"env": {
|
|
60
|
-
"
|
|
61
|
-
"
|
|
105
|
+
"HYDRADB_API_KEY": "your-api-key",
|
|
106
|
+
"HYDRADB_DATABASE": "your-database"
|
|
62
107
|
}
|
|
63
108
|
}
|
|
64
109
|
}
|
|
@@ -75,12 +120,12 @@ List all ingested sources in Hydra DB memory.
|
|
|
75
120
|
```json
|
|
76
121
|
{
|
|
77
122
|
"mcpServers": {
|
|
78
|
-
|
|
123
|
+
"hydradb": {
|
|
79
124
|
"command": "npx",
|
|
80
|
-
"args": ["-y", "@
|
|
125
|
+
"args": ["-y", "@hydradb/mcp@latest"],
|
|
81
126
|
"env": {
|
|
82
|
-
"
|
|
83
|
-
"
|
|
127
|
+
"HYDRADB_API_KEY": "your-api-key",
|
|
128
|
+
"HYDRADB_DATABASE": "your-database"
|
|
84
129
|
}
|
|
85
130
|
}
|
|
86
131
|
}
|
|
@@ -94,13 +139,13 @@ Add to `.vscode/mcp.json`:
|
|
|
94
139
|
```json
|
|
95
140
|
{
|
|
96
141
|
"servers": {
|
|
97
|
-
|
|
142
|
+
"hydradb": {
|
|
98
143
|
"type": "stdio",
|
|
99
144
|
"command": "npx",
|
|
100
|
-
"args": ["-y", "@
|
|
145
|
+
"args": ["-y", "@hydradb/mcp@latest"],
|
|
101
146
|
"env": {
|
|
102
|
-
"
|
|
103
|
-
"
|
|
147
|
+
"HYDRADB_API_KEY": "your-api-key",
|
|
148
|
+
"HYDRADB_DATABASE": "your-database"
|
|
104
149
|
}
|
|
105
150
|
}
|
|
106
151
|
}
|
|
@@ -109,18 +154,18 @@ Add to `.vscode/mcp.json`:
|
|
|
109
154
|
|
|
110
155
|
### Custom Sub-Tenant
|
|
111
156
|
|
|
112
|
-
To partition data, set the `
|
|
157
|
+
To partition data, set the `HYDRADB_COLLECTION` environment variable:
|
|
113
158
|
|
|
114
159
|
```json
|
|
115
160
|
{
|
|
116
161
|
"mcpServers": {
|
|
117
|
-
|
|
162
|
+
"hydradb": {
|
|
118
163
|
"command": "npx",
|
|
119
|
-
"args": ["-y", "@
|
|
164
|
+
"args": ["-y", "@hydradb/mcp@latest"],
|
|
120
165
|
"env": {
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
166
|
+
"HYDRADB_API_KEY": "your-api-key",
|
|
167
|
+
"HYDRADB_DATABASE": "your-database",
|
|
168
|
+
"HYDRADB_COLLECTION": "my-project"
|
|
124
169
|
}
|
|
125
170
|
}
|
|
126
171
|
}
|
|
@@ -129,43 +174,50 @@ To partition data, set the `HYDRA_DB_SUB_TENANT_ID` environment variable:
|
|
|
129
174
|
|
|
130
175
|
## How It Works
|
|
131
176
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
- **
|
|
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.
|
|
138
187
|
|
|
139
188
|
## Development
|
|
140
189
|
|
|
141
190
|
```bash
|
|
142
|
-
npm
|
|
191
|
+
npm ci
|
|
143
192
|
npm run build
|
|
144
|
-
|
|
193
|
+
HYDRADB_API_KEY=your-key HYDRADB_DATABASE=your-database npm start
|
|
145
194
|
```
|
|
146
195
|
|
|
147
196
|
For development with auto-reload:
|
|
148
197
|
|
|
149
198
|
```bash
|
|
150
|
-
|
|
199
|
+
HYDRADB_API_KEY=your-key HYDRADB_DATABASE=your-database npm run dev
|
|
151
200
|
```
|
|
152
201
|
|
|
153
202
|
## Testing
|
|
154
203
|
|
|
155
204
|
```bash
|
|
156
|
-
# unit tests (mocked
|
|
205
|
+
# unit + conformance tests (wrapper driven against a mocked SDK transport)
|
|
157
206
|
npm test
|
|
158
207
|
|
|
159
|
-
#
|
|
160
|
-
|
|
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
|
|
161
213
|
```
|
|
162
214
|
|
|
163
215
|
## Troubleshooting
|
|
164
216
|
|
|
165
|
-
- **API Key Issues**: Ensure `
|
|
217
|
+
- **API Key Issues**: Ensure `HYDRADB_API_KEY` is set correctly
|
|
166
218
|
- **Connection Errors**: Check your internet connection and API key validity
|
|
167
219
|
- **Tool Not Found**: Make sure the package is installed and the command path is correct
|
|
168
|
-
- **Debug Logging**: Set `
|
|
220
|
+
- **Debug Logging**: Set `HYDRADB_LOG_LEVEL=DEBUG` for verbose output
|
|
169
221
|
|
|
170
222
|
## Contributing / Developer Setup
|
|
171
223
|
|
|
@@ -187,4 +239,3 @@ make check-types # Type-check without emitting
|
|
|
187
239
|
```
|
|
188
240
|
|
|
189
241
|
Run `make help` to see all available targets.
|
|
190
|
-
|
|
@@ -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,C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AM,EAAE,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE;KAC1E,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
|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AC,CAAC;QAC/B,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
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";
|
|
15
|
+
readonly max_results: "Maximum number of memory chunks to return (1-50, default: 10)";
|
|
16
|
+
readonly mode: "Recall mode: 'fast' for quick semantic search, 'thinking' for deeper personalised recall with graph traversal (default: 'thinking')";
|
|
17
|
+
readonly graph_context: "Whether to include knowledge graph relations in results (default: true)";
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
readonly hydradb_ingest: {
|
|
21
|
+
readonly title: "Ingest into Hydra DB";
|
|
22
|
+
readonly description: string;
|
|
23
|
+
readonly params: {
|
|
24
|
+
readonly text: "The information to store in memory";
|
|
25
|
+
readonly title: "Optional title for the memory entry (default: 'MCP Memory')";
|
|
26
|
+
readonly source_id: string;
|
|
27
|
+
readonly infer: "Whether Hydra DB should extract insights and build knowledge graph from this text (default: true)";
|
|
28
|
+
readonly is_markdown: "Whether the text is in markdown format (default: false)";
|
|
29
|
+
readonly turns: "Optional conversation turns to ingest instead of `text`; each has a 'user' and 'assistant' field";
|
|
30
|
+
readonly user_name: "Optional name of the user for personalisation (default: 'User')";
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
readonly hydradb_list: {
|
|
34
|
+
readonly title: "List Hydra DB Context";
|
|
35
|
+
readonly description: string;
|
|
36
|
+
readonly params: {
|
|
37
|
+
readonly kind: "Which context family to list: 'memory' or 'knowledge' (default: 'memory')";
|
|
38
|
+
readonly source_ids: "Optional array of specific source IDs to filter by. If omitted, lists all sources.";
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
readonly hydradb_inspect: {
|
|
42
|
+
readonly title: "Inspect Hydra DB Source";
|
|
43
|
+
readonly description: string;
|
|
44
|
+
readonly params: {
|
|
45
|
+
readonly source_id: "The source ID to fetch content for";
|
|
46
|
+
readonly mode: "Fetch mode: 'content' for text, 'url' for presigned URL, 'both' for both (default: 'content')";
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
readonly hydradb_delete: {
|
|
50
|
+
readonly title: "Delete from Hydra DB";
|
|
51
|
+
readonly description: string;
|
|
52
|
+
readonly params: {
|
|
53
|
+
readonly id: "The ID of the item to delete";
|
|
54
|
+
readonly kind: "Which context family the ID belongs to: 'memory' or 'knowledge' (default: 'memory')";
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
readonly hydra_db_search: {
|
|
58
|
+
readonly title: "Search Hydra DB Memory (deprecated)";
|
|
59
|
+
readonly description: string;
|
|
60
|
+
readonly params: {
|
|
61
|
+
readonly query: "The search query to find relevant memories";
|
|
62
|
+
readonly max_results: "Maximum number of memory chunks to return (1-50, default: 10)";
|
|
63
|
+
readonly mode: "Recall mode: 'fast' for quick semantic search, 'thinking' for deeper personalised recall with graph traversal (default: 'thinking')";
|
|
64
|
+
readonly graph_context: "Whether to include knowledge graph relations in results (default: true)";
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
readonly hydra_db_store: {
|
|
68
|
+
readonly title: "Store to Hydra DB Memory (deprecated)";
|
|
69
|
+
readonly description: string;
|
|
70
|
+
readonly params: {
|
|
71
|
+
readonly text: "The information to store in memory";
|
|
72
|
+
readonly title: "Optional title for the memory entry (default: 'MCP Memory')";
|
|
73
|
+
readonly source_id: string;
|
|
74
|
+
readonly infer: "Whether Hydra DB should extract insights and build knowledge graph from this text (default: true)";
|
|
75
|
+
readonly is_markdown: "Whether the text is in markdown format (default: false)";
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
readonly hydra_db_ingest_conversation: {
|
|
79
|
+
readonly title: "Ingest Conversation (deprecated)";
|
|
80
|
+
readonly description: string;
|
|
81
|
+
readonly params: {
|
|
82
|
+
readonly turns: "Array of conversation turns, each with a 'user' and 'assistant' field";
|
|
83
|
+
readonly source_id: "Source identifier to group all turns from the same session together";
|
|
84
|
+
readonly user_name: "Optional name of the user for personalisation (default: 'User')";
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
readonly hydra_db_list_memories: {
|
|
88
|
+
readonly title: "List Memories (deprecated)";
|
|
89
|
+
readonly description: string;
|
|
90
|
+
};
|
|
91
|
+
readonly hydra_db_list_sources: {
|
|
92
|
+
readonly title: "List Sources (deprecated)";
|
|
93
|
+
readonly description: string;
|
|
94
|
+
readonly params: {
|
|
95
|
+
readonly source_ids: "Optional array of specific source IDs to filter by. If omitted, lists all sources.";
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
readonly hydra_db_fetch_content: {
|
|
99
|
+
readonly title: "Fetch Source Content (deprecated)";
|
|
100
|
+
readonly description: string;
|
|
101
|
+
readonly params: {
|
|
102
|
+
readonly source_id: "The source ID to fetch content for";
|
|
103
|
+
readonly mode: "Fetch mode: 'content' for text, 'url' for presigned URL, 'both' for both (default: 'content')";
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
readonly hydra_db_delete_memory: {
|
|
107
|
+
readonly title: "Delete Memory (deprecated)";
|
|
108
|
+
readonly description: string;
|
|
109
|
+
readonly params: {
|
|
110
|
+
readonly memory_id: "The ID of the memory to delete";
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
export declare const SERVER_INSTRUCTIONS: string;
|