@mongodb-js/mcp-types 3.0.0-prerelease.4 → 3.0.0-prerelease.6

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.
@@ -1,28 +1,19 @@
1
1
  /**
2
- * Atlas cluster connection info containing details about the connected Atlas cluster.
3
- * When provided, indicates the connection is to an Atlas cluster.
2
+ * The Atlas cluster a connection entry addresses. Supplying it when creating the
3
+ * entry marks the connection as an Atlas one: it drives cluster attribution on
4
+ * tool telemetry, the `atlas` host type, and lets `pause-resume-cluster` find
5
+ * the connections to the cluster it just paused. A host that establishes the
6
+ * connection with its own credentials (X.509, a pre-provisioned user, a proxy)
7
+ * still knows which cluster it connected to and should supply this.
4
8
  *
5
- * The cluster's projectId, name and id are required. A host that establishes the
6
- * connection without minting a temporary database user — via its own credential
7
- * issuance, X.509, a pre-provisioned user, a proxy — still knows which cluster it
8
- * connected to and needs to be able to specify it: this field is what marks a
9
- * connection as pointing at Atlas, and leaving it unset prevents cluster
10
- * attribution on tool telemetry, the `atlas` host type, and the ability of
11
- * `pause-resume-cluster` to find connections to the cluster it just paused.
12
- * Hosts that only know the cluster name should resolve the id through the Atlas
13
- * API before connecting.
9
+ * `clusterId` should be resolved through the Atlas API before connecting; it is
10
+ * optional only because a registry can know which cluster a handle addresses
11
+ * before the handle has dialed and resolved the id.
14
12
  */
15
13
  export type AtlasClusterConnectionInfo = {
16
- /** Which Atlas cluster this connection points at. */
17
14
  projectId: string;
18
15
  clusterName: string;
19
- clusterId: string;
20
- /**
21
- * The temporary database user backing the connection. Set only by
22
- * `connect-cluster`, which also schedules its deletion; absent when the
23
- * host supplied its own credentials.
24
- */
25
- username?: string;
16
+ clusterId?: string;
26
17
  /** The cluster's tier, set when the host resolved it. */
27
18
  instanceType?: "FREE" | "FLEX" | "DEDICATED";
28
19
  };
@@ -41,6 +32,5 @@ export type ConnectionStringInfo = {
41
32
  export type SupportedConnectionState = {
42
33
  tag: string;
43
34
  connectionStringInfo?: ConnectionStringInfo;
44
- connectedAtlasCluster?: AtlasClusterConnectionInfo;
45
35
  };
46
36
  //# sourceMappingURL=connection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACrC,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;CAChD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAC/B,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,OAAO,GAAG,SAAS,CAAC;IACtG,QAAQ,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,aAAa,GAAG,OAAO,CAAC;CACrE,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,qBAAqB,CAAC,EAAE,0BAA0B,CAAC;CACtD,CAAC"}
1
+ {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;CAChD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAC/B,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,OAAO,GAAG,SAAS,CAAC;IACtG,QAAQ,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,aAAa,GAAG,OAAO,CAAC;CACrE,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;CAC/C,CAAC"}
@@ -1,4 +1,3 @@
1
- import type { Secret } from "mongodb-redact";
2
1
  export type { Secret } from "mongodb-redact";
3
2
  /**
4
3
  * The redaction half of a keychain, for consumers that need to scrub secrets out of a value but
@@ -15,9 +14,17 @@ export interface IRedactor {
15
14
  * redacted. Never mutates `value`, and terminates on self-referencing input.
16
15
  */
17
16
  redact<T>(value: T): T;
17
+ /**
18
+ * Returns the message of an `error` (or the string form of a non-error) with
19
+ * this redactor's secrets removed, for safe logging or display.
20
+ */
21
+ redactErrorMessage(error: unknown): string;
18
22
  }
19
- export interface IKeychain extends IRedactor {
20
- register(value: Secret["value"], kind: Secret["kind"]): void;
21
- clearAllSecrets(): void;
22
- }
23
+ /**
24
+ * A keychain, for consumers that hold one and need to redact secrets (loggers,
25
+ * tools, the server). It is immutable: its secrets are fixed at construction and
26
+ * cannot be registered or cleared afterwards, so it never grows over a process
27
+ * lifetime. The only action is {@link IRedactor.redact}.
28
+ */
29
+ export type IKeychain = IRedactor;
23
30
  //# sourceMappingURL=keychain.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"keychain.d.ts","sourceRoot":"","sources":["../src/keychain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACtB;;;;;;;OAOG;IACH,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC;CAC1B;AAED,MAAM,WAAW,SAAU,SAAQ,SAAS;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC7D,eAAe,IAAI,IAAI,CAAC;CAC3B"}
1
+ {"version":3,"file":"keychain.d.ts","sourceRoot":"","sources":["../src/keychain.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACtB;;;;;;;OAOG;IACH,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC;IACvB;;;OAGG;IACH,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;CAC9C;AAED;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC"}
@@ -13,32 +13,42 @@ export type RequestAuthInfo = {
13
13
  scopes: string[];
14
14
  /** When the token expires (in seconds since epoch). */
15
15
  expiresAt?: number;
16
+ /**
17
+ * Additional verified claims about the token, mirroring the SDK's
18
+ * `AuthInfo.extra`. Per-user scoping reads the OIDC `sub` claim here:
19
+ * `clientId` identifies the OAuth client application, not the end user, so
20
+ * deployments where several users authenticate through one shared client
21
+ * need a per-user principal claim (carried here) for per-user isolation.
22
+ */
23
+ extra?: Record<string, unknown>;
16
24
  };
17
25
  /**
18
- * The explicit authentication state of a request. Every HTTP request carries
19
- * one or the other — there is no "unknown" — so per-request servers always
20
- * know whether they are serving an authenticated client, and scope shared
21
- * state (e.g. connections) by the verified `clientId` when authenticated.
22
- * Identity is injected by the host (e.g. `req.auth` via the node adapter's
23
- * pass-through, or directly on the request context); the server never
24
- * authenticates on its own.
26
+ * Decides which connection scope a request gets — i.e. which connections it
27
+ * can see and where connections it creates are stored. Returns the scope key,
28
+ * or `undefined` for an ephemeral scope (no cross-request state, isolated
29
+ * from every other request).
30
+ *
31
+ * This is the knob that controls connection isolation: it must be keyed on
32
+ * whatever actually distinguishes the calling principals (per-user principal,
33
+ * OAuth client id, token, tenant, …) for correct, per-caller isolation with
34
+ * no shared state. Keyed on `clientId` alone, for example, it groups every
35
+ * user of one client registration together — fine for service accounts,
36
+ * wrong for a multi-user OIDC deployment. Returning `undefined` declines
37
+ * cross-request state for a request entirely.
25
38
  */
26
- export type RequestAuthState = {
27
- mode: "unauthenticated";
28
- } | {
29
- mode: "authenticated";
30
- state: RequestAuthInfo;
31
- };
39
+ export type ConnectionScopePolicy = (request: TransportRequestContext) => string | undefined;
32
40
  export type McpProtocol = "legacy" | "2026-07-28";
33
41
  export type TransportRequestContext = {
34
42
  headers?: Record<string, string | string[] | undefined>;
35
43
  query?: Record<string, string | string[] | undefined>;
36
44
  /**
37
- * The explicit auth state of this request. When authenticated, shared state
38
- * (connections) is scoped by `state.clientId`; unauthenticated requests are
39
- * isolated from authenticated clients.
45
+ * The verified identity of this request, if the host injected one (via
46
+ * `req.auth`, which the node adapter forwards, or directly). Absent means
47
+ * the host did not verify an identity for this request. Connection
48
+ * scoping and per-request authorization decisions key on this rather than
49
+ * self-asserted headers.
40
50
  */
41
- authInfo?: RequestAuthState;
51
+ authInfo?: RequestAuthInfo;
42
52
  protocol?: McpProtocol;
43
53
  };
44
54
  export interface ITransportRunner {
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAA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AE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,uBAAuB,KAAK,MAAM,GAAG,SAAS,CAAC;AAE7F,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,YAAY,CAAC;AAElD,MAAM,MAAM,uBAAuB,GAAG;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IACtD;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,QAAQ,CAAC,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC7B,KAAK,CAAC,OAAO,EAAE;QAAE,aAAa,CAAC,EAAE,OAAO,CAAC;QAAC,cAAc,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC3B,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpD"}
@@ -13,18 +13,12 @@ export type HttpServerOptions = {
13
13
  /** Response type: 'sse' for Server-Sent Events, 'json' for JSON responses */
14
14
  responseType?: "sse" | "json";
15
15
  /**
16
- * The HTTP entry's auth mode (required — there is no implicit default so a
17
- * deployment's posture is always explicit):
18
- *
19
- * - `"authenticated"`: every request must carry a verified identity (hosts
20
- * inject it via `req.auth`, which the node adapter forwards as the
21
- * handler's authInfo; the server never authenticates on its own).
22
- * Unauthenticated requests are rejected with 401 and the request
23
- * context's authInfo is always `{ mode: "authenticated", state }`.
24
- * - `"unauthenticated"`: authInfo carries whatever the host provides,
25
- * defaulting to `{ mode: "unauthenticated" }`.
16
+ * When true, permits binding to a non-loopback host (e.g. `0.0.0.0`, `::`,
17
+ * a LAN IP, or an empty host meaning "all interfaces"). Defaults to a strict
18
+ * loopback-only policy that throws when the host is not loopback. Set this
19
+ * explicitly only when the server is intentionally exposed to the network.
26
20
  */
27
- authMode: "authenticated" | "unauthenticated";
21
+ dangerousHostBinding?: boolean;
28
22
  };
29
23
  /**
30
24
  * Options for transport runners.
@@ -1 +1 @@
1
- {"version":3,"file":"transports.d.ts","sourceRoot":"","sources":["../src/transports.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC5B,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0BAA0B;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,6EAA6E;IAC7E,YAAY,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC9B;;;;;;;;;;;OAWG;IACH,QAAQ,EAAE,eAAe,GAAG,iBAAiB,CAAC;CACjD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACjC,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC"}
1
+ {"version":3,"file":"transports.d.ts","sourceRoot":"","sources":["../src/transports.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC5B,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0BAA0B;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,6EAA6E;IAC7E,YAAY,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC9B;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACjC,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;CACnB,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": "3.0.0-prerelease.4",
4
+ "version": "3.0.0-prerelease.6",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "author": "MongoDB <info@mongodb.com>",