@hydradb/mcp 1.2.0 → 1.2.2
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/CHANGELOG.md +158 -0
- package/README.md +172 -2
- package/dist/config.d.ts +40 -0
- package/dist/config.js +40 -3
- package/dist/config.js.map +1 -1
- package/dist/cypher.d.ts +51 -0
- package/dist/cypher.js +145 -0
- package/dist/cypher.js.map +1 -0
- package/dist/descriptions.d.ts +55 -0
- package/dist/descriptions.js +170 -13
- package/dist/descriptions.js.map +1 -1
- package/dist/http-config.d.ts +160 -0
- package/dist/http-config.js +253 -0
- package/dist/http-config.js.map +1 -0
- package/dist/http.d.ts +31 -0
- package/dist/http.js +350 -0
- package/dist/http.js.map +1 -0
- package/dist/hydra/client.d.ts +36 -2
- package/dist/hydra/client.js +46 -14
- package/dist/hydra/client.js.map +1 -1
- package/dist/hydra/errors.d.ts +14 -0
- package/dist/hydra/errors.js +16 -0
- package/dist/hydra/errors.js.map +1 -1
- package/dist/hydra/graph.d.ts +82 -0
- package/dist/hydra/graph.js +217 -0
- package/dist/hydra/graph.js.map +1 -0
- package/dist/hydra/index.d.ts +3 -1
- package/dist/hydra/index.js +2 -1
- package/dist/hydra/index.js.map +1 -1
- package/dist/server.d.ts +7 -1
- package/dist/server.js +387 -12
- package/dist/server.js.map +1 -1
- package/dist/tool-names.d.ts +5 -0
- package/dist/tool-names.js +15 -0
- package/dist/tool-names.js.map +1 -1
- package/package.json +10 -2
package/dist/http.js
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* The remotely hostable HTTP transport.
|
|
4
|
+
*
|
|
5
|
+
* This is the server behind a URL like `https://mcp.hydradb.com/mcp`: instead of
|
|
6
|
+
* every user installing and spawning the stdio binary ({@link file://./index.ts}),
|
|
7
|
+
* one process answers MCP over HTTP and each user points their client at the URL.
|
|
8
|
+
*
|
|
9
|
+
* It reuses the whole tool surface unchanged — {@link createHydraDBServer} builds
|
|
10
|
+
* exactly the same server the stdio path does. The only things this file adds are
|
|
11
|
+
* the ones a network endpoint needs and a pipe does not: a Host/Origin
|
|
12
|
+
* allowlist, CORS, and PER-REQUEST tenant credentials (see
|
|
13
|
+
* {@link file://./http-config.ts}), because one hosted process has no single
|
|
14
|
+
* ambient account to run as.
|
|
15
|
+
*
|
|
16
|
+
* Sessions are stateless: MCP's Protocol object binds to one transport, so a
|
|
17
|
+
* shared process serving many independent callers builds a fresh server +
|
|
18
|
+
* transport per request and tears it down when the response closes. That is the
|
|
19
|
+
* transport's documented stateless mode (`sessionIdGenerator: undefined`).
|
|
20
|
+
*/
|
|
21
|
+
import cors from "cors";
|
|
22
|
+
import express from "express";
|
|
23
|
+
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
24
|
+
import { HydraDB } from "./hydra/index.js";
|
|
25
|
+
import { buildAllowedHosts, jsonRpcError, parseList, parsePort, resolveHttpServerConfig, resolveRequestCredentials, } from "./http-config.js";
|
|
26
|
+
import { logger } from "./logger.js";
|
|
27
|
+
import { awaitInFlight, beginShutdown, createHydraDBServer, inFlightCount, } from "./server.js";
|
|
28
|
+
/**
|
|
29
|
+
* The largest request body accepted before parsing.
|
|
30
|
+
*
|
|
31
|
+
* Sized above the tool layer's own ceilings — memory ingest caps `text` at 1M
|
|
32
|
+
* characters (~4 MB as UTF-8 with a JSON envelope), which is the biggest
|
|
33
|
+
* legitimate body — so a valid large ingest is not rejected at the door while an
|
|
34
|
+
* unbounded body cannot exhaust memory. Anything genuinely oversized is still
|
|
35
|
+
* refused by the per-tool checks with a message naming the real limit.
|
|
36
|
+
*/
|
|
37
|
+
const MAX_REQUEST_BODY = "8mb";
|
|
38
|
+
/**
|
|
39
|
+
* Startup banners and security warnings go straight to stderr, not through
|
|
40
|
+
* `logger`.
|
|
41
|
+
*
|
|
42
|
+
* `logger` is gated by `HYDRADB_LOG_LEVEL`, which defaults to ERROR, so a
|
|
43
|
+
* `logger.warn` about a public bind would be invisible in the exact default
|
|
44
|
+
* configuration where it matters most. These lines must surface regardless of
|
|
45
|
+
* level — the same reason the deprecated-alias warnings bypass the logger — so
|
|
46
|
+
* they use `console.error` (stderr) directly. Per-request and lifecycle logging
|
|
47
|
+
* still goes through `logger`.
|
|
48
|
+
*/
|
|
49
|
+
function banner(message) {
|
|
50
|
+
console.error(`[hydradb-mcp] ${message}`);
|
|
51
|
+
}
|
|
52
|
+
/** JSON-RPC error codes used for transport-level failures (spec: -32000 range). */
|
|
53
|
+
const JSONRPC_UNAUTHORIZED = -32001;
|
|
54
|
+
const JSONRPC_BAD_REQUEST = -32602;
|
|
55
|
+
const JSONRPC_INTERNAL_ERROR = -32603;
|
|
56
|
+
const JSONRPC_MISDIRECTED = -32000;
|
|
57
|
+
/**
|
|
58
|
+
* Build the Express app for the HTTP transport.
|
|
59
|
+
*
|
|
60
|
+
* Exported (and taking its config as an argument rather than reading the
|
|
61
|
+
* environment) so tests exercise the exact wiring production runs, against an
|
|
62
|
+
* arbitrary allowlist, with no process-global state.
|
|
63
|
+
*/
|
|
64
|
+
export function createHttpApp(config) {
|
|
65
|
+
const { bindAddress, allowedOrigins, allowedHosts } = config;
|
|
66
|
+
const allowsAllOrigins = allowedOrigins.includes("*");
|
|
67
|
+
const app = express();
|
|
68
|
+
// Off by default so a direct client cannot spoof `X-Forwarded-*`; a
|
|
69
|
+
// deployment behind a known proxy sets TRUST_PROXY to recover the real client
|
|
70
|
+
// IP without trusting every hop. Only logging and `req.protocol` read it — the
|
|
71
|
+
// Host allowlist, not a proxy header, is the DNS-rebinding defence.
|
|
72
|
+
app.set("trust proxy", config.trustProxy);
|
|
73
|
+
// The Host allowlist is the actual defence; the fingerprinting header is noise.
|
|
74
|
+
app.disable("x-powered-by");
|
|
75
|
+
// --- Host header allowlist (runs first, before CORS) ---
|
|
76
|
+
//
|
|
77
|
+
// A DNS-rebinding defence: without it, a page the user visits can point a
|
|
78
|
+
// hostname it controls at 127.0.0.1 and drive a locally bound server. The
|
|
79
|
+
// check is the operator's ALLOWED_HOSTS plus loopback; a hosted deployment
|
|
80
|
+
// adds its public hostname. 421 Misdirected Request is the status for "this
|
|
81
|
+
// server does not answer to that authority".
|
|
82
|
+
app.use((req, res, next) => {
|
|
83
|
+
const host = req.headers.host;
|
|
84
|
+
if (!host || !allowedHosts.has(host.toLowerCase())) {
|
|
85
|
+
logger.warn("rejected request with disallowed Host header", {
|
|
86
|
+
host,
|
|
87
|
+
path: req.path,
|
|
88
|
+
});
|
|
89
|
+
res
|
|
90
|
+
.status(421)
|
|
91
|
+
.json(jsonRpcError(JSONRPC_MISDIRECTED, "Misdirected request"));
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
next();
|
|
95
|
+
});
|
|
96
|
+
// --- CORS ---
|
|
97
|
+
//
|
|
98
|
+
// A distinct error type so the error handler below can tell an origin
|
|
99
|
+
// rejection apart from any other downstream failure and answer it with 403.
|
|
100
|
+
class CorsOriginNotAllowedError extends Error {
|
|
101
|
+
constructor(origin) {
|
|
102
|
+
super(`Origin ${origin} not allowed by CORS`);
|
|
103
|
+
this.origin = origin;
|
|
104
|
+
this.name = "CorsOriginNotAllowedError";
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
app.use(cors({
|
|
108
|
+
origin: (origin, callback) => {
|
|
109
|
+
// No Origin header: a non-browser client or a same-origin request.
|
|
110
|
+
// These are not subject to CORS and are allowed through.
|
|
111
|
+
if (!origin)
|
|
112
|
+
return callback(null, true);
|
|
113
|
+
// The opaque `null` origin (sandboxed iframe, file://) is only
|
|
114
|
+
// honoured when the operator lists it explicitly.
|
|
115
|
+
if (origin === "null") {
|
|
116
|
+
return allowedOrigins.includes("null")
|
|
117
|
+
? callback(null, true)
|
|
118
|
+
: callback(new CorsOriginNotAllowedError("null"));
|
|
119
|
+
}
|
|
120
|
+
if (allowsAllOrigins || allowedOrigins.includes(origin)) {
|
|
121
|
+
return callback(null, true);
|
|
122
|
+
}
|
|
123
|
+
return callback(new CorsOriginNotAllowedError(origin));
|
|
124
|
+
},
|
|
125
|
+
// The client reads the session id and negotiated protocol version off
|
|
126
|
+
// the response; without exposing them a browser cannot complete a session.
|
|
127
|
+
exposedHeaders: ["Mcp-Session-Id", "Mcp-Protocol-Version"],
|
|
128
|
+
allowedHeaders: [
|
|
129
|
+
"Content-Type",
|
|
130
|
+
"Authorization",
|
|
131
|
+
"Mcp-Session-Id",
|
|
132
|
+
"Mcp-Protocol-Version",
|
|
133
|
+
"X-HydraDB-Api-Key",
|
|
134
|
+
"X-HydraDB-Database",
|
|
135
|
+
"X-HydraDB-Collection",
|
|
136
|
+
"X-HydraDB-Graph-Database",
|
|
137
|
+
"X-HydraDB-Graph-Collection",
|
|
138
|
+
],
|
|
139
|
+
}));
|
|
140
|
+
// Turn a CORS origin rejection into an explicit 403 with a JSON-RPC body,
|
|
141
|
+
// mirroring the 421 the Host check emits. Placed right after cors so any
|
|
142
|
+
// other error still reaches Express's default handler unchanged.
|
|
143
|
+
app.use((err, req, res, next) => {
|
|
144
|
+
if (err instanceof CorsOriginNotAllowedError) {
|
|
145
|
+
logger.warn("rejected request with disallowed Origin", {
|
|
146
|
+
origin: err.origin,
|
|
147
|
+
path: req.path,
|
|
148
|
+
});
|
|
149
|
+
res
|
|
150
|
+
.status(403)
|
|
151
|
+
.json(jsonRpcError(JSONRPC_MISDIRECTED, "Origin not allowed"));
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
next(err);
|
|
155
|
+
});
|
|
156
|
+
app.use(express.json({ limit: MAX_REQUEST_BODY }));
|
|
157
|
+
// --- The MCP endpoint ---
|
|
158
|
+
// Serves MCP at both the root `/` (e.g. https://mcp.hydradb.com) and `/mcp`
|
|
159
|
+
// so clients pointing at either URL connect seamlessly.
|
|
160
|
+
app.all(["/", "/mcp"], async (req, res) => {
|
|
161
|
+
// Who is this request for? On a hosted process the answer lives entirely
|
|
162
|
+
// in the request, so it is resolved here and a missing/incomplete answer
|
|
163
|
+
// is refused before any server is built.
|
|
164
|
+
const resolution = resolveRequestCredentials(req.headers, process.env);
|
|
165
|
+
if (!resolution.ok) {
|
|
166
|
+
// 401 gets a WWW-Authenticate header so a spec-compliant client knows
|
|
167
|
+
// how to authenticate rather than just seeing a bare refusal.
|
|
168
|
+
if (resolution.status === 401) {
|
|
169
|
+
res.setHeader("WWW-Authenticate", 'Bearer realm="Hydra DB MCP"');
|
|
170
|
+
}
|
|
171
|
+
res
|
|
172
|
+
.status(resolution.status)
|
|
173
|
+
.json(jsonRpcError(resolution.status === 401
|
|
174
|
+
? JSONRPC_UNAUTHORIZED
|
|
175
|
+
: JSONRPC_BAD_REQUEST, resolution.message));
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const creds = resolution.credentials;
|
|
179
|
+
try {
|
|
180
|
+
const hydra = new HydraDB({
|
|
181
|
+
token: creds.apiKey,
|
|
182
|
+
database: creds.database,
|
|
183
|
+
collection: creds.collection,
|
|
184
|
+
...(creds.baseUrl != null ? { baseUrl: creds.baseUrl } : {}),
|
|
185
|
+
...(creds.timeoutSeconds != null
|
|
186
|
+
? { timeoutSeconds: creds.timeoutSeconds }
|
|
187
|
+
: {}),
|
|
188
|
+
...(creds.maxRetries != null ? { maxRetries: creds.maxRetries } : {}),
|
|
189
|
+
});
|
|
190
|
+
const server = createHydraDBServer(hydra, creds.graph);
|
|
191
|
+
// Stateless: this pair serves exactly this request and is discarded when
|
|
192
|
+
// the response closes. Tearing them down on `close` — which fires for a
|
|
193
|
+
// clean end AND for the error path below (it sends a response, which then
|
|
194
|
+
// closes) — is what frees the per-request state; without it a long-lived
|
|
195
|
+
// process leaks a server per call. It is the single teardown point, so
|
|
196
|
+
// nothing here double-closes. `close()` returns a promise, and a stray
|
|
197
|
+
// rejection would take the whole process down via `unhandledRejection`, so
|
|
198
|
+
// it is explicitly swallowed.
|
|
199
|
+
const transport = new StreamableHTTPServerTransport({
|
|
200
|
+
sessionIdGenerator: undefined,
|
|
201
|
+
enableJsonResponse: true,
|
|
202
|
+
});
|
|
203
|
+
res.on("close", () => {
|
|
204
|
+
transport.close().catch(() => { });
|
|
205
|
+
server.close().catch(() => { });
|
|
206
|
+
});
|
|
207
|
+
await server.connect(transport);
|
|
208
|
+
await transport.handleRequest(req, res, req.body);
|
|
209
|
+
}
|
|
210
|
+
catch (error) {
|
|
211
|
+
logger.error("error handling MCP request", {
|
|
212
|
+
error: error instanceof Error ? error.message : String(error),
|
|
213
|
+
});
|
|
214
|
+
// Do not close here: the `res.on("close")` handler above owns teardown,
|
|
215
|
+
// and the transport may still be mid-write. Only the transport writes the
|
|
216
|
+
// JSON-RPC body, so this responds solely when nothing has been sent yet
|
|
217
|
+
// AND the socket is still open — a client that aborted mid-request lands
|
|
218
|
+
// here too, and writing to its closed socket is pointless. Ending the
|
|
219
|
+
// response then triggers that one teardown.
|
|
220
|
+
if (!res.headersSent && !res.writableEnded) {
|
|
221
|
+
res
|
|
222
|
+
.status(500)
|
|
223
|
+
.json(jsonRpcError(JSONRPC_INTERNAL_ERROR, "Internal server error"));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
// A liveness probe for load balancers and container orchestrators. It says
|
|
228
|
+
// nothing about Hydra DB reachability on purpose — credentials are per
|
|
229
|
+
// request, so there is no single upstream this endpoint could check.
|
|
230
|
+
app.get("/health", (_req, res) => {
|
|
231
|
+
res.json({ status: "ok", service: "hydradb-mcp" });
|
|
232
|
+
});
|
|
233
|
+
// `express.json` throws on a malformed body (`entity.parse.failed`) or one
|
|
234
|
+
// over the limit (`entity.too.large`). Registered after the routes so it
|
|
235
|
+
// catches those, it keeps every refusal on this server speaking JSON-RPC
|
|
236
|
+
// rather than letting Express answer with its default HTML error page. Any
|
|
237
|
+
// other error falls through to Express's default handler unchanged.
|
|
238
|
+
app.use((err, _req, res, next) => {
|
|
239
|
+
if (err.type === "entity.parse.failed") {
|
|
240
|
+
res
|
|
241
|
+
.status(400)
|
|
242
|
+
.json(jsonRpcError(JSONRPC_BAD_REQUEST, "Request body is not valid JSON"));
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (err.type === "entity.too.large") {
|
|
246
|
+
res
|
|
247
|
+
.status(413)
|
|
248
|
+
.json(jsonRpcError(JSONRPC_BAD_REQUEST, `Request body exceeds the ${MAX_REQUEST_BODY} limit`));
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
next(err);
|
|
252
|
+
});
|
|
253
|
+
if (bindAddress === "0.0.0.0" || bindAddress === "::") {
|
|
254
|
+
banner(`WARNING: BIND_ADDRESS=${bindAddress} exposes the server on all network interfaces — ` +
|
|
255
|
+
"set ALLOWED_HOSTS/ALLOWED_ORIGINS and put it behind TLS. See SECURITY.md.");
|
|
256
|
+
}
|
|
257
|
+
if (allowsAllOrigins) {
|
|
258
|
+
banner('WARNING: ALLOWED_ORIGINS contains "*" — any website may call this server. See SECURITY.md.');
|
|
259
|
+
}
|
|
260
|
+
return app;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Wire graceful shutdown for the HTTP server.
|
|
264
|
+
*
|
|
265
|
+
* The in-flight bookkeeping is shared with the stdio path (it is module state in
|
|
266
|
+
* {@link file://./server.js}), so this drains accepted tool calls the same way:
|
|
267
|
+
* stop accepting, close the listener, wait for running handlers, then exit. An
|
|
268
|
+
* ingest cut off mid-write leaves the caller unable to tell whether it
|
|
269
|
+
* committed, which under upsert is not answerable by retrying.
|
|
270
|
+
*/
|
|
271
|
+
const SHUTDOWN_GRACE_MS = 10000;
|
|
272
|
+
function installLifecycle(httpServer) {
|
|
273
|
+
let shuttingDown = false;
|
|
274
|
+
const shutdown = async (signal) => {
|
|
275
|
+
if (shuttingDown) {
|
|
276
|
+
logger.warn(`${signal} received again — exiting immediately`);
|
|
277
|
+
process.exit(130);
|
|
278
|
+
}
|
|
279
|
+
shuttingDown = true;
|
|
280
|
+
beginShutdown();
|
|
281
|
+
logger.info(`${signal} received — shutting down`);
|
|
282
|
+
const timer = setTimeout(() => {
|
|
283
|
+
logger.warn(`in-flight work did not finish within ${SHUTDOWN_GRACE_MS}ms — exiting anyway`);
|
|
284
|
+
process.exit(0);
|
|
285
|
+
}, SHUTDOWN_GRACE_MS);
|
|
286
|
+
timer.unref();
|
|
287
|
+
// Stop accepting new connections, then drain the calls already running.
|
|
288
|
+
httpServer.close();
|
|
289
|
+
const pending = inFlightCount();
|
|
290
|
+
if (pending > 0) {
|
|
291
|
+
logger.info(`waiting for ${pending} in-flight tool call(s)`);
|
|
292
|
+
await awaitInFlight();
|
|
293
|
+
}
|
|
294
|
+
clearTimeout(timer);
|
|
295
|
+
process.exit(0);
|
|
296
|
+
};
|
|
297
|
+
process.on("SIGINT", () => void shutdown("SIGINT"));
|
|
298
|
+
process.on("SIGTERM", () => void shutdown("SIGTERM"));
|
|
299
|
+
process.on("unhandledRejection", (reason) => {
|
|
300
|
+
logger.error("unhandled promise rejection", {
|
|
301
|
+
error: reason instanceof Error ? (reason.stack ?? reason.message) : String(reason),
|
|
302
|
+
});
|
|
303
|
+
process.exit(1);
|
|
304
|
+
});
|
|
305
|
+
process.on("uncaughtException", (error) => {
|
|
306
|
+
logger.error("uncaught exception", { error: error.stack ?? error.message });
|
|
307
|
+
process.exit(1);
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
function main() {
|
|
311
|
+
const config = resolveHttpServerConfig();
|
|
312
|
+
// A public bind WITH tenant credentials in the env is the one genuinely
|
|
313
|
+
// dangerous combination: every unauthenticated request would run under that
|
|
314
|
+
// account. It is legitimate for a single-tenant self-host, so this warns
|
|
315
|
+
// rather than refuses — but a multi-tenant operator must see it.
|
|
316
|
+
const publicBind = config.bindAddress === "0.0.0.0" || config.bindAddress === "::";
|
|
317
|
+
if (publicBind && (process.env.HYDRADB_API_KEY || process.env.HYDRA_DB_API_KEY)) {
|
|
318
|
+
banner("WARNING: HYDRADB_API_KEY is set while binding publicly — every request that " +
|
|
319
|
+
"sends no `Authorization` header will run under this account. Unset it for a " +
|
|
320
|
+
"multi-tenant deployment so each caller must authenticate. See SECURITY.md.");
|
|
321
|
+
}
|
|
322
|
+
const app = createHttpApp(config);
|
|
323
|
+
const httpServer = app
|
|
324
|
+
.listen(config.port, config.bindAddress, () => {
|
|
325
|
+
// Startup banners: on stderr so an operator sees where it bound
|
|
326
|
+
// regardless of HYDRADB_LOG_LEVEL.
|
|
327
|
+
banner(`listening on http://${config.bindAddress}:${config.port}`);
|
|
328
|
+
banner(`allowed origins: ${config.allowedOrigins.length > 0
|
|
329
|
+
? config.allowedOrigins.join(", ")
|
|
330
|
+
: "(none — cross-origin browser requests will be rejected)"}`);
|
|
331
|
+
})
|
|
332
|
+
.on("error", (error) => {
|
|
333
|
+
logger.error("HTTP server error", { error: error.message });
|
|
334
|
+
process.exit(1);
|
|
335
|
+
});
|
|
336
|
+
installLifecycle(httpServer);
|
|
337
|
+
}
|
|
338
|
+
// Only auto-start when run as a script, so tests can import `createHttpApp`
|
|
339
|
+
// without binding a port. Covers `node dist/http.js`, `tsx src/http.ts`, and
|
|
340
|
+
// the Docker entrypoint.
|
|
341
|
+
const invokedAsScript = import.meta.url === `file://${process.argv[1]}` ||
|
|
342
|
+
process.argv[1]?.endsWith("/http.js") ||
|
|
343
|
+
process.argv[1]?.endsWith("/http.ts");
|
|
344
|
+
if (invokedAsScript) {
|
|
345
|
+
main();
|
|
346
|
+
}
|
|
347
|
+
// Re-exported so callers importing the HTTP entry point get the config helpers
|
|
348
|
+
// from one place.
|
|
349
|
+
export { buildAllowedHosts, parseList, parsePort, resolveHttpServerConfig };
|
|
350
|
+
//# sourceMappingURL=http.js.map
|
package/dist/http.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,OAAyB,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radb/sdk";
|
|
18
|
+
import { GraphResource } from "./graph.js";
|
|
18
19
|
export type ContextKind = "memory" | "knowledge";
|
|
19
20
|
/**
|
|
20
21
|
* Sized to fit inside a typical MCP host's tool timeout rather than outlast it,
|
|
@@ -62,7 +63,16 @@ export interface HydraConfig {
|
|
|
62
63
|
export interface QueryParams {
|
|
63
64
|
query: string;
|
|
64
65
|
kind?: QueryKind;
|
|
66
|
+
/**
|
|
67
|
+
* How the terms in `query` are combined. Keyword semantics, so it is only
|
|
68
|
+
* meaningful — and only accepted — under `queryBy: "text"`; see `query`.
|
|
69
|
+
*/
|
|
65
70
|
operator?: "or" | "and" | "phrase";
|
|
71
|
+
/**
|
|
72
|
+
* Retrieval method. `hybrid` (what the API uses when this is omitted) runs
|
|
73
|
+
* dense and sparse retrieval together; `text` is keyword matching only.
|
|
74
|
+
*/
|
|
75
|
+
queryBy?: "hybrid" | "text";
|
|
66
76
|
maxResults?: number;
|
|
67
77
|
mode?: "fast" | "thinking" | "auto";
|
|
68
78
|
graphContext?: boolean;
|
|
@@ -79,6 +89,8 @@ export interface QueryParams {
|
|
|
79
89
|
numRelatedChunks?: number;
|
|
80
90
|
/** Per-call collection override. */
|
|
81
91
|
collection?: string;
|
|
92
|
+
/** Per-call database override. */
|
|
93
|
+
database?: string;
|
|
82
94
|
}
|
|
83
95
|
export interface ConversationTurn {
|
|
84
96
|
user: string;
|
|
@@ -114,6 +126,8 @@ export interface IngestParams {
|
|
|
114
126
|
/** Filename to attach when ingesting knowledge text as a document. */
|
|
115
127
|
filename?: string;
|
|
116
128
|
collection?: string;
|
|
129
|
+
/** Per-call database override. */
|
|
130
|
+
database?: string;
|
|
117
131
|
}
|
|
118
132
|
export interface ListParams {
|
|
119
133
|
kind?: ContextKind;
|
|
@@ -121,16 +135,22 @@ export interface ListParams {
|
|
|
121
135
|
page?: number;
|
|
122
136
|
pageSize?: number;
|
|
123
137
|
collection?: string;
|
|
138
|
+
/** Per-call database override. */
|
|
139
|
+
database?: string;
|
|
124
140
|
}
|
|
125
141
|
export interface InspectParams {
|
|
126
142
|
id: string;
|
|
127
143
|
mode?: string;
|
|
128
144
|
expirySeconds?: number;
|
|
129
145
|
collection?: string;
|
|
146
|
+
/** Per-call database override. */
|
|
147
|
+
database?: string;
|
|
130
148
|
}
|
|
131
149
|
export interface IngestionStatusParams {
|
|
132
150
|
ids: string | string[];
|
|
133
151
|
collection?: string;
|
|
152
|
+
/** Per-call database override. */
|
|
153
|
+
database?: string;
|
|
134
154
|
}
|
|
135
155
|
export interface RelationsParams {
|
|
136
156
|
id?: string;
|
|
@@ -138,11 +158,15 @@ export interface RelationsParams {
|
|
|
138
158
|
limit?: number;
|
|
139
159
|
cursor?: number;
|
|
140
160
|
collection?: string;
|
|
161
|
+
/** Per-call database override. */
|
|
162
|
+
database?: string;
|
|
141
163
|
}
|
|
142
164
|
export interface DeleteParams {
|
|
143
165
|
ids: string[];
|
|
144
166
|
kind: ContextKind;
|
|
145
167
|
collection?: string;
|
|
168
|
+
/** Per-call database override. */
|
|
169
|
+
database?: string;
|
|
146
170
|
}
|
|
147
171
|
export interface CreateDatabaseParams {
|
|
148
172
|
database: string;
|
|
@@ -158,12 +182,17 @@ declare abstract class Resource {
|
|
|
158
182
|
private readonly database;
|
|
159
183
|
private readonly collection?;
|
|
160
184
|
protected constructor(sdk: HydraDBClient, database: string, collection?: string | undefined);
|
|
161
|
-
protected scope(override?: string): ScopeFields;
|
|
185
|
+
protected scope(override?: string, dbOverride?: string): ScopeFields;
|
|
162
186
|
protected call<T>(path: string, fn: () => Promise<unknown>): Promise<T>;
|
|
163
187
|
}
|
|
164
188
|
export declare class ContextResource extends Resource {
|
|
165
189
|
constructor(sdk: HydraDBClient, database: string, collection?: string);
|
|
166
|
-
/**
|
|
190
|
+
/**
|
|
191
|
+
* The single retrieval entry point (SDK `client.query`).
|
|
192
|
+
*
|
|
193
|
+
* `async` so the operator/retrieval validation below surfaces as a rejection,
|
|
194
|
+
* for the same reason `ingest` is async.
|
|
195
|
+
*/
|
|
167
196
|
query(params: QueryParams, opts?: RequestOptions): Promise<SDK.SearchV2RetrievalResult>;
|
|
168
197
|
/**
|
|
169
198
|
* Ingest a memory or knowledge item (SDK `context.ingest`, multipart).
|
|
@@ -202,6 +231,11 @@ export declare class DatabasesResource extends Resource {
|
|
|
202
231
|
export declare class HydraDB {
|
|
203
232
|
readonly context: ContextResource;
|
|
204
233
|
readonly databases: DatabasesResource;
|
|
234
|
+
/**
|
|
235
|
+
* BYOG graph operations. Not backed by the SDK — see ./graph.ts for why —
|
|
236
|
+
* but exposed here so callers reach every HydraDB surface through one object.
|
|
237
|
+
*/
|
|
238
|
+
readonly graph: GraphResource;
|
|
205
239
|
constructor(config: HydraConfig, sdk?: HydraDBClient);
|
|
206
240
|
}
|
|
207
241
|
export {};
|
package/dist/hydra/client.js
CHANGED
|
@@ -17,6 +17,7 @@ import { Buffer } from "node:buffer";
|
|
|
17
17
|
import { HydraDBClient } from "@hydradb/sdk";
|
|
18
18
|
import { unwrap } from "./envelope.js";
|
|
19
19
|
import { translateError } from "./errors.js";
|
|
20
|
+
import { GraphResource } from "./graph.js";
|
|
20
21
|
/**
|
|
21
22
|
* Sized to fit inside a typical MCP host's tool timeout rather than outlast it,
|
|
22
23
|
* so a stalled call fails with a HydraDB diagnostic the caller can act on
|
|
@@ -52,11 +53,12 @@ class Resource {
|
|
|
52
53
|
this.database = database;
|
|
53
54
|
this.collection = collection;
|
|
54
55
|
}
|
|
55
|
-
scope(override) {
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
scope(override, dbOverride) {
|
|
57
|
+
const database = dbOverride?.trim() || this.database;
|
|
58
|
+
const collection = override?.trim() || this.collection;
|
|
59
|
+
return collection != null && collection !== ""
|
|
60
|
+
? { database, collection }
|
|
61
|
+
: { database };
|
|
60
62
|
}
|
|
61
63
|
async call(path, fn) {
|
|
62
64
|
try {
|
|
@@ -74,13 +76,37 @@ export class ContextResource extends Resource {
|
|
|
74
76
|
constructor(sdk, database, collection) {
|
|
75
77
|
super(sdk, database, collection);
|
|
76
78
|
}
|
|
77
|
-
/**
|
|
78
|
-
|
|
79
|
+
/**
|
|
80
|
+
* The single retrieval entry point (SDK `client.query`).
|
|
81
|
+
*
|
|
82
|
+
* `async` so the operator/retrieval validation below surfaces as a rejection,
|
|
83
|
+
* for the same reason `ingest` is async.
|
|
84
|
+
*/
|
|
85
|
+
async query(params, opts) {
|
|
86
|
+
// `operator` is keyword syntax, and the API accepts it only when the
|
|
87
|
+
// request also asks for keyword retrieval. On hybrid it does not ignore
|
|
88
|
+
// the field, it refuses the whole call:
|
|
89
|
+
// Hydra DB /query → 400: INVALID_INPUT: operator is only valid with query_by=text
|
|
90
|
+
// This wrapper forwarded `operator` and never sent `query_by`, so EVERY
|
|
91
|
+
// call that set it 400'd — the parameter could not succeed under any
|
|
92
|
+
// input. An operator therefore carries its retrieval method with it.
|
|
93
|
+
//
|
|
94
|
+
// A caller that states `queryBy` is never overridden: `hybrid` with an
|
|
95
|
+
// operator is a contradiction only they can resolve, so it is rejected
|
|
96
|
+
// here rather than sent to fail on the wire (the same stance the
|
|
97
|
+
// knowledge-ingest path takes toward params it cannot honour).
|
|
98
|
+
if (params.operator != null && params.queryBy === "hybrid") {
|
|
99
|
+
throw new Error(`operator "${params.operator}" is only valid with queryBy "text" — ` +
|
|
100
|
+
`hybrid retrieval rejects the request outright. Drop operator to keep ` +
|
|
101
|
+
`hybrid retrieval, or pass queryBy "text" to match on the terms.`);
|
|
102
|
+
}
|
|
103
|
+
const queryBy = params.queryBy ?? (params.operator != null ? "text" : undefined);
|
|
79
104
|
return this.call("/query", () => this.sdk.query({
|
|
80
|
-
...this.scope(params.collection),
|
|
105
|
+
...this.scope(params.collection, params.database),
|
|
81
106
|
query: params.query,
|
|
82
107
|
type: params.kind,
|
|
83
108
|
operator: params.operator,
|
|
109
|
+
queryBy,
|
|
84
110
|
maxResults: params.maxResults,
|
|
85
111
|
mode: params.mode,
|
|
86
112
|
graphContext: params.graphContext,
|
|
@@ -100,7 +126,7 @@ export class ContextResource extends Resource {
|
|
|
100
126
|
*/
|
|
101
127
|
async ingest(params, opts) {
|
|
102
128
|
const request = {
|
|
103
|
-
...this.scope(params.collection),
|
|
129
|
+
...this.scope(params.collection, params.database),
|
|
104
130
|
type: params.kind,
|
|
105
131
|
};
|
|
106
132
|
if (params.upsert != null) {
|
|
@@ -178,7 +204,7 @@ export class ContextResource extends Resource {
|
|
|
178
204
|
/** List memories or knowledge sources (SDK `context.list`). */
|
|
179
205
|
list(params = {}, opts) {
|
|
180
206
|
return this.call("/context/list", () => this.sdk.context.list({
|
|
181
|
-
...this.scope(params.collection),
|
|
207
|
+
...this.scope(params.collection, params.database),
|
|
182
208
|
type: params.kind,
|
|
183
209
|
ids: params.ids,
|
|
184
210
|
page: params.page,
|
|
@@ -188,7 +214,7 @@ export class ContextResource extends Resource {
|
|
|
188
214
|
/** Fetch a source's content (SDK `context.inspect`; was "fetch content"). */
|
|
189
215
|
inspect(params, opts) {
|
|
190
216
|
return this.call("/context/inspect", () => this.sdk.context.inspect({
|
|
191
|
-
...this.scope(params.collection),
|
|
217
|
+
...this.scope(params.collection, params.database),
|
|
192
218
|
id: params.id,
|
|
193
219
|
mode: params.mode,
|
|
194
220
|
expirySeconds: params.expirySeconds,
|
|
@@ -197,14 +223,14 @@ export class ContextResource extends Resource {
|
|
|
197
223
|
/** Per-source indexing progress (SDK `context.status`). */
|
|
198
224
|
ingestionStatus(params, opts) {
|
|
199
225
|
return this.call("/context/status", () => this.sdk.context.status({
|
|
200
|
-
...this.scope(params.collection),
|
|
226
|
+
...this.scope(params.collection, params.database),
|
|
201
227
|
ids: params.ids,
|
|
202
228
|
}, req(opts)));
|
|
203
229
|
}
|
|
204
230
|
/** Knowledge-graph relations (SDK `context.relations`). */
|
|
205
231
|
relations(params = {}) {
|
|
206
232
|
return this.call("/context/relations", () => this.sdk.context.relations({
|
|
207
|
-
...this.scope(params.collection),
|
|
233
|
+
...this.scope(params.collection, params.database),
|
|
208
234
|
id: params.id,
|
|
209
235
|
type: params.kind,
|
|
210
236
|
limit: params.limit,
|
|
@@ -214,7 +240,7 @@ export class ContextResource extends Resource {
|
|
|
214
240
|
/** Delete memories or knowledge sources (SDK `context.delete`). */
|
|
215
241
|
delete(params, opts) {
|
|
216
242
|
return this.call("/context", () => this.sdk.context.delete({
|
|
217
|
-
...this.scope(params.collection),
|
|
243
|
+
...this.scope(params.collection, params.database),
|
|
218
244
|
ids: params.ids,
|
|
219
245
|
type: params.kind,
|
|
220
246
|
}, req(opts)));
|
|
@@ -274,6 +300,12 @@ export class HydraDB {
|
|
|
274
300
|
});
|
|
275
301
|
this.context = new ContextResource(client, config.database, config.collection);
|
|
276
302
|
this.databases = new DatabasesResource(client, config.database, config.collection);
|
|
303
|
+
this.graph = new GraphResource({
|
|
304
|
+
token: config.token,
|
|
305
|
+
...(config.baseUrl != null ? { baseUrl: config.baseUrl } : {}),
|
|
306
|
+
timeoutSeconds: config.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS,
|
|
307
|
+
maxRetries: config.maxRetries ?? DEFAULT_MAX_RETRIES,
|
|
308
|
+
});
|
|
277
309
|
}
|
|
278
310
|
}
|
|
279
311
|
//# sourceMappingURL=client.js.map
|
package/dist/hydra/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/hydra/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/hydra/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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