@n24q02m/hull 0.4.0 → 0.5.0-beta.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/README.md +47 -16
- package/build/cli/build-cli.d.ts +5 -6
- package/build/cli/build-cli.d.ts.map +1 -1
- package/build/cli/build-cli.js +4 -61
- package/build/cli/build-cli.js.map +1 -1
- package/build/crypto/index.d.ts +1 -1
- package/build/crypto/index.d.ts.map +1 -1
- package/build/crypto/index.js +1 -1
- package/build/crypto/index.js.map +1 -1
- package/build/crypto/kdf.d.ts +0 -13
- package/build/crypto/kdf.d.ts.map +1 -1
- package/build/crypto/kdf.js +3 -18
- package/build/crypto/kdf.js.map +1 -1
- package/build/index.d.ts +1 -11
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -16
- package/build/index.js.map +1 -1
- package/build/storage/account-registry.d.ts +53 -0
- package/build/storage/account-registry.d.ts.map +1 -0
- package/build/storage/account-registry.js +148 -0
- package/build/storage/account-registry.js.map +1 -0
- package/build/storage/backends.d.ts +0 -26
- package/build/storage/backends.d.ts.map +1 -1
- package/build/storage/backends.js +0 -65
- package/build/storage/backends.js.map +1 -1
- package/build/storage/config-file.d.ts +2 -19
- package/build/storage/config-file.d.ts.map +1 -1
- package/build/storage/config-file.js +2 -23
- package/build/storage/config-file.js.map +1 -1
- package/build/storage/credential-store.d.ts +1 -9
- package/build/storage/credential-store.d.ts.map +1 -1
- package/build/storage/credential-store.js +4 -16
- package/build/storage/credential-store.js.map +1 -1
- package/build/storage/data-dir.d.ts +2 -2
- package/build/storage/data-dir.js +2 -2
- package/build/storage/encryption.d.ts.map +1 -1
- package/build/storage/encryption.js +4 -0
- package/build/storage/encryption.js.map +1 -1
- package/build/storage/index.d.ts +5 -3
- package/build/storage/index.d.ts.map +1 -1
- package/build/storage/index.js +5 -3
- package/build/storage/index.js.map +1 -1
- package/build/storage/key-pool-crypto.d.ts +44 -0
- package/build/storage/key-pool-crypto.d.ts.map +1 -0
- package/build/storage/key-pool-crypto.js +132 -0
- package/build/storage/key-pool-crypto.js.map +1 -0
- package/build/storage/key-pool-store.d.ts +134 -0
- package/build/storage/key-pool-store.d.ts.map +1 -0
- package/build/storage/key-pool-store.js +470 -0
- package/build/storage/key-pool-store.js.map +1 -0
- package/build/storage/key-pool.d.ts +172 -0
- package/build/storage/key-pool.d.ts.map +1 -0
- package/build/storage/key-pool.js +374 -0
- package/build/storage/key-pool.js.map +1 -0
- package/build/storage/resolver.js +1 -1
- package/build/storage/resolver.js.map +1 -1
- package/build/token-auth/index.d.ts +1 -1
- package/build/token-auth/index.js +1 -1
- package/build/transport/index.d.ts +1 -2
- package/build/transport/index.d.ts.map +1 -1
- package/build/transport/index.js +1 -2
- package/build/transport/index.js.map +1 -1
- package/build/transport/local-server.d.ts +12 -128
- package/build/transport/local-server.d.ts.map +1 -1
- package/build/transport/local-server.js +20 -262
- package/build/transport/local-server.js.map +1 -1
- package/build/transport/streamable-http.d.ts +6 -7
- package/build/transport/streamable-http.d.ts.map +1 -1
- package/build/transport/streamable-http.js +6 -6
- package/build/transport/streamable-http.js.map +1 -1
- package/build/util/browser.d.ts.map +1 -0
- package/build/{relay → util}/browser.js +2 -2
- package/build/util/browser.js.map +1 -0
- package/package.json +4 -21
- package/build/auth/credential-form.d.ts +0 -163
- package/build/auth/credential-form.d.ts.map +0 -1
- package/build/auth/credential-form.js +0 -1869
- package/build/auth/credential-form.js.map +0 -1
- package/build/auth/delegated-oauth-app.d.ts +0 -90
- package/build/auth/delegated-oauth-app.d.ts.map +0 -1
- package/build/auth/delegated-oauth-app.js +0 -881
- package/build/auth/delegated-oauth-app.js.map +0 -1
- package/build/auth/index.d.ts +0 -12
- package/build/auth/index.d.ts.map +0 -1
- package/build/auth/index.js +0 -12
- package/build/auth/index.js.map +0 -1
- package/build/auth/local-oauth-app.d.ts +0 -152
- package/build/auth/local-oauth-app.d.ts.map +0 -1
- package/build/auth/local-oauth-app.js +0 -975
- package/build/auth/local-oauth-app.js.map +0 -1
- package/build/auth/relay-login.d.ts +0 -46
- package/build/auth/relay-login.d.ts.map +0 -1
- package/build/auth/relay-login.js +0 -197
- package/build/auth/relay-login.js.map +0 -1
- package/build/auth/router.d.ts +0 -18
- package/build/auth/router.d.ts.map +0 -1
- package/build/auth/router.js +0 -62
- package/build/auth/router.js.map +0 -1
- package/build/auth/session-store.d.ts +0 -49
- package/build/auth/session-store.d.ts.map +0 -1
- package/build/auth/session-store.js +0 -94
- package/build/auth/session-store.js.map +0 -1
- package/build/auth/stable-sub.d.ts +0 -27
- package/build/auth/stable-sub.d.ts.map +0 -1
- package/build/auth/stable-sub.js +0 -38
- package/build/auth/stable-sub.js.map +0 -1
- package/build/auth/well-known.d.ts +0 -4
- package/build/auth/well-known.d.ts.map +0 -1
- package/build/auth/well-known.js +0 -26
- package/build/auth/well-known.js.map +0 -1
- package/build/oauth/cache.d.ts +0 -22
- package/build/oauth/cache.d.ts.map +0 -1
- package/build/oauth/cache.js +0 -24
- package/build/oauth/cache.js.map +0 -1
- package/build/oauth/index.d.ts +0 -6
- package/build/oauth/index.d.ts.map +0 -1
- package/build/oauth/index.js +0 -6
- package/build/oauth/index.js.map +0 -1
- package/build/oauth/jwt-issuer.d.ts +0 -87
- package/build/oauth/jwt-issuer.d.ts.map +0 -1
- package/build/oauth/jwt-issuer.js +0 -205
- package/build/oauth/jwt-issuer.js.map +0 -1
- package/build/oauth/pkce.d.ts +0 -10
- package/build/oauth/pkce.d.ts.map +0 -1
- package/build/oauth/pkce.js +0 -34
- package/build/oauth/pkce.js.map +0 -1
- package/build/oauth/provider.d.ts +0 -52
- package/build/oauth/provider.d.ts.map +0 -1
- package/build/oauth/provider.js +0 -98
- package/build/oauth/provider.js.map +0 -1
- package/build/oauth/user-store.d.ts +0 -25
- package/build/oauth/user-store.d.ts.map +0 -1
- package/build/oauth/user-store.js +0 -85
- package/build/oauth/user-store.js.map +0 -1
- package/build/relay/browser.d.ts.map +0 -1
- package/build/relay/browser.js.map +0 -1
- package/build/relay/client.d.ts +0 -36
- package/build/relay/client.d.ts.map +0 -1
- package/build/relay/client.js +0 -135
- package/build/relay/client.js.map +0 -1
- package/build/relay/session.d.ts +0 -12
- package/build/relay/session.d.ts.map +0 -1
- package/build/relay/session.js +0 -55
- package/build/relay/session.js.map +0 -1
- package/build/relay/tool-helpers.d.ts +0 -85
- package/build/relay/tool-helpers.d.ts.map +0 -1
- package/build/relay/tool-helpers.js +0 -103
- package/build/relay/tool-helpers.js.map +0 -1
- package/build/relay/wordlist.d.ts +0 -2
- package/build/relay/wordlist.d.ts.map +0 -1
- package/build/relay/wordlist.js +0 -7782
- package/build/relay/wordlist.js.map +0 -1
- package/build/schema/types.d.ts +0 -67
- package/build/schema/types.d.ts.map +0 -1
- package/build/schema/types.js +0 -2
- package/build/schema/types.js.map +0 -1
- package/build/storage/mode.d.ts +0 -23
- package/build/storage/mode.d.ts.map +0 -1
- package/build/storage/mode.js +0 -46
- package/build/storage/mode.js.map +0 -1
- package/build/storage/session-lock.d.ts +0 -19
- package/build/storage/session-lock.d.ts.map +0 -1
- package/build/storage/session-lock.js +0 -105
- package/build/storage/session-lock.js.map +0 -1
- package/build/transport/oauth-middleware.d.ts +0 -45
- package/build/transport/oauth-middleware.d.ts.map +0 -1
- package/build/transport/oauth-middleware.js +0 -86
- package/build/transport/oauth-middleware.js.map +0 -1
- /package/build/{relay → util}/browser.d.ts +0 -0
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Thin convenience wrapper around `@modelcontextprotocol/sdk`'s
|
|
5
5
|
* `StreamableHTTPServerTransport` that pairs it with an `McpServer`
|
|
6
|
-
* instance and an optional
|
|
6
|
+
* instance and an optional Bearer validation middleware.
|
|
7
7
|
*
|
|
8
8
|
* The SDK already implements the full 2025-11-25 transport spec
|
|
9
9
|
* (session management, SSE streaming, stateful / stateless modes),
|
|
10
10
|
* so this wrapper focuses on the mcp-core ergonomics:
|
|
11
11
|
*
|
|
12
12
|
* - one-call `connect()` that wires server <-> transport
|
|
13
|
-
* - `handleRequest(req, res)` that applies the
|
|
13
|
+
* - `handleRequest(req, res)` that applies the auth middleware
|
|
14
14
|
* first and short-circuits with 401 on missing / invalid token
|
|
15
15
|
* - explicit `host` / `port` properties for lifecycle management
|
|
16
16
|
* (the actual port bind is left to the caller's http.Server)
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
19
19
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
20
20
|
import { StreamableHTTPServerTransport, type StreamableHTTPServerTransportOptions } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
21
|
-
import type { OAuthMiddleware } from './oauth-middleware.js';
|
|
22
21
|
export interface StreamableHTTPServerOptions {
|
|
23
22
|
/** MCP server instance that handles requests */
|
|
24
23
|
server: McpServer;
|
|
@@ -26,8 +25,8 @@ export interface StreamableHTTPServerOptions {
|
|
|
26
25
|
host?: string;
|
|
27
26
|
/** Port to advertise (used for logging / display only) */
|
|
28
27
|
port: number;
|
|
29
|
-
/** Optional
|
|
30
|
-
|
|
28
|
+
/** Optional middleware for request authorization */
|
|
29
|
+
authMiddleware?: (req: IncomingMessage, res: ServerResponse) => Promise<boolean> | boolean;
|
|
31
30
|
/** Transport options forwarded to StreamableHTTPServerTransport */
|
|
32
31
|
transportOptions?: StreamableHTTPServerTransportOptions;
|
|
33
32
|
}
|
|
@@ -35,14 +34,14 @@ export declare class StreamableHTTPServer {
|
|
|
35
34
|
readonly host: string;
|
|
36
35
|
readonly port: number;
|
|
37
36
|
private readonly _server;
|
|
38
|
-
private readonly
|
|
37
|
+
private readonly _auth?;
|
|
39
38
|
private readonly _transport;
|
|
40
39
|
private _connected;
|
|
41
40
|
constructor(options: StreamableHTTPServerOptions);
|
|
42
41
|
/** Connect the MCP server to the transport. Call once before handleRequest. */
|
|
43
42
|
connect(): Promise<void>;
|
|
44
43
|
/**
|
|
45
|
-
* Handle an incoming HTTP request. Applies
|
|
44
|
+
* Handle an incoming HTTP request. Applies auth validation first if
|
|
46
45
|
* configured, then delegates to the SDK transport.
|
|
47
46
|
*/
|
|
48
47
|
handleRequest(req: IncomingMessage, res: ServerResponse, parsedBody?: unknown): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamable-http.d.ts","sourceRoot":"","sources":["../../src/transport/streamable-http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAEhE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,EACL,6BAA6B,EAC7B,KAAK,oCAAoC,EAC1C,MAAM,oDAAoD,CAAA;AAE3D,
|
|
1
|
+
{"version":3,"file":"streamable-http.d.ts","sourceRoot":"","sources":["../../src/transport/streamable-http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAEhE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,EACL,6BAA6B,EAC7B,KAAK,oCAAoC,EAC1C,MAAM,oDAAoD,CAAA;AAE3D,MAAM,WAAW,2BAA2B;IAC1C,gDAAgD;IAChD,MAAM,EAAE,SAAS,CAAA;IACjB,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;IAC1F,mEAAmE;IACnE,gBAAgB,CAAC,EAAE,oCAAoC,CAAA;CACxD;AAED,qBAAa,oBAAoB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAW;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAA2E;IAClG,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+B;IAC1D,OAAO,CAAC,UAAU,CAAQ;IAE1B,YAAY,OAAO,EAAE,2BAA2B,EAM/C;IAED,+EAA+E;IACzE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAI7B;IAED;;;OAGG;IACG,aAAa,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAMlG;IAED,8DAA8D;IAC9D,IAAI,SAAS,IAAI,6BAA6B,CAE7C;IAED,yDAAyD;IACnD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAG3B;CACF"}
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Thin convenience wrapper around `@modelcontextprotocol/sdk`'s
|
|
5
5
|
* `StreamableHTTPServerTransport` that pairs it with an `McpServer`
|
|
6
|
-
* instance and an optional
|
|
6
|
+
* instance and an optional Bearer validation middleware.
|
|
7
7
|
*
|
|
8
8
|
* The SDK already implements the full 2025-11-25 transport spec
|
|
9
9
|
* (session management, SSE streaming, stateful / stateless modes),
|
|
10
10
|
* so this wrapper focuses on the mcp-core ergonomics:
|
|
11
11
|
*
|
|
12
12
|
* - one-call `connect()` that wires server <-> transport
|
|
13
|
-
* - `handleRequest(req, res)` that applies the
|
|
13
|
+
* - `handleRequest(req, res)` that applies the auth middleware
|
|
14
14
|
* first and short-circuits with 401 on missing / invalid token
|
|
15
15
|
* - explicit `host` / `port` properties for lifecycle management
|
|
16
16
|
* (the actual port bind is left to the caller's http.Server)
|
|
@@ -22,7 +22,7 @@ export class StreamableHTTPServer {
|
|
|
22
22
|
this._server = options.server;
|
|
23
23
|
this.host = options.host ?? '127.0.0.1';
|
|
24
24
|
this.port = options.port;
|
|
25
|
-
this.
|
|
25
|
+
this._auth = options.authMiddleware;
|
|
26
26
|
this._transport = new StreamableHTTPServerTransport(options.transportOptions ?? { sessionIdGenerator: undefined });
|
|
27
27
|
}
|
|
28
28
|
/** Connect the MCP server to the transport. Call once before handleRequest. */
|
|
@@ -33,12 +33,12 @@ export class StreamableHTTPServer {
|
|
|
33
33
|
this._connected = true;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* Handle an incoming HTTP request. Applies
|
|
36
|
+
* Handle an incoming HTTP request. Applies auth validation first if
|
|
37
37
|
* configured, then delegates to the SDK transport.
|
|
38
38
|
*/
|
|
39
39
|
async handleRequest(req, res, parsedBody) {
|
|
40
|
-
if (this.
|
|
41
|
-
const allowed = await this.
|
|
40
|
+
if (this._auth) {
|
|
41
|
+
const allowed = await this._auth(req, res);
|
|
42
42
|
if (!allowed)
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamable-http.js","sourceRoot":"","sources":["../../src/transport/streamable-http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,EACL,6BAA6B,EAE9B,MAAM,oDAAoD,CAAA;
|
|
1
|
+
{"version":3,"file":"streamable-http.js","sourceRoot":"","sources":["../../src/transport/streamable-http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,EACL,6BAA6B,EAE9B,MAAM,oDAAoD,CAAA;AAe3D,MAAM,OAAO,oBAAoB;IAQ/B,YAAY,OAAoC;QAFxC,eAAU,GAAG,KAAK,CAAA;QAGxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAA;QAC7B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,WAAW,CAAA;QACvC,IAAI,CAAC,IAAI,GA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E"}
|
|
@@ -80,8 +80,8 @@ async function openInWsl(url) {
|
|
|
80
80
|
export async function tryOpenBrowser(url) {
|
|
81
81
|
try {
|
|
82
82
|
// Env-guard: suppress auto-open in headless / CI / autonomous-test contexts so a
|
|
83
|
-
//
|
|
84
|
-
//
|
|
83
|
+
// server never hijacks the user's real browser with sign-in or 127.0.0.1 tabs.
|
|
84
|
+
// Set MCP_NO_BROWSER=1 or NO_BROWSER=1 to disable it explicitly;
|
|
85
85
|
// `CI` counts too because every CI provider sets it (GitHub Actions: CI=true) and a
|
|
86
86
|
// build agent has no browser to hijack.
|
|
87
87
|
if (envFlag('MCP_NO_BROWSER') || envFlag('NO_BROWSER') || envFlag('CI')) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/util/browser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAA;AAEzC,4EAA4E;AAC5E,+EAA+E;AAC/E,kCAAkC;AAClC,MAAM,6BAA6B,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA;AACnD,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAkB,CAAA;AAEpD;;;;;;;;;;;GAWG;AACH,SAAS,OAAO,CAAC,IAAY;IAC3B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAC/B,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,GAAG,CAAA;AAClF,CAAC;AAED,KAAK,UAAU,KAAK;IAClB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,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aAAa,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;QACtC,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n24q02m/hull",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "hull TypeScript core: MCP Streamable HTTP 2025-11-25 transport,
|
|
3
|
+
"version": "0.5.0-beta.2",
|
|
4
|
+
"description": "hull TypeScript core: MCP Streamable HTTP 2025-11-25 transport, token-table HTTP auth, credential storage, CLI builder",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
7
7
|
"model-context-protocol",
|
|
8
8
|
"streamable-http",
|
|
9
|
-
"
|
|
9
|
+
"token-auth",
|
|
10
10
|
"transport",
|
|
11
11
|
"claude",
|
|
12
12
|
"cursor",
|
|
@@ -52,22 +52,6 @@
|
|
|
52
52
|
"import": "./build/storage/index.js",
|
|
53
53
|
"types": "./build/storage/index.d.ts"
|
|
54
54
|
},
|
|
55
|
-
"./relay": {
|
|
56
|
-
"import": "./build/relay/client.js",
|
|
57
|
-
"types": "./build/relay/client.d.ts"
|
|
58
|
-
},
|
|
59
|
-
"./schema": {
|
|
60
|
-
"import": "./build/schema/types.js",
|
|
61
|
-
"types": "./build/schema/types.d.ts"
|
|
62
|
-
},
|
|
63
|
-
"./oauth": {
|
|
64
|
-
"import": "./build/oauth/index.js",
|
|
65
|
-
"types": "./build/oauth/index.d.ts"
|
|
66
|
-
},
|
|
67
|
-
"./auth": {
|
|
68
|
-
"import": "./build/auth/index.js",
|
|
69
|
-
"types": "./build/auth/index.d.ts"
|
|
70
|
-
},
|
|
71
55
|
"./transport": {
|
|
72
56
|
"import": "./build/transport/index.js",
|
|
73
57
|
"types": "./build/transport/index.d.ts"
|
|
@@ -88,7 +72,6 @@
|
|
|
88
72
|
"@modelcontextprotocol/sdk": "^1.30.1",
|
|
89
73
|
"better-sqlite3": "^13.0.3",
|
|
90
74
|
"env-paths": "^4.0.0",
|
|
91
|
-
"jose": "^6.2.12",
|
|
92
75
|
"smol-toml": "^1.9.0"
|
|
93
76
|
},
|
|
94
77
|
"trustedDependencies": [
|
|
@@ -105,5 +88,5 @@
|
|
|
105
88
|
"engines": {
|
|
106
89
|
"node": ">=24.21.0"
|
|
107
90
|
},
|
|
108
|
-
"packageManager": "bun@1.4.
|
|
91
|
+
"packageManager": "bun@1.4.4"
|
|
109
92
|
}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Credential form HTML renderer.
|
|
3
|
-
*
|
|
4
|
-
* Renders a dark-themed HTML form from a RelayConfigSchema.
|
|
5
|
-
* Used as the OAuth authorization page presented to the user during relay config.
|
|
6
|
-
*
|
|
7
|
-
* This is a TypeScript port of core-py's `credential_form.py`. CSS and embedded JS
|
|
8
|
-
* are kept verbatim so the rendered form has visual + behavioral parity between
|
|
9
|
-
* Python and TS servers.
|
|
10
|
-
*/
|
|
11
|
-
export interface ConfigField {
|
|
12
|
-
key: string;
|
|
13
|
-
label: string;
|
|
14
|
-
type: string;
|
|
15
|
-
placeholder?: string;
|
|
16
|
-
helpText?: string;
|
|
17
|
-
helpUrl?: string;
|
|
18
|
-
required?: boolean;
|
|
19
|
-
/** Regex string for client-side validation; rendered as the input's `pattern` attribute. */
|
|
20
|
-
validation?: string;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Return true iff every required field in `schema` has a non-empty value in
|
|
24
|
-
* `config`. For schemas whose fields are all optional, requires the explicit
|
|
25
|
-
* `_setup_complete: "true"` flag — see core-py `is_schema_complete` docstring.
|
|
26
|
-
*
|
|
27
|
-
* Strict equality on the flag: only the literal string `"true"` counts. This
|
|
28
|
-
* guards against legacy / partial bootstrap entries (e.g. peer-shared cloud
|
|
29
|
-
* keys) tricking the auto-open gate into thinking the user has configured.
|
|
30
|
-
*/
|
|
31
|
-
export declare function isSchemaComplete(config: Record<string, string> | null | undefined, schema: RelayConfigSchema): boolean;
|
|
32
|
-
export interface CapabilityInfo {
|
|
33
|
-
label: string;
|
|
34
|
-
priority?: string;
|
|
35
|
-
description?: string;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* A credential-form tab (schema-level `tabs` capability). Each tab is a
|
|
39
|
-
* mutually-exclusive credential mode; only the active tab's fields submit.
|
|
40
|
-
*/
|
|
41
|
-
export interface TabGroup {
|
|
42
|
-
id: string;
|
|
43
|
-
label: string;
|
|
44
|
-
fields: ConfigField[];
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* A repeatable field group (schema-level `cardGroup` capability). Renders
|
|
48
|
-
* Add/Remove cards, each cloning `fields`; submitted as a JSON array under
|
|
49
|
-
* `key` (e.g. `{ accounts: [{...}, {...}] }`).
|
|
50
|
-
*/
|
|
51
|
-
export interface CardGroup {
|
|
52
|
-
key: string;
|
|
53
|
-
fields: ConfigField[];
|
|
54
|
-
itemLabel?: string;
|
|
55
|
-
heading?: string;
|
|
56
|
-
addButtonLabel?: string;
|
|
57
|
-
minItems?: number;
|
|
58
|
-
titleField?: string;
|
|
59
|
-
}
|
|
60
|
-
export interface RelayConfigSchema {
|
|
61
|
-
server: string;
|
|
62
|
-
displayName?: string;
|
|
63
|
-
description?: string;
|
|
64
|
-
fields?: ConfigField[];
|
|
65
|
-
capabilityInfo?: CapabilityInfo[];
|
|
66
|
-
/** Mutually-exclusive credential modes; see the tabbed render path. */
|
|
67
|
-
tabs?: TabGroup[];
|
|
68
|
-
/** One repeatable field group; see the card-group render path. */
|
|
69
|
-
cardGroup?: CardGroup;
|
|
70
|
-
}
|
|
71
|
-
export interface RenderOptions {
|
|
72
|
-
submitUrl: string;
|
|
73
|
-
pageTitle?: string;
|
|
74
|
-
/**
|
|
75
|
-
* Optional ``{KEY: VALUE}`` map populated by the OAuth AS from
|
|
76
|
-
* ``?prefill_<KEY>=<VALUE>`` query params on GET /authorize. Each matching
|
|
77
|
-
* field renders with an HTML-escaped ``value="..."`` attr so users only
|
|
78
|
-
* type what skret cannot supply (OTP / 2FA / one-time codes). Non-matching
|
|
79
|
-
* keys are ignored.
|
|
80
|
-
*/
|
|
81
|
-
prefill?: Record<string, string>;
|
|
82
|
-
/**
|
|
83
|
-
* For a `tabs` schema, the id of the tab to render active on load (defaults
|
|
84
|
-
* to the first tab). Ignored for non-tabbed schemas.
|
|
85
|
-
*/
|
|
86
|
-
initialTab?: string;
|
|
87
|
-
/**
|
|
88
|
-
* Opt-in workspace-username field (multi-user stable-sub). Honoured by the
|
|
89
|
-
* flat, `tabs`, and `cardGroup` render paths.
|
|
90
|
-
*/
|
|
91
|
-
includeUsernameField?: boolean;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Wrap `bodyHtml` in the shared dark-theme HTML shell.
|
|
95
|
-
*
|
|
96
|
-
* The shell provides `<!DOCTYPE html>`, `<head>` (charset, viewport, a
|
|
97
|
-
* Content-Security-Policy meta, escaped `<title>`, embedded `FORM_SHELL_CSS`)
|
|
98
|
-
* and a `<body>` whose only child is `bodyHtml`. `bodyHtml` is inserted
|
|
99
|
-
* verbatim, so callers MUST pre-escape any untrusted values they interpolate.
|
|
100
|
-
*
|
|
101
|
-
* The CSP (`default-src 'none'; style-src 'unsafe-inline'; script-src
|
|
102
|
-
* 'unsafe-inline'; connect-src 'self'`) permits the page's own inline
|
|
103
|
-
* `<style>`/`<script>` and same-origin `fetch` submits while blocking any
|
|
104
|
-
* external resource load.
|
|
105
|
-
*
|
|
106
|
-
* `title` is HTML-escaped before being placed in `<title>`.
|
|
107
|
-
*
|
|
108
|
-
* Used by `renderCredentialForm` (relay credential form) and by
|
|
109
|
-
* `loginGetHandler` in `relay-login.ts` (the `/login` password gate) so both
|
|
110
|
-
* pages share identical typography, palette, card layout, and input styling.
|
|
111
|
-
* Parity with Python `render_form_shell` in
|
|
112
|
-
* `packages/core-py/src/mcp_core/auth/credential_form.py`.
|
|
113
|
-
*/
|
|
114
|
-
export declare function renderFormShell(title: string, bodyHtml: string): string;
|
|
115
|
-
/**
|
|
116
|
-
* Render a dark-themed HTML credential form from a RelayConfigSchema.
|
|
117
|
-
*
|
|
118
|
-
* @param schema RelayConfigSchema with server metadata and field definitions.
|
|
119
|
-
* @param options.submitUrl URL the form POSTs to as JSON via fetch().
|
|
120
|
-
* @param options.pageTitle Optional browser tab title. Defaults to displayName.
|
|
121
|
-
* @param options.prefill Optional ``{KEY: VALUE}`` map for input ``value=`` attrs.
|
|
122
|
-
* @returns Complete HTML document string, XSS-safe with all dynamic content escaped.
|
|
123
|
-
*/
|
|
124
|
-
export declare function renderCredentialForm(schema: RelayConfigSchema, options: RenderOptions): string;
|
|
125
|
-
/**
|
|
126
|
-
* Relay config field schema (D7).
|
|
127
|
-
*
|
|
128
|
-
* Each field supports:
|
|
129
|
-
* name (string, required): config.enc key
|
|
130
|
-
* label (string, required): UI label
|
|
131
|
-
* required (boolean, required): server gate
|
|
132
|
-
* secret (boolean, optional, default false): true = never re-render value to HTML
|
|
133
|
-
* oauthField (boolean, optional, default false): true = managed by OAuth flow,
|
|
134
|
-
* render as Re-authorize button instead of input
|
|
135
|
-
* type (string, optional, default "text"): UI input type
|
|
136
|
-
* description (string, optional): help text
|
|
137
|
-
* default (unknown, optional): default value if user submits empty
|
|
138
|
-
* pattern (string, optional): client-side regex validation
|
|
139
|
-
*
|
|
140
|
-
* Parity with core-py `RelayConfigField` (snake_case `oauth_field` -> camelCase
|
|
141
|
-
* `oauthField` per TS convention).
|
|
142
|
-
*/
|
|
143
|
-
export interface RelayConfigField {
|
|
144
|
-
name: string;
|
|
145
|
-
label: string;
|
|
146
|
-
required: boolean;
|
|
147
|
-
secret?: boolean;
|
|
148
|
-
oauthField?: boolean;
|
|
149
|
-
type?: 'text' | 'password' | 'url' | 'email';
|
|
150
|
-
description?: string;
|
|
151
|
-
default?: unknown;
|
|
152
|
-
pattern?: string;
|
|
153
|
-
}
|
|
154
|
-
/** Return true if field stores a credential that must not be re-rendered to HTML. */
|
|
155
|
-
export declare function isSecretField(field: RelayConfigField): boolean;
|
|
156
|
-
/**
|
|
157
|
-
* Return true if field represents an OAuth-managed credential.
|
|
158
|
-
*
|
|
159
|
-
* OAuth fields render as "Re-authorize" buttons, not raw input boxes.
|
|
160
|
-
* Examples: refresh_token, access_token, id_token.
|
|
161
|
-
*/
|
|
162
|
-
export declare function isOAuthField(field: RelayConfigField): boolean;
|
|
163
|
-
//# sourceMappingURL=credential-form.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"credential-form.d.ts","sourceRoot":"","sources":["../../src/auth/credential-form.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,4FAA4F;IAC5F,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,EACjD,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAqBT;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,WAAW,EAAE,CAAA;CACtB;A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