@nest-mcp/client 1.0.2 → 2.0.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/CHANGELOG.md +139 -0
- package/README.md +845 -69
- package/dist/ai-sdk/index.d.mts +14 -0
- package/dist/ai-sdk/index.d.mts.map +1 -0
- package/dist/ai-sdk/index.mjs +27 -0
- package/dist/ai-sdk/index.mjs.map +1 -0
- package/dist/bootstrap-BIAcDnHp.d.mts +394 -0
- package/dist/bootstrap-BIAcDnHp.d.mts.map +1 -0
- package/dist/index.d.mts +480 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1960 -0
- package/dist/index.mjs.map +1 -0
- package/dist/oauth/dynamic-registration.d.mts +92 -0
- package/dist/oauth/dynamic-registration.d.mts.map +1 -0
- package/dist/oauth/dynamic-registration.mjs +392 -0
- package/dist/oauth/dynamic-registration.mjs.map +1 -0
- package/dist/oauth/index.d.mts +422 -0
- package/dist/oauth/index.d.mts.map +1 -0
- package/dist/oauth/index.mjs +3349 -0
- package/dist/oauth/index.mjs.map +1 -0
- package/dist/scope-CxGBCDdr.mjs +22 -0
- package/dist/scope-CxGBCDdr.mjs.map +1 -0
- package/package.json +76 -50
- package/scripts/external-smoke.mjs +693 -0
- package/dist/decorators/inject-mcp-client.decorator.d.ts +0 -3
- package/dist/decorators/inject-mcp-client.decorator.js +0 -12
- package/dist/decorators/on-notification.decorator.d.ts +0 -7
- package/dist/decorators/on-notification.decorator.js +0 -13
- package/dist/health/mcp-client.health.d.ts +0 -20
- package/dist/health/mcp-client.health.js +0 -42
- package/dist/index.d.ts +0 -21
- package/dist/index.js +0 -64
- package/dist/interfaces/client-options.interface.d.ts +0 -139
- package/dist/interfaces/client-options.interface.js +0 -3
- package/dist/mcp-client.module.d.ts +0 -20
- package/dist/mcp-client.module.js +0 -188
- package/dist/mcp-client.service.d.ts +0 -558
- package/dist/mcp-client.service.js +0 -532
- package/dist/mcp-clients.service.d.ts +0 -39
- package/dist/mcp-clients.service.js +0 -104
- package/dist/testing/mock-client.d.ts +0 -67
- package/dist/testing/mock-client.js +0 -154
- package/dist/transport/apply-auth-headers.d.ts +0 -3
- package/dist/transport/apply-auth-headers.js +0 -13
- package/dist/transport/client-transport.factory.d.ts +0 -4
- package/dist/transport/client-transport.factory.js +0 -21
- package/dist/transport/sse-client.transport.d.ts +0 -4
- package/dist/transport/sse-client.transport.js +0 -15
- package/dist/transport/stdio-client.transport.d.ts +0 -4
- package/dist/transport/stdio-client.transport.js +0 -14
- package/dist/transport/streamable-client.transport.d.ts +0 -4
- package/dist/transport/streamable-client.transport.js +0 -17
- package/dist/utils/format-error-message.d.ts +0 -2
- package/dist/utils/format-error-message.js +0 -7
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/oauth/scope.ts
|
|
2
|
+
/** Maximum scope-token length accepted by the bounded OAuth client facade. */
|
|
3
|
+
const MCP_CLIENT_OAUTH_MAX_SCOPE_LENGTH = 256;
|
|
4
|
+
/**
|
|
5
|
+
* Returns whether `value` is one bounded RFC 6749 scope-token.
|
|
6
|
+
*
|
|
7
|
+
* RFC 6749 section 3.3 defines scope-token as ASCII NQCHAR: `!`, `#` through
|
|
8
|
+
* `[`, or `]` through `~`. In particular, quote, backslash, whitespace, control
|
|
9
|
+
* characters, and non-ASCII characters are not valid scope-token content.
|
|
10
|
+
*/
|
|
11
|
+
function isMcpClientOAuthScopeToken(value) {
|
|
12
|
+
if (typeof value !== "string" || value.length === 0 || value.length > 256) return false;
|
|
13
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
14
|
+
const code = value.charCodeAt(index);
|
|
15
|
+
if (code !== 33 && !(code >= 35 && code <= 91) && !(code >= 93 && code <= 126)) return false;
|
|
16
|
+
}
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { isMcpClientOAuthScopeToken as n, MCP_CLIENT_OAUTH_MAX_SCOPE_LENGTH as t };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=scope-CxGBCDdr.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-CxGBCDdr.mjs","names":[],"sources":["../src/oauth/scope.ts"],"sourcesContent":["/** Maximum scope-token length accepted by the bounded OAuth client facade. */\nexport const MCP_CLIENT_OAUTH_MAX_SCOPE_LENGTH = 256;\n\n/**\n * Returns whether `value` is one bounded RFC 6749 scope-token.\n *\n * RFC 6749 section 3.3 defines scope-token as ASCII NQCHAR: `!`, `#` through\n * `[`, or `]` through `~`. In particular, quote, backslash, whitespace, control\n * characters, and non-ASCII characters are not valid scope-token content.\n */\nexport function isMcpClientOAuthScopeToken(value: unknown): value is string {\n\tif (\n\t\ttypeof value !== \"string\" ||\n\t\tvalue.length === 0 ||\n\t\tvalue.length > MCP_CLIENT_OAUTH_MAX_SCOPE_LENGTH\n\t) {\n\t\treturn false;\n\t}\n\tfor (let index = 0; index < value.length; index += 1) {\n\t\tconst code = value.charCodeAt(index);\n\t\tif (code !== 0x21 && !(code >= 0x23 && code <= 0x5b) && !(code >= 0x5d && code <= 0x7e)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n"],"mappings":";;AACA,MAAa,oCAAoC;;;;;;;;AASjD,SAAgB,2BAA2B,OAAiC;CAC3E,IACC,OAAO,UAAU,YACjB,MAAM,WAAW,KACjB,MAAM,SAAA,KAEN,OAAO;CAER,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS,GAAG;EACrD,MAAM,OAAO,MAAM,WAAW,KAAK;EACnC,IAAI,SAAS,MAAQ,EAAE,QAAQ,MAAQ,QAAQ,OAAS,EAAE,QAAQ,MAAQ,QAAQ,MACjF,OAAO;CAET;CACA,OAAO;AACR"}
|
package/package.json
CHANGED
|
@@ -1,73 +1,99 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nest-mcp/client",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Multi-server MCP v2 client runtime with transport, middleware, lifecycle, and discovery support.",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/btwld/nest-mcp.git",
|
|
9
|
+
"directory": "packages/client"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/btwld/nest-mcp/tree/main/packages/client#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/btwld/nest-mcp/issues"
|
|
13
14
|
},
|
|
14
|
-
"files": [
|
|
15
|
-
"dist",
|
|
16
|
-
"!dist/**/*.js.map",
|
|
17
|
-
"!dist/**/*.d.ts.map"
|
|
18
|
-
],
|
|
19
15
|
"keywords": [
|
|
20
|
-
"nestjs",
|
|
21
|
-
"nest",
|
|
22
16
|
"mcp",
|
|
23
17
|
"model-context-protocol",
|
|
24
|
-
"ai",
|
|
25
|
-
"llm",
|
|
26
|
-
"mcp-client",
|
|
27
18
|
"client",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
19
|
+
"runtime",
|
|
20
|
+
"gateway",
|
|
21
|
+
"oauth",
|
|
22
|
+
"observability",
|
|
23
|
+
"nest-mcp"
|
|
32
24
|
],
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
"directory": "packages/client"
|
|
25
|
+
"type": "module",
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=22.13.0"
|
|
38
29
|
},
|
|
39
|
-
"
|
|
40
|
-
|
|
30
|
+
"types": "./dist/index.d.mts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.mts",
|
|
34
|
+
"import": "./dist/index.mjs",
|
|
35
|
+
"default": "./dist/index.mjs"
|
|
36
|
+
},
|
|
37
|
+
"./oauth": {
|
|
38
|
+
"types": "./dist/oauth/index.d.mts",
|
|
39
|
+
"import": "./dist/oauth/index.mjs",
|
|
40
|
+
"default": "./dist/oauth/index.mjs"
|
|
41
|
+
},
|
|
42
|
+
"./oauth/dynamic-registration": {
|
|
43
|
+
"types": "./dist/oauth/dynamic-registration.d.mts",
|
|
44
|
+
"import": "./dist/oauth/dynamic-registration.mjs",
|
|
45
|
+
"default": "./dist/oauth/dynamic-registration.mjs"
|
|
46
|
+
},
|
|
47
|
+
"./package.json": "./package.json",
|
|
48
|
+
"./ai-sdk": {
|
|
49
|
+
"types": "./dist/ai-sdk/index.d.mts",
|
|
50
|
+
"import": "./dist/ai-sdk/index.mjs",
|
|
51
|
+
"default": "./dist/ai-sdk/index.mjs"
|
|
52
|
+
}
|
|
41
53
|
},
|
|
42
|
-
"
|
|
43
|
-
"
|
|
54
|
+
"files": [
|
|
55
|
+
"dist",
|
|
56
|
+
"scripts/external-smoke.mjs",
|
|
57
|
+
"README.md",
|
|
58
|
+
"CHANGELOG.md",
|
|
59
|
+
"LICENSE"
|
|
60
|
+
],
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public",
|
|
63
|
+
"provenance": true
|
|
44
64
|
},
|
|
45
65
|
"dependencies": {
|
|
46
|
-
"@nest-mcp/
|
|
66
|
+
"@nest-mcp/conformance": "^2.0.0",
|
|
67
|
+
"@nest-mcp/core": "^2.0.0",
|
|
68
|
+
"zod": "^4.4.3"
|
|
47
69
|
},
|
|
48
70
|
"peerDependencies": {
|
|
49
|
-
"@modelcontextprotocol/
|
|
50
|
-
"
|
|
51
|
-
"@nestjs/core": "^10.0.0 || ^11.0.0 || ^12.0.0",
|
|
52
|
-
"reflect-metadata": ">=0.1.13",
|
|
53
|
-
"rxjs": "^7.0.0"
|
|
71
|
+
"@modelcontextprotocol/client": ">=2.0.0 <3.0.0",
|
|
72
|
+
"ai": ">=7.0.0 <8.0.0"
|
|
54
73
|
},
|
|
55
74
|
"devDependencies": {
|
|
56
|
-
"@modelcontextprotocol/
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"
|
|
63
|
-
|
|
75
|
+
"@modelcontextprotocol/client": "2.4.0",
|
|
76
|
+
"@modelcontextprotocol/node": "2.1.2",
|
|
77
|
+
"@modelcontextprotocol/server": "2.4.0",
|
|
78
|
+
"ai": "7.0.83"
|
|
79
|
+
},
|
|
80
|
+
"peerDependenciesMeta": {
|
|
81
|
+
"ai": {
|
|
82
|
+
"optional": true
|
|
83
|
+
}
|
|
64
84
|
},
|
|
65
85
|
"scripts": {
|
|
66
|
-
"build": "
|
|
86
|
+
"build": "tsdown",
|
|
87
|
+
"build:watch": "tsdown --watch src",
|
|
88
|
+
"typecheck": "tsc -b",
|
|
89
|
+
"lint": "oxlint --type-aware .",
|
|
90
|
+
"lint:fix": "oxlint --type-aware --fix .",
|
|
91
|
+
"format": "prettier --write . --ignore-unknown",
|
|
92
|
+
"format:check": "prettier --check . --ignore-unknown",
|
|
67
93
|
"test": "vitest run",
|
|
68
94
|
"test:watch": "vitest",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
95
|
+
"test:coverage": "vitest run --coverage",
|
|
96
|
+
"smoke:external": "node scripts/external-smoke.mjs",
|
|
97
|
+
"verify:pack": "pnpm run build && publint --strict"
|
|
72
98
|
}
|
|
73
99
|
}
|