@mongodb-js/mcp-types 1.14.0-prerelease.1 → 1.14.0-prerelease.3
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/dist/sessionStore.d.ts +25 -1
- package/dist/sessionStore.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/sessionStore.d.ts
CHANGED
|
@@ -1,15 +1,39 @@
|
|
|
1
1
|
import type { ILoggerBase } from "./logging.js";
|
|
2
2
|
import type { IMetrics, MetricDefinitions } from "./metrics.js";
|
|
3
|
+
import type { ISession } from "./session.js";
|
|
3
4
|
export type CloseableTransport = {
|
|
4
5
|
close(): Promise<void>;
|
|
5
6
|
};
|
|
6
7
|
export type SessionCloseReason = "idle_timeout" | "transport_closed" | "server_stop" | "unknown";
|
|
7
8
|
export interface ISessionStore<T extends CloseableTransport = CloseableTransport> {
|
|
8
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Returns the transport for the given session id or `undefined` if the
|
|
11
|
+
* session does not exist.
|
|
12
|
+
*
|
|
13
|
+
* @param headers The headers of the incoming request. Implementations can
|
|
14
|
+
* use them to validate the caller's identity before returning the session.
|
|
15
|
+
* To reject a request for an existing session, throw a
|
|
16
|
+
* `SessionRejectedError` rather than returning `undefined` — the latter is
|
|
17
|
+
* treated as "session not found" and may trigger implicit session
|
|
18
|
+
* initialization.
|
|
19
|
+
*/
|
|
20
|
+
getSession(sessionId: string, headers?: Record<string, unknown>): Promise<T | undefined>;
|
|
21
|
+
/**
|
|
22
|
+
* Stores a newly initialized session.
|
|
23
|
+
*
|
|
24
|
+
* @param params.session The server session, exposing session-level state
|
|
25
|
+
* (e.g. the logger or the connection manager) to implementations that
|
|
26
|
+
* need it.
|
|
27
|
+
* @param params.headers The headers of the request that initiated the
|
|
28
|
+
* session (e.g. for tracing the x-request-id in logs and downstream
|
|
29
|
+
* requests).
|
|
30
|
+
*/
|
|
9
31
|
addSession(params: {
|
|
10
32
|
sessionId: string;
|
|
11
33
|
transport: T;
|
|
34
|
+
/** TODO: Remove in v2 — redundant with `session.logger`. */
|
|
12
35
|
logger: ILoggerBase;
|
|
36
|
+
session: ISession;
|
|
13
37
|
headers?: Record<string, unknown>;
|
|
14
38
|
}): Promise<void>;
|
|
15
39
|
closeSession(params: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionStore.d.ts","sourceRoot":"","sources":["../src/sessionStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"sessionStore.d.ts","sourceRoot":"","sources":["../src/sessionStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,MAAM,kBAAkB,GAAG;IAC7B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,cAAc,GAAG,kBAAkB,GAAG,aAAa,GAAG,SAAS,CAAC;AAEjG,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB;IAC5E;;;;;;;;;;OAUG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IACzF;;;;;;;;;OASG;IACH,UAAU,CAAC,MAAM,EAAE;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,CAAC,CAAC;QACb,4DAA4D;QAC5D,MAAM,EAAE,WAAW,CAAC;QACpB,OAAO,EAAE,QAAQ,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACrC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClB,YAAY,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,kBAAkB,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxF,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AAED,MAAM,MAAM,2BAA2B,CAAC,QAAQ,SAAS,iBAAiB,GAAG,iBAAiB,IAAI;IAC9F,OAAO,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,qBAAqB,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAC5B,UAAU,SAAS,kBAAkB,GAAG,kBAAkB,EAC1D,QAAQ,SAAS,iBAAiB,GAAG,iBAAiB,IACtD,CAAC,IAAI,EAAE,2BAA2B,CAAC,QAAQ,CAAC,KAAK,aAAa,CAAC,UAAU,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongodb-js/mcp-types",
|
|
3
3
|
"description": "Shared TypeScript types and interfaces for MongoDB MCP server packages",
|
|
4
|
-
"version": "1.14.0-prerelease.
|
|
4
|
+
"version": "1.14.0-prerelease.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"author": "MongoDB <info@mongodb.com>",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@types/node": "^25.6.0",
|
|
28
28
|
"mongodb-log-writer": "^2.5.13",
|
|
29
29
|
"typescript": "^5.9.2",
|
|
30
|
-
"vitest": "^4.1.
|
|
30
|
+
"vitest": "^4.1.9"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"compile": "tsc --project tsconfig.json",
|