@casys/mcp-server 0.26.0 → 0.27.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 +1779 -0
- package/LICENSE +21 -0
- package/README.md +19 -5
- package/esm/_dnt.polyfills.d.ts +12 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -0
- package/esm/_dnt.polyfills.js +15 -0
- package/esm/_dnt.shims.d.ts +2 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +57 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_chars.d.ts +33 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_chars.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_chars.js +48 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_dumper_state.d.ts +106 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_dumper_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_dumper_state.js +636 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_loader_state.d.ts +67 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_loader_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_loader_state.js +1393 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_schema.d.ts +44 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_schema.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_schema.js +117 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/binary.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/binary.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/binary.js +103 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/bool.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/bool.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/bool.js +32 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/float.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/float.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/float.js +96 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/int.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/int.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/int.js +159 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/map.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/map.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/map.js +14 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/merge.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/merge.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/merge.js +10 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/nil.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/nil.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/nil.js +22 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/omap.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/omap.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/omap.js +29 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.js +19 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.js +30 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/seq.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/seq.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/seq.js +10 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/set.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/set.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/set.js +14 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/str.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/str.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/str.js +9 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.js +81 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.js +20 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type.d.ts +32 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type.js +6 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_utils.d.ts +4 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_utils.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_utils.js +13 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/mod.d.ts +51 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/mod.js +53 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/parse.d.ts +79 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/parse.js +91 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/stringify.d.ts +100 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/stringify.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/stringify.js +33 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/types.d.ts +111 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.2.0/types.js +104 -0
- package/esm/mod.d.ts +102 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +103 -0
- package/esm/package.json +3 -0
- package/esm/src/auth/as-metadata-proxy.d.ts +112 -0
- package/esm/src/auth/as-metadata-proxy.d.ts.map +1 -0
- package/esm/src/auth/as-metadata-proxy.js +171 -0
- package/esm/src/auth/config.d.ts +117 -0
- package/esm/src/auth/config.d.ts.map +1 -0
- package/esm/src/auth/config.js +219 -0
- package/esm/src/auth/jwt-provider.d.ts +157 -0
- package/esm/src/auth/jwt-provider.d.ts.map +1 -0
- package/esm/src/auth/jwt-provider.js +187 -0
- package/esm/src/auth/middleware.d.ts +61 -0
- package/esm/src/auth/middleware.d.ts.map +1 -0
- package/esm/src/auth/middleware.js +209 -0
- package/esm/src/auth/mod.d.ts +23 -0
- package/esm/src/auth/mod.d.ts.map +1 -0
- package/esm/src/auth/mod.js +27 -0
- package/esm/src/auth/multi-tenant-middleware.d.ts +131 -0
- package/esm/src/auth/multi-tenant-middleware.d.ts.map +1 -0
- package/esm/src/auth/multi-tenant-middleware.js +128 -0
- package/esm/src/auth/presets.d.ts +231 -0
- package/esm/src/auth/presets.d.ts.map +1 -0
- package/esm/src/auth/presets.js +223 -0
- package/{src/auth/provider.ts → esm/src/auth/provider.d.ts} +13 -15
- package/esm/src/auth/provider.d.ts.map +1 -0
- package/esm/src/auth/provider.js +34 -0
- package/esm/src/auth/scope-middleware.d.ts +30 -0
- package/esm/src/auth/scope-middleware.d.ts.map +1 -0
- package/esm/src/auth/scope-middleware.js +48 -0
- package/esm/src/auth/static-token-provider.d.ts +155 -0
- package/esm/src/auth/static-token-provider.d.ts.map +1 -0
- package/esm/src/auth/static-token-provider.js +256 -0
- package/esm/src/auth/types.d.ts +151 -0
- package/esm/src/auth/types.d.ts.map +1 -0
- package/esm/src/auth/types.js +64 -0
- package/esm/src/client-auth/callback-server.d.ts +34 -0
- package/esm/src/client-auth/callback-server.d.ts.map +1 -0
- package/esm/src/client-auth/callback-server.js +141 -0
- package/esm/src/client-auth/client-id-metadata.d.ts +29 -0
- package/esm/src/client-auth/client-id-metadata.d.ts.map +1 -0
- package/esm/src/client-auth/client-id-metadata.js +149 -0
- package/esm/src/client-auth/connect.d.ts +32 -0
- package/esm/src/client-auth/connect.d.ts.map +1 -0
- package/esm/src/client-auth/connect.js +47 -0
- package/esm/src/client-auth/mod.d.ts +19 -0
- package/esm/src/client-auth/mod.d.ts.map +1 -0
- package/{src/client-auth/mod.ts → esm/src/client-auth/mod.js} +1 -26
- package/esm/src/client-auth/provider.d.ts +78 -0
- package/esm/src/client-auth/provider.d.ts.map +1 -0
- package/esm/src/client-auth/provider.js +246 -0
- package/esm/src/client-auth/token-store/file-store.d.ts +20 -0
- package/esm/src/client-auth/token-store/file-store.d.ts.map +1 -0
- package/esm/src/client-auth/token-store/file-store.js +62 -0
- package/esm/src/client-auth/token-store/memory-store.d.ts +14 -0
- package/esm/src/client-auth/token-store/memory-store.d.ts.map +1 -0
- package/esm/src/client-auth/token-store/memory-store.js +25 -0
- package/esm/src/client-auth/types.d.ts +89 -0
- package/esm/src/client-auth/types.d.ts.map +1 -0
- package/esm/src/client-auth/types.js +10 -0
- package/esm/src/concurrency/rate-limiter.d.ts +87 -0
- package/esm/src/concurrency/rate-limiter.d.ts.map +1 -0
- package/esm/src/concurrency/rate-limiter.js +165 -0
- package/esm/src/concurrency/request-queue.d.ts +71 -0
- package/esm/src/concurrency/request-queue.d.ts.map +1 -0
- package/esm/src/concurrency/request-queue.js +128 -0
- package/esm/src/http/body.d.ts +20 -0
- package/esm/src/http/body.d.ts.map +1 -0
- package/esm/src/http/body.js +63 -0
- package/esm/src/http/request-guards.d.ts +54 -0
- package/esm/src/http/request-guards.d.ts.map +1 -0
- package/esm/src/http/request-guards.js +114 -0
- package/esm/src/http/wire.d.ts +26 -0
- package/esm/src/http/wire.d.ts.map +1 -0
- package/{src/http/wire.ts → esm/src/http/wire.js} +13 -19
- package/esm/src/inspector/launcher.d.ts +48 -0
- package/esm/src/inspector/launcher.d.ts.map +1 -0
- package/esm/src/inspector/launcher.js +100 -0
- package/esm/src/mcp-app.d.ts +728 -0
- package/esm/src/mcp-app.d.ts.map +1 -0
- package/esm/src/mcp-app.js +3530 -0
- package/{src/middleware/backpressure.ts → esm/src/middleware/backpressure.d.ts} +2 -14
- package/esm/src/middleware/backpressure.d.ts.map +1 -0
- package/esm/src/middleware/backpressure.js +31 -0
- package/esm/src/middleware/mod.d.ts +11 -0
- package/esm/src/middleware/mod.d.ts.map +1 -0
- package/{src/middleware/mod.ts → esm/src/middleware/mod.js} +0 -10
- package/{src/middleware/rate-limit.ts → esm/src/middleware/rate-limit.d.ts} +2 -25
- package/esm/src/middleware/rate-limit.d.ts.map +1 -0
- package/esm/src/middleware/rate-limit.js +33 -0
- package/esm/src/middleware/runner.d.ts +32 -0
- package/esm/src/middleware/runner.d.ts.map +1 -0
- package/esm/src/middleware/runner.js +49 -0
- package/esm/src/middleware/types.d.ts +76 -0
- package/esm/src/middleware/types.d.ts.map +1 -0
- package/esm/src/middleware/types.js +9 -0
- package/esm/src/middleware/validation.d.ts +24 -0
- package/esm/src/middleware/validation.d.ts.map +1 -0
- package/esm/src/middleware/validation.js +30 -0
- package/esm/src/mrtr/capability-check.d.ts +75 -0
- package/esm/src/mrtr/capability-check.d.ts.map +1 -0
- package/esm/src/mrtr/capability-check.js +233 -0
- package/esm/src/mrtr/mod.d.ts +18 -0
- package/esm/src/mrtr/mod.d.ts.map +1 -0
- package/esm/src/mrtr/mod.js +12 -0
- package/esm/src/mrtr/replay-store.d.ts +50 -0
- package/esm/src/mrtr/replay-store.d.ts.map +1 -0
- package/esm/src/mrtr/replay-store.js +61 -0
- package/esm/src/mrtr/request-state.d.ts +181 -0
- package/esm/src/mrtr/request-state.d.ts.map +1 -0
- package/esm/src/mrtr/request-state.js +313 -0
- package/esm/src/mrtr/retry-guard.d.ts +61 -0
- package/esm/src/mrtr/retry-guard.d.ts.map +1 -0
- package/esm/src/mrtr/retry-guard.js +53 -0
- package/esm/src/mrtr/types.d.ts +99 -0
- package/esm/src/mrtr/types.d.ts.map +1 -0
- package/esm/src/mrtr/types.js +14 -0
- package/esm/src/observability/metrics.d.ts +104 -0
- package/esm/src/observability/metrics.d.ts.map +1 -0
- package/esm/src/observability/metrics.js +207 -0
- package/{src/observability/mod.ts → esm/src/observability/mod.d.ts} +2 -11
- package/esm/src/observability/mod.d.ts.map +1 -0
- package/esm/src/observability/mod.js +11 -0
- package/esm/src/observability/otel.d.ts +73 -0
- package/esm/src/observability/otel.d.ts.map +1 -0
- package/esm/src/observability/otel.js +260 -0
- package/esm/src/runtime/runtime.d.ts +10 -0
- package/esm/src/runtime/runtime.d.ts.map +1 -0
- package/esm/src/runtime/runtime.deno.d.ts +50 -0
- package/esm/src/runtime/runtime.deno.d.ts.map +1 -0
- package/esm/src/runtime/runtime.deno.js +120 -0
- package/{src/runtime/runtime.ts → esm/src/runtime/runtime.js} +5 -14
- package/esm/src/runtime/runtime.node.d.ts +51 -0
- package/esm/src/runtime/runtime.node.d.ts.map +1 -0
- package/esm/src/runtime/runtime.node.js +268 -0
- package/{src/runtime/types.ts → esm/src/runtime/types.d.ts} +28 -51
- package/esm/src/runtime/types.d.ts.map +1 -0
- package/esm/src/runtime/types.js +12 -0
- package/esm/src/security/channel-hmac.d.ts +43 -0
- package/esm/src/security/channel-hmac.d.ts.map +1 -0
- package/{src/security/channel-hmac.ts → esm/src/security/channel-hmac.js} +12 -17
- package/esm/src/security/csp.d.ts +50 -0
- package/esm/src/security/csp.d.ts.map +1 -0
- package/esm/src/security/csp.js +63 -0
- package/esm/src/security/message-signer.d.ts +88 -0
- package/esm/src/security/message-signer.d.ts.map +1 -0
- package/esm/src/security/message-signer.js +166 -0
- package/esm/src/subscriptions/subscription-registry.d.ts +256 -0
- package/esm/src/subscriptions/subscription-registry.d.ts.map +1 -0
- package/esm/src/subscriptions/subscription-registry.js +406 -0
- package/{src/tasks/mod.ts → esm/src/tasks/mod.d.ts} +3 -23
- package/esm/src/tasks/mod.d.ts.map +1 -0
- package/esm/src/tasks/mod.js +11 -0
- package/esm/src/tasks/task-store.d.ts +342 -0
- package/esm/src/tasks/task-store.d.ts.map +1 -0
- package/esm/src/tasks/task-store.js +649 -0
- package/esm/src/transport/request-headers.d.ts +145 -0
- package/esm/src/transport/request-headers.d.ts.map +1 -0
- package/esm/src/transport/request-headers.js +525 -0
- package/esm/src/types.d.ts +776 -0
- package/esm/src/types.d.ts.map +1 -0
- package/esm/src/types.js +92 -0
- package/esm/src/ui/viewer-utils.d.ts +45 -0
- package/esm/src/ui/viewer-utils.d.ts.map +1 -0
- package/esm/src/ui/viewer-utils.js +97 -0
- package/esm/src/validation/schema-validator.d.ts +115 -0
- package/esm/src/validation/schema-validator.d.ts.map +1 -0
- package/esm/src/validation/schema-validator.js +249 -0
- package/package.json +35 -23
- package/mod.ts +0 -302
- package/src/auth/as-metadata-proxy.ts +0 -288
- package/src/auth/config.ts +0 -368
- package/src/auth/jwt-provider.ts +0 -327
- package/src/auth/middleware.ts +0 -257
- package/src/auth/mod.ts +0 -89
- package/src/auth/multi-tenant-middleware.ts +0 -236
- package/src/auth/presets.ts +0 -351
- package/src/auth/scope-middleware.ts +0 -59
- package/src/auth/static-token-provider.ts +0 -197
- package/src/auth/types.ts +0 -207
- package/src/client-auth/callback-server.ts +0 -166
- package/src/client-auth/client-id-metadata.ts +0 -260
- package/src/client-auth/connect.ts +0 -72
- package/src/client-auth/provider.ts +0 -300
- package/src/client-auth/token-store/file-store.ts +0 -73
- package/src/client-auth/token-store/memory-store.ts +0 -32
- package/src/client-auth/types.ts +0 -95
- package/src/concurrency/rate-limiter.ts +0 -190
- package/src/concurrency/request-queue.ts +0 -140
- package/src/http/body.ts +0 -72
- package/src/http/request-guards.ts +0 -137
- package/src/inspector/launcher.ts +0 -131
- package/src/mcp-app.ts +0 -4426
- package/src/middleware/runner.ts +0 -63
- package/src/middleware/types.ts +0 -104
- package/src/middleware/validation.ts +0 -28
- package/src/mrtr/capability-check.ts +0 -303
- package/src/mrtr/mod.ts +0 -46
- package/src/mrtr/replay-store.ts +0 -103
- package/src/mrtr/request-state.ts +0 -435
- package/src/mrtr/types.ts +0 -107
- package/src/observability/metrics.ts +0 -336
- package/src/observability/otel.ts +0 -330
- package/src/runtime/runtime.deno.ts +0 -149
- package/src/runtime/runtime.node.ts +0 -324
- package/src/security/csp.ts +0 -89
- package/src/security/message-signer.ts +0 -223
- package/src/subscriptions/subscription-registry.ts +0 -558
- package/src/tasks/task-store.ts +0 -1014
- package/src/testdata/stdio-e2e-server.ts +0 -110
- package/src/transport/request-headers.ts +0 -661
- package/src/types.ts +0 -907
- package/src/ui/viewer-utils.ts +0 -117
- package/src/validation/schema-validator.ts +0 -307
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { type SchemaType } from "./_schema.js";
|
|
2
|
+
import type { StyleVariant } from "./_type.js";
|
|
3
|
+
export type { SchemaType, StyleVariant };
|
|
4
|
+
/** Options for {@linkcode stringify}. */
|
|
5
|
+
export type StringifyOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* Indentation width to use (in spaces).
|
|
8
|
+
*
|
|
9
|
+
* @default {2}
|
|
10
|
+
*/
|
|
11
|
+
indent?: number;
|
|
12
|
+
/**
|
|
13
|
+
* When true, adds an indentation level to array elements.
|
|
14
|
+
*
|
|
15
|
+
* @default {true}
|
|
16
|
+
*/
|
|
17
|
+
arrayIndent?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Do not throw on invalid types (like function in the safe schema) and skip
|
|
20
|
+
* pairs and single values with such types.
|
|
21
|
+
*
|
|
22
|
+
* @default {false}
|
|
23
|
+
*/
|
|
24
|
+
skipInvalid?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Specifies level of nesting, when to switch from block to flow style for
|
|
27
|
+
* collections. `-1` means block style everywhere.
|
|
28
|
+
*
|
|
29
|
+
* @default {-1}
|
|
30
|
+
*/
|
|
31
|
+
flowLevel?: number;
|
|
32
|
+
/** Each tag may have own set of styles. - "tag" => "style" map. */
|
|
33
|
+
styles?: Record<string, StyleVariant>;
|
|
34
|
+
/**
|
|
35
|
+
* Name of the schema to use.
|
|
36
|
+
*
|
|
37
|
+
* @default {"default"}
|
|
38
|
+
*/
|
|
39
|
+
schema?: SchemaType;
|
|
40
|
+
/**
|
|
41
|
+
* If true, sort keys when dumping YAML in ascending, ASCII character order.
|
|
42
|
+
* If a function, use the function to sort the keys.
|
|
43
|
+
* If a function is specified, the function must return a negative value
|
|
44
|
+
* if first argument is less than second argument, zero if they're equal
|
|
45
|
+
* and a positive value otherwise.
|
|
46
|
+
*
|
|
47
|
+
* @default {false}
|
|
48
|
+
*/
|
|
49
|
+
sortKeys?: boolean | ((a: string, b: string, depth: number) => number);
|
|
50
|
+
/**
|
|
51
|
+
* Set max line width.
|
|
52
|
+
*
|
|
53
|
+
* @default {80}
|
|
54
|
+
*/
|
|
55
|
+
lineWidth?: number;
|
|
56
|
+
/**
|
|
57
|
+
* If false, don't convert duplicate objects into references.
|
|
58
|
+
*
|
|
59
|
+
* @default {true}
|
|
60
|
+
*/
|
|
61
|
+
useAnchors?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* If false don't try to be compatible with older yaml versions.
|
|
64
|
+
* Currently: don't quote "yes", "no" and so on,
|
|
65
|
+
* as required for YAML 1.1.
|
|
66
|
+
*
|
|
67
|
+
* @default {true}
|
|
68
|
+
*/
|
|
69
|
+
compatMode?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* If true flow sequences will be condensed, omitting the
|
|
72
|
+
* space between `key: value` or `a, b`. Eg. `'[a,b]'` or `{a:{b:c}}`.
|
|
73
|
+
* Can be useful when using yaml for pretty URL query params
|
|
74
|
+
* as spaces are %-encoded.
|
|
75
|
+
*
|
|
76
|
+
* @default {false}
|
|
77
|
+
*/
|
|
78
|
+
condenseFlow?: boolean;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Converts a JavaScript object or value to a YAML document string.
|
|
82
|
+
*
|
|
83
|
+
* @example Usage
|
|
84
|
+
* ```ts
|
|
85
|
+
* import { stringify } from "@std/yaml/stringify";
|
|
86
|
+
* import { assertEquals } from "@std/assert";
|
|
87
|
+
*
|
|
88
|
+
* const data = { id: 1, name: "Alice" };
|
|
89
|
+
* const yaml = stringify(data);
|
|
90
|
+
*
|
|
91
|
+
* assertEquals(yaml, "id: 1\nname: Alice\n");
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* @throws {TypeError} If `data` contains invalid types.
|
|
95
|
+
* @param data The data to serialize.
|
|
96
|
+
* @param options The options for serialization.
|
|
97
|
+
* @returns A YAML string.
|
|
98
|
+
*/
|
|
99
|
+
export declare function stringify(data: unknown, options?: StringifyOptions): string;
|
|
100
|
+
//# sourceMappingURL=stringify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringify.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/yaml/1.2.0/stringify.ts"],"names":[],"mappings":"AAOA,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;AAEzC,yCAAyC;AACzC,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACtC;;;;OAIG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IACvE;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,OAAO,EACb,OAAO,GAAE,gBAAqB,GAC7B,MAAM,CAMR"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Ported from js-yaml v3.13.1:
|
|
2
|
+
// https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
|
|
3
|
+
// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
|
|
4
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
5
|
+
// This module is browser compatible.
|
|
6
|
+
import { DumperState } from "./_dumper_state.js";
|
|
7
|
+
import { SCHEMA_MAP } from "./_schema.js";
|
|
8
|
+
/**
|
|
9
|
+
* Converts a JavaScript object or value to a YAML document string.
|
|
10
|
+
*
|
|
11
|
+
* @example Usage
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { stringify } from "@std/yaml/stringify";
|
|
14
|
+
* import { assertEquals } from "@std/assert";
|
|
15
|
+
*
|
|
16
|
+
* const data = { id: 1, name: "Alice" };
|
|
17
|
+
* const yaml = stringify(data);
|
|
18
|
+
*
|
|
19
|
+
* assertEquals(yaml, "id: 1\nname: Alice\n");
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @throws {TypeError} If `data` contains invalid types.
|
|
23
|
+
* @param data The data to serialize.
|
|
24
|
+
* @param options The options for serialization.
|
|
25
|
+
* @returns A YAML string.
|
|
26
|
+
*/
|
|
27
|
+
export function stringify(data, options = {}) {
|
|
28
|
+
const state = new DumperState({
|
|
29
|
+
...options,
|
|
30
|
+
schema: SCHEMA_MAP.get(options.schema),
|
|
31
|
+
});
|
|
32
|
+
return state.stringify(data);
|
|
33
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the YAML parser.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Position information for error reporting.
|
|
8
|
+
*
|
|
9
|
+
* `line` and `column` are 1-indexed; `offset` is the 0-indexed character
|
|
10
|
+
* offset into the source string.
|
|
11
|
+
*/
|
|
12
|
+
export interface YamlPosition {
|
|
13
|
+
/** Line number (1-indexed). */
|
|
14
|
+
readonly line: number;
|
|
15
|
+
/** Column number (1-indexed). */
|
|
16
|
+
readonly column: number;
|
|
17
|
+
/** Character offset in the input (0-indexed). */
|
|
18
|
+
readonly offset: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Error thrown when YAML parsing fails.
|
|
22
|
+
*
|
|
23
|
+
* Subclass of {@linkcode SyntaxError}, so existing
|
|
24
|
+
* `instanceof SyntaxError` checks keep working. Carries structured
|
|
25
|
+
* position information so consumers do not have to parse the message.
|
|
26
|
+
*
|
|
27
|
+
* @example Usage
|
|
28
|
+
* ```ts
|
|
29
|
+
* import { parse, YamlSyntaxError } from "@std/yaml";
|
|
30
|
+
* import { assertInstanceOf } from "@std/assert";
|
|
31
|
+
*
|
|
32
|
+
* try {
|
|
33
|
+
* parse(`"`);
|
|
34
|
+
* } catch (error) {
|
|
35
|
+
* assertInstanceOf(error, YamlSyntaxError);
|
|
36
|
+
* assertInstanceOf(error, SyntaxError);
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare class YamlSyntaxError extends SyntaxError {
|
|
41
|
+
/**
|
|
42
|
+
* The line number where the error occurred (1-indexed).
|
|
43
|
+
*
|
|
44
|
+
* @example Usage
|
|
45
|
+
* ```ts
|
|
46
|
+
* import { YamlSyntaxError } from "@std/yaml";
|
|
47
|
+
* import { assertEquals } from "@std/assert";
|
|
48
|
+
*
|
|
49
|
+
* const error = new YamlSyntaxError("Test", { line: 5, column: 10, offset: 50 });
|
|
50
|
+
* assertEquals(error.line, 5);
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
readonly line: number;
|
|
54
|
+
/**
|
|
55
|
+
* The column number where the error occurred (1-indexed).
|
|
56
|
+
*
|
|
57
|
+
* @example Usage
|
|
58
|
+
* ```ts
|
|
59
|
+
* import { YamlSyntaxError } from "@std/yaml";
|
|
60
|
+
* import { assertEquals } from "@std/assert";
|
|
61
|
+
*
|
|
62
|
+
* const error = new YamlSyntaxError("Test", { line: 5, column: 10, offset: 50 });
|
|
63
|
+
* assertEquals(error.column, 10);
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
readonly column: number;
|
|
67
|
+
/**
|
|
68
|
+
* The character offset where the error occurred (0-indexed).
|
|
69
|
+
*
|
|
70
|
+
* @example Usage
|
|
71
|
+
* ```ts
|
|
72
|
+
* import { YamlSyntaxError } from "@std/yaml";
|
|
73
|
+
* import { assertEquals } from "@std/assert";
|
|
74
|
+
*
|
|
75
|
+
* const error = new YamlSyntaxError("Test", { line: 5, column: 10, offset: 50 });
|
|
76
|
+
* assertEquals(error.offset, 50);
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
readonly offset: number;
|
|
80
|
+
/**
|
|
81
|
+
* A formatted snippet of the source around the error, including a caret
|
|
82
|
+
* line indicating the column. Undefined when the source is empty.
|
|
83
|
+
*
|
|
84
|
+
* @example Usage
|
|
85
|
+
* ```ts
|
|
86
|
+
* import { YamlSyntaxError } from "@std/yaml";
|
|
87
|
+
* import { assertEquals } from "@std/assert";
|
|
88
|
+
*
|
|
89
|
+
* const snippet = " foo: bar\n ^";
|
|
90
|
+
* const error = new YamlSyntaxError(
|
|
91
|
+
* "Test",
|
|
92
|
+
* { line: 1, column: 6, offset: 5 },
|
|
93
|
+
* snippet,
|
|
94
|
+
* );
|
|
95
|
+
* assertEquals(error.snippet, snippet);
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
readonly snippet?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Constructs a new YamlSyntaxError.
|
|
101
|
+
*
|
|
102
|
+
* The constructed `message` is `${message} at line ${line}, column ${column}`,
|
|
103
|
+
* with `:\n${snippet}` appended when a snippet is provided.
|
|
104
|
+
*
|
|
105
|
+
* @param message The error message describing the syntax issue.
|
|
106
|
+
* @param position The position in the YAML source where the error occurred.
|
|
107
|
+
* @param snippet Optional formatted snippet of the source around the error.
|
|
108
|
+
*/
|
|
109
|
+
constructor(message: string, position: YamlPosition, snippet?: string);
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/yaml/1.2.0/types.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,eAAgB,SAAQ,WAAW;IAC9C;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;;;;;;OASG;gBACS,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,MAAM;CAWtE"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
/**
|
|
4
|
+
* Error thrown when YAML parsing fails.
|
|
5
|
+
*
|
|
6
|
+
* Subclass of {@linkcode SyntaxError}, so existing
|
|
7
|
+
* `instanceof SyntaxError` checks keep working. Carries structured
|
|
8
|
+
* position information so consumers do not have to parse the message.
|
|
9
|
+
*
|
|
10
|
+
* @example Usage
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { parse, YamlSyntaxError } from "@std/yaml";
|
|
13
|
+
* import { assertInstanceOf } from "@std/assert";
|
|
14
|
+
*
|
|
15
|
+
* try {
|
|
16
|
+
* parse(`"`);
|
|
17
|
+
* } catch (error) {
|
|
18
|
+
* assertInstanceOf(error, YamlSyntaxError);
|
|
19
|
+
* assertInstanceOf(error, SyntaxError);
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export class YamlSyntaxError extends SyntaxError {
|
|
24
|
+
/**
|
|
25
|
+
* The line number where the error occurred (1-indexed).
|
|
26
|
+
*
|
|
27
|
+
* @example Usage
|
|
28
|
+
* ```ts
|
|
29
|
+
* import { YamlSyntaxError } from "@std/yaml";
|
|
30
|
+
* import { assertEquals } from "@std/assert";
|
|
31
|
+
*
|
|
32
|
+
* const error = new YamlSyntaxError("Test", { line: 5, column: 10, offset: 50 });
|
|
33
|
+
* assertEquals(error.line, 5);
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
line;
|
|
37
|
+
/**
|
|
38
|
+
* The column number where the error occurred (1-indexed).
|
|
39
|
+
*
|
|
40
|
+
* @example Usage
|
|
41
|
+
* ```ts
|
|
42
|
+
* import { YamlSyntaxError } from "@std/yaml";
|
|
43
|
+
* import { assertEquals } from "@std/assert";
|
|
44
|
+
*
|
|
45
|
+
* const error = new YamlSyntaxError("Test", { line: 5, column: 10, offset: 50 });
|
|
46
|
+
* assertEquals(error.column, 10);
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
column;
|
|
50
|
+
/**
|
|
51
|
+
* The character offset where the error occurred (0-indexed).
|
|
52
|
+
*
|
|
53
|
+
* @example Usage
|
|
54
|
+
* ```ts
|
|
55
|
+
* import { YamlSyntaxError } from "@std/yaml";
|
|
56
|
+
* import { assertEquals } from "@std/assert";
|
|
57
|
+
*
|
|
58
|
+
* const error = new YamlSyntaxError("Test", { line: 5, column: 10, offset: 50 });
|
|
59
|
+
* assertEquals(error.offset, 50);
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
offset;
|
|
63
|
+
/**
|
|
64
|
+
* A formatted snippet of the source around the error, including a caret
|
|
65
|
+
* line indicating the column. Undefined when the source is empty.
|
|
66
|
+
*
|
|
67
|
+
* @example Usage
|
|
68
|
+
* ```ts
|
|
69
|
+
* import { YamlSyntaxError } from "@std/yaml";
|
|
70
|
+
* import { assertEquals } from "@std/assert";
|
|
71
|
+
*
|
|
72
|
+
* const snippet = " foo: bar\n ^";
|
|
73
|
+
* const error = new YamlSyntaxError(
|
|
74
|
+
* "Test",
|
|
75
|
+
* { line: 1, column: 6, offset: 5 },
|
|
76
|
+
* snippet,
|
|
77
|
+
* );
|
|
78
|
+
* assertEquals(error.snippet, snippet);
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
snippet;
|
|
82
|
+
/**
|
|
83
|
+
* Constructs a new YamlSyntaxError.
|
|
84
|
+
*
|
|
85
|
+
* The constructed `message` is `${message} at line ${line}, column ${column}`,
|
|
86
|
+
* with `:\n${snippet}` appended when a snippet is provided.
|
|
87
|
+
*
|
|
88
|
+
* @param message The error message describing the syntax issue.
|
|
89
|
+
* @param position The position in the YAML source where the error occurred.
|
|
90
|
+
* @param snippet Optional formatted snippet of the source around the error.
|
|
91
|
+
*/
|
|
92
|
+
constructor(message, position, snippet) {
|
|
93
|
+
let fullMessage = `${message} at line ${position.line}, column ${position.column}`;
|
|
94
|
+
if (snippet)
|
|
95
|
+
fullMessage += `:\n${snippet}`;
|
|
96
|
+
super(fullMessage);
|
|
97
|
+
this.name = "YamlSyntaxError";
|
|
98
|
+
this.line = position.line;
|
|
99
|
+
this.column = position.column;
|
|
100
|
+
this.offset = position.offset;
|
|
101
|
+
if (snippet !== undefined)
|
|
102
|
+
this.snippet = snippet;
|
|
103
|
+
}
|
|
104
|
+
}
|
package/esm/mod.d.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @casys/mcp-server — Hono-style framework for MCP servers
|
|
3
|
+
*
|
|
4
|
+
* Production-ready MCP server framework with built-in middleware pipeline,
|
|
5
|
+
* auth, concurrency control, backpressure, and observability.
|
|
6
|
+
*
|
|
7
|
+
* Built on top of the official @modelcontextprotocol/sdk.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { McpApp } from "@casys/mcp-server";
|
|
12
|
+
*
|
|
13
|
+
* const app = new McpApp({
|
|
14
|
+
* name: "my-server",
|
|
15
|
+
* version: "1.0.0",
|
|
16
|
+
* maxConcurrent: 10,
|
|
17
|
+
* backpressureStrategy: 'queue'
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* app.registerTool(
|
|
21
|
+
* { name: "greet", description: "Greet someone", inputSchema: { type: "object" } },
|
|
22
|
+
* (args) => `Hello, ${args.name}!`,
|
|
23
|
+
* );
|
|
24
|
+
*
|
|
25
|
+
* // STDIO transport
|
|
26
|
+
* await app.start();
|
|
27
|
+
*
|
|
28
|
+
* // — or — HTTP transport with security-first defaults
|
|
29
|
+
* const http = await app.startHttp({
|
|
30
|
+
* port: 3000,
|
|
31
|
+
* maxBodyBytes: 1_048_576, // 1 MB (default)
|
|
32
|
+
* corsOrigins: ["https://app.example.com"], // allowlist
|
|
33
|
+
* requireAuth: true, // fail-fast without auth
|
|
34
|
+
* ipRateLimit: { maxRequests: 60, windowMs: 60_000 },
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @module @casys/mcp-server
|
|
39
|
+
*/
|
|
40
|
+
import "./_dnt.polyfills.js";
|
|
41
|
+
export { McpApp } from "./src/mcp-app.js";
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated Use {@link McpApp} instead. `ConcurrentMCPServer` is kept as
|
|
44
|
+
* a re-export for backwards compatibility and will be removed in v1.0.
|
|
45
|
+
*
|
|
46
|
+
* Both names point to the exact same class — `McpApp === ConcurrentMCPServer`
|
|
47
|
+
* is true at runtime, and `instanceof` checks pass in both directions.
|
|
48
|
+
* Migration is a one-line import swap.
|
|
49
|
+
*/
|
|
50
|
+
export { McpApp as ConcurrentMCPServer } from "./src/mcp-app.js";
|
|
51
|
+
export { RequestQueue } from "./src/concurrency/request-queue.js";
|
|
52
|
+
export { RateLimiter } from "./src/concurrency/rate-limiter.js";
|
|
53
|
+
export { SchemaValidator } from "./src/validation/schema-validator.js";
|
|
54
|
+
export type { CompiledSchemaValidator, ValidationError, ValidationResult, } from "./src/validation/schema-validator.js";
|
|
55
|
+
export type { BlobResourceContent, HttpRateLimitContext, HttpRateLimitOptions, HttpServerInstance, HttpServerOptions, McpAppOptions, MCPResource, MCPTool, MCPToolMeta, McpUiToolMeta, QueueMetrics, RateLimitContext, RateLimitOptions, ResourceContent, ResourceHandler, SamplingClient, SamplingParams, SamplingResult, StructuredToolResult, TextResourceContent, ToolAnnotations, ToolErrorMapper, ToolHandler, ToolHandlerContext, } from "./src/types.js";
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated Use {@link McpAppOptions} instead. `ConcurrentServerOptions`
|
|
58
|
+
* is kept as a re-export for backwards compatibility and will be removed
|
|
59
|
+
* in v1.0.
|
|
60
|
+
*/
|
|
61
|
+
export type { McpAppOptions as ConcurrentServerOptions } from "./src/types.js";
|
|
62
|
+
export { MCP_APP_MIME_TYPE, MCP_APPS_EXTENSION_ID, MCP_APPS_PROTOCOL_VERSION, } from "./src/types.js";
|
|
63
|
+
export { getMcpAppsCapability } from "./src/types.js";
|
|
64
|
+
export type { McpAppsClientCapability } from "./src/types.js";
|
|
65
|
+
export type { RegisterViewersConfig, RegisterViewersSummary, } from "./src/mcp-app.js";
|
|
66
|
+
export { discoverViewers, resolveViewerDistPath, } from "./src/ui/viewer-utils.js";
|
|
67
|
+
export type { Middleware, MiddlewareContext, MiddlewareResult, NextFunction, } from "./src/middleware/mod.js";
|
|
68
|
+
export { createMiddlewareRunner } from "./src/middleware/mod.js";
|
|
69
|
+
export { AuthProvider } from "./src/auth/mod.js";
|
|
70
|
+
export { AuthError, createAuthMiddleware, createForbiddenResponse, createUnauthorizedResponse, extractBearerToken, } from "./src/auth/mod.js";
|
|
71
|
+
export { createScopeMiddleware } from "./src/auth/mod.js";
|
|
72
|
+
export type { AuthInfo, AuthOptions, ProtectedResourceMetadata, } from "./src/auth/mod.js";
|
|
73
|
+
export { createMultiTenantMiddleware } from "./src/auth/mod.js";
|
|
74
|
+
export type { MultiTenantMiddlewareOptions, TenantResolution, TenantResolver, } from "./src/auth/mod.js";
|
|
75
|
+
export { JwtAuthProvider } from "./src/auth/mod.js";
|
|
76
|
+
export type { JwtAuthProviderOptions } from "./src/auth/mod.js";
|
|
77
|
+
export { createAuth0AuthProvider, createGitHubAuthProvider, createGoogleAuthProvider, createOIDCAuthProvider, } from "./src/auth/mod.js";
|
|
78
|
+
export type { PresetOptions } from "./src/auth/mod.js";
|
|
79
|
+
export { createAsMetadataHandler } from "./src/auth/mod.js";
|
|
80
|
+
export type { AsMetadataProxyOptions } from "./src/auth/mod.js";
|
|
81
|
+
export { createAuthProviderFromConfig, loadAuthConfig, } from "./src/auth/mod.js";
|
|
82
|
+
export type { AuthConfig, AuthProviderName } from "./src/auth/mod.js";
|
|
83
|
+
export { createStaticTokenAuthProvider, StaticTokenAuthProvider, } from "./src/auth/mod.js";
|
|
84
|
+
export type { StaticTokenAuthProviderOptions, StaticTokenCredential, } from "./src/auth/mod.js";
|
|
85
|
+
export { buildClientIdMetadataDocument, CallbackServer, CimdConfigError, FileTokenStore, isCimdConfig, MemoryTokenStore, OAuthClientProviderImpl, prepareOAuthProvider, } from "./src/client-auth/mod.js";
|
|
86
|
+
export type { CallbackServerOptions, CimdClientConfig, CimdConfigErrorCode, ClientIdMetadataDocument, OAuthClientConfig, OAuthClientConfigBase, PrepareOAuthResult, StaticClientConfig, StoredCredentials, TokenStore, } from "./src/client-auth/mod.js";
|
|
87
|
+
export { endToolCallSpan, getServerTracer, isOtelEnabled, recordAuthEvent, ServerMetrics, type ServerMetricsSnapshot, startToolCallSpan, type ToolCallSpanAttributes, } from "./src/observability/mod.js";
|
|
88
|
+
export { buildCspHeader, injectCspMetaTag } from "./src/security/csp.js";
|
|
89
|
+
export type { CspOptions } from "./src/security/csp.js";
|
|
90
|
+
export { injectChannelAuth } from "./src/security/channel-hmac.js";
|
|
91
|
+
export { MessageSigner } from "./src/security/message-signer.js";
|
|
92
|
+
export type { SignedMessage, VerifyResult, } from "./src/security/message-signer.js";
|
|
93
|
+
export type { FetchHandler, RuntimePort, ServeHandle, ServeOptions, } from "./src/runtime/types.js";
|
|
94
|
+
export { launchInspector } from "./src/inspector/launcher.js";
|
|
95
|
+
export type { InspectorOptions } from "./src/inspector/launcher.js";
|
|
96
|
+
export { createTask } from "./src/tasks/mod.js";
|
|
97
|
+
export type { AsyncTaskDescriptor, DetailedTask, Task, TaskController, TaskStoreOptions, } from "./src/tasks/mod.js";
|
|
98
|
+
export type { InputRequestEntry, InputRequestMethod, InputRequiredSignal, MemoryMrtrReplayStoreOptions, MrtrOptions, MrtrReplayStore, } from "./src/mrtr/mod.js";
|
|
99
|
+
export { exportStateKey, generateStateKey, MemoryMrtrReplayStore, sealRequestState, verifyRequestState, } from "./src/mrtr/mod.js";
|
|
100
|
+
export { SubscriptionRegistry } from "./src/subscriptions/subscription-registry.js";
|
|
101
|
+
export type { SubscriptionFilter, SubscriptionRegistryOptions, SubscriptionSink, } from "./src/subscriptions/subscription-registry.js";
|
|
102
|
+
//# sourceMappingURL=mod.d.ts.map
|
package/esm/mod.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"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"}
|
package/esm/mod.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @casys/mcp-server — Hono-style framework for MCP servers
|
|
3
|
+
*
|
|
4
|
+
* Production-ready MCP server framework with built-in middleware pipeline,
|
|
5
|
+
* auth, concurrency control, backpressure, and observability.
|
|
6
|
+
*
|
|
7
|
+
* Built on top of the official @modelcontextprotocol/sdk.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { McpApp } from "@casys/mcp-server";
|
|
12
|
+
*
|
|
13
|
+
* const app = new McpApp({
|
|
14
|
+
* name: "my-server",
|
|
15
|
+
* version: "1.0.0",
|
|
16
|
+
* maxConcurrent: 10,
|
|
17
|
+
* backpressureStrategy: 'queue'
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* app.registerTool(
|
|
21
|
+
* { name: "greet", description: "Greet someone", inputSchema: { type: "object" } },
|
|
22
|
+
* (args) => `Hello, ${args.name}!`,
|
|
23
|
+
* );
|
|
24
|
+
*
|
|
25
|
+
* // STDIO transport
|
|
26
|
+
* await app.start();
|
|
27
|
+
*
|
|
28
|
+
* // — or — HTTP transport with security-first defaults
|
|
29
|
+
* const http = await app.startHttp({
|
|
30
|
+
* port: 3000,
|
|
31
|
+
* maxBodyBytes: 1_048_576, // 1 MB (default)
|
|
32
|
+
* corsOrigins: ["https://app.example.com"], // allowlist
|
|
33
|
+
* requireAuth: true, // fail-fast without auth
|
|
34
|
+
* ipRateLimit: { maxRequests: 60, windowMs: 60_000 },
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @module @casys/mcp-server
|
|
39
|
+
*/
|
|
40
|
+
// Main server class — canonical name
|
|
41
|
+
import "./_dnt.polyfills.js";
|
|
42
|
+
export { McpApp } from "./src/mcp-app.js";
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated Use {@link McpApp} instead. `ConcurrentMCPServer` is kept as
|
|
45
|
+
* a re-export for backwards compatibility and will be removed in v1.0.
|
|
46
|
+
*
|
|
47
|
+
* Both names point to the exact same class — `McpApp === ConcurrentMCPServer`
|
|
48
|
+
* is true at runtime, and `instanceof` checks pass in both directions.
|
|
49
|
+
* Migration is a one-line import swap.
|
|
50
|
+
*/
|
|
51
|
+
export { McpApp as ConcurrentMCPServer } from "./src/mcp-app.js";
|
|
52
|
+
// Concurrency primitives
|
|
53
|
+
export { RequestQueue } from "./src/concurrency/request-queue.js";
|
|
54
|
+
// Rate limiting
|
|
55
|
+
export { RateLimiter } from "./src/concurrency/rate-limiter.js";
|
|
56
|
+
// Schema validation
|
|
57
|
+
export { SchemaValidator } from "./src/validation/schema-validator.js";
|
|
58
|
+
// MCP Apps constants & viewer utilities
|
|
59
|
+
export { MCP_APP_MIME_TYPE, MCP_APPS_EXTENSION_ID, MCP_APPS_PROTOCOL_VERSION, } from "./src/types.js";
|
|
60
|
+
// MCP Apps capability negotiation (per ext-apps spec 2026-01-26 + SDK 1.29 extensions)
|
|
61
|
+
export { getMcpAppsCapability } from "./src/types.js";
|
|
62
|
+
export { discoverViewers, resolveViewerDistPath, } from "./src/ui/viewer-utils.js";
|
|
63
|
+
export { createMiddlewareRunner } from "./src/middleware/mod.js";
|
|
64
|
+
// Auth - Core
|
|
65
|
+
export { AuthProvider } from "./src/auth/mod.js";
|
|
66
|
+
export { AuthError, createAuthMiddleware, createForbiddenResponse, createUnauthorizedResponse, extractBearerToken, } from "./src/auth/mod.js";
|
|
67
|
+
export { createScopeMiddleware } from "./src/auth/mod.js";
|
|
68
|
+
// Auth - Multi-tenant resolution
|
|
69
|
+
export { createMultiTenantMiddleware } from "./src/auth/mod.js";
|
|
70
|
+
// Auth - JWT Provider + Presets
|
|
71
|
+
export { JwtAuthProvider } from "./src/auth/mod.js";
|
|
72
|
+
export { createAuth0AuthProvider, createGitHubAuthProvider, createGoogleAuthProvider, createOIDCAuthProvider, } from "./src/auth/mod.js";
|
|
73
|
+
// Auth - AS Metadata Proxy (DCR discovery for IdPs without native RFC 7591)
|
|
74
|
+
export { createAsMetadataHandler } from "./src/auth/mod.js";
|
|
75
|
+
// Auth - Config (YAML + env)
|
|
76
|
+
export { createAuthProviderFromConfig, loadAuthConfig, } from "./src/auth/mod.js";
|
|
77
|
+
// Auth - Static Token Provider (opaque pre-shared bearer tokens)
|
|
78
|
+
export { createStaticTokenAuthProvider, StaticTokenAuthProvider, } from "./src/auth/mod.js";
|
|
79
|
+
// Client Auth — OAuth client flow + CIMD
|
|
80
|
+
export { buildClientIdMetadataDocument, CallbackServer, CimdConfigError, FileTokenStore, isCimdConfig, MemoryTokenStore, OAuthClientProviderImpl, prepareOAuthProvider, } from "./src/client-auth/mod.js";
|
|
81
|
+
// Observability
|
|
82
|
+
export { endToolCallSpan, getServerTracer, isOtelEnabled, recordAuthEvent, ServerMetrics, startToolCallSpan, } from "./src/observability/mod.js";
|
|
83
|
+
// Security - CSP utilities
|
|
84
|
+
export { buildCspHeader, injectCspMetaTag } from "./src/security/csp.js";
|
|
85
|
+
// Security - HMAC channel authentication for PostMessage (MCP Apps)
|
|
86
|
+
export { injectChannelAuth } from "./src/security/channel-hmac.js";
|
|
87
|
+
export { MessageSigner } from "./src/security/message-signer.js";
|
|
88
|
+
// Inspector — launch the MCP Inspector for interactive debugging
|
|
89
|
+
export { launchInspector } from "./src/inspector/launcher.js";
|
|
90
|
+
// ── Spec 2026-07-28 features ─────────────────────────────────────────────────
|
|
91
|
+
// Tasks extension (io.modelcontextprotocol/tasks, SEP-2663).
|
|
92
|
+
//
|
|
93
|
+
// `createTask` is what a tool handler returns to opt into async-task mode, so it
|
|
94
|
+
// has to be reachable from the package root — without it the extension is wired
|
|
95
|
+
// but unusable by any consumer.
|
|
96
|
+
export { createTask } from "./src/tasks/mod.js";
|
|
97
|
+
export { exportStateKey, generateStateKey, MemoryMrtrReplayStore, sealRequestState, verifyRequestState, } from "./src/mrtr/mod.js";
|
|
98
|
+
// subscriptions/listen (SEP-2575).
|
|
99
|
+
//
|
|
100
|
+
// The registry is owned by McpApp; these are exported for consumers driving their
|
|
101
|
+
// own streams, and for the filter type used when narrowing what a deployment
|
|
102
|
+
// delivers.
|
|
103
|
+
export { SubscriptionRegistry } from "./src/subscriptions/subscription-registry.js";
|
package/esm/package.json
ADDED