@casys/mcp-server 0.27.0 → 0.27.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/CHANGELOG.md +18 -1764
- package/README.md +21 -631
- package/esm/mod.d.ts +1 -102
- package/esm/mod.js +1 -103
- package/package.json +17 -25
- package/esm/_dnt.polyfills.d.ts +0 -12
- package/esm/_dnt.polyfills.d.ts.map +0 -1
- package/esm/_dnt.polyfills.js +0 -15
- package/esm/_dnt.shims.d.ts +0 -2
- package/esm/_dnt.shims.d.ts.map +0 -1
- package/esm/_dnt.shims.js +0 -57
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_chars.d.ts +0 -33
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_chars.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_chars.js +0 -48
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_dumper_state.d.ts +0 -106
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_dumper_state.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_dumper_state.js +0 -636
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_loader_state.d.ts +0 -67
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_loader_state.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_loader_state.js +0 -1393
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_schema.d.ts +0 -44
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_schema.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_schema.js +0 -117
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/binary.d.ts +0 -3
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/binary.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/binary.js +0 -103
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/bool.d.ts +0 -3
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/bool.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/bool.js +0 -32
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/float.d.ts +0 -3
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/float.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/float.js +0 -96
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/int.d.ts +0 -3
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/int.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/int.js +0 -159
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/map.d.ts +0 -3
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/map.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/map.js +0 -14
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/merge.d.ts +0 -3
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/merge.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/merge.js +0 -10
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/nil.d.ts +0 -3
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/nil.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/nil.js +0 -22
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/omap.d.ts +0 -3
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/omap.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/omap.js +0 -29
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.d.ts +0 -3
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.js +0 -19
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.d.ts +0 -3
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.js +0 -30
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/seq.d.ts +0 -3
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/seq.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/seq.js +0 -10
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/set.d.ts +0 -3
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/set.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/set.js +0 -14
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/str.d.ts +0 -3
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/str.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/str.js +0 -9
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.d.ts +0 -3
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.js +0 -81
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.d.ts +0 -3
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.js +0 -20
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type.d.ts +0 -32
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_type.js +0 -6
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_utils.d.ts +0 -4
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_utils.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/_utils.js +0 -13
- package/esm/deps/jsr.io/@std/yaml/1.2.0/mod.d.ts +0 -51
- package/esm/deps/jsr.io/@std/yaml/1.2.0/mod.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/mod.js +0 -53
- package/esm/deps/jsr.io/@std/yaml/1.2.0/parse.d.ts +0 -79
- package/esm/deps/jsr.io/@std/yaml/1.2.0/parse.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/parse.js +0 -91
- package/esm/deps/jsr.io/@std/yaml/1.2.0/stringify.d.ts +0 -100
- package/esm/deps/jsr.io/@std/yaml/1.2.0/stringify.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/stringify.js +0 -33
- package/esm/deps/jsr.io/@std/yaml/1.2.0/types.d.ts +0 -111
- package/esm/deps/jsr.io/@std/yaml/1.2.0/types.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/yaml/1.2.0/types.js +0 -104
- package/esm/mod.d.ts.map +0 -1
- package/esm/package.json +0 -3
- package/esm/src/auth/as-metadata-proxy.d.ts +0 -112
- package/esm/src/auth/as-metadata-proxy.d.ts.map +0 -1
- package/esm/src/auth/as-metadata-proxy.js +0 -171
- package/esm/src/auth/config.d.ts +0 -117
- package/esm/src/auth/config.d.ts.map +0 -1
- package/esm/src/auth/config.js +0 -219
- package/esm/src/auth/jwt-provider.d.ts +0 -157
- package/esm/src/auth/jwt-provider.d.ts.map +0 -1
- package/esm/src/auth/jwt-provider.js +0 -187
- package/esm/src/auth/middleware.d.ts +0 -61
- package/esm/src/auth/middleware.d.ts.map +0 -1
- package/esm/src/auth/middleware.js +0 -209
- package/esm/src/auth/mod.d.ts +0 -23
- package/esm/src/auth/mod.d.ts.map +0 -1
- package/esm/src/auth/mod.js +0 -27
- package/esm/src/auth/multi-tenant-middleware.d.ts +0 -131
- package/esm/src/auth/multi-tenant-middleware.d.ts.map +0 -1
- package/esm/src/auth/multi-tenant-middleware.js +0 -128
- package/esm/src/auth/presets.d.ts +0 -231
- package/esm/src/auth/presets.d.ts.map +0 -1
- package/esm/src/auth/presets.js +0 -223
- package/esm/src/auth/provider.d.ts +0 -47
- package/esm/src/auth/provider.d.ts.map +0 -1
- package/esm/src/auth/provider.js +0 -34
- package/esm/src/auth/scope-middleware.d.ts +0 -30
- package/esm/src/auth/scope-middleware.d.ts.map +0 -1
- package/esm/src/auth/scope-middleware.js +0 -48
- package/esm/src/auth/static-token-provider.d.ts +0 -155
- package/esm/src/auth/static-token-provider.d.ts.map +0 -1
- package/esm/src/auth/static-token-provider.js +0 -256
- package/esm/src/auth/types.d.ts +0 -151
- package/esm/src/auth/types.d.ts.map +0 -1
- package/esm/src/auth/types.js +0 -64
- package/esm/src/client-auth/callback-server.d.ts +0 -34
- package/esm/src/client-auth/callback-server.d.ts.map +0 -1
- package/esm/src/client-auth/callback-server.js +0 -141
- package/esm/src/client-auth/client-id-metadata.d.ts +0 -29
- package/esm/src/client-auth/client-id-metadata.d.ts.map +0 -1
- package/esm/src/client-auth/client-id-metadata.js +0 -149
- package/esm/src/client-auth/connect.d.ts +0 -32
- package/esm/src/client-auth/connect.d.ts.map +0 -1
- package/esm/src/client-auth/connect.js +0 -47
- package/esm/src/client-auth/mod.d.ts +0 -19
- package/esm/src/client-auth/mod.d.ts.map +0 -1
- package/esm/src/client-auth/mod.js +0 -19
- package/esm/src/client-auth/provider.d.ts +0 -78
- package/esm/src/client-auth/provider.d.ts.map +0 -1
- package/esm/src/client-auth/provider.js +0 -246
- package/esm/src/client-auth/token-store/file-store.d.ts +0 -20
- package/esm/src/client-auth/token-store/file-store.d.ts.map +0 -1
- package/esm/src/client-auth/token-store/file-store.js +0 -62
- package/esm/src/client-auth/token-store/memory-store.d.ts +0 -14
- package/esm/src/client-auth/token-store/memory-store.d.ts.map +0 -1
- package/esm/src/client-auth/token-store/memory-store.js +0 -25
- package/esm/src/client-auth/types.d.ts +0 -89
- package/esm/src/client-auth/types.d.ts.map +0 -1
- package/esm/src/client-auth/types.js +0 -10
- package/esm/src/concurrency/rate-limiter.d.ts +0 -87
- package/esm/src/concurrency/rate-limiter.d.ts.map +0 -1
- package/esm/src/concurrency/rate-limiter.js +0 -165
- package/esm/src/concurrency/request-queue.d.ts +0 -71
- package/esm/src/concurrency/request-queue.d.ts.map +0 -1
- package/esm/src/concurrency/request-queue.js +0 -128
- package/esm/src/http/body.d.ts +0 -20
- package/esm/src/http/body.d.ts.map +0 -1
- package/esm/src/http/body.js +0 -63
- package/esm/src/http/request-guards.d.ts +0 -54
- package/esm/src/http/request-guards.d.ts.map +0 -1
- package/esm/src/http/request-guards.js +0 -114
- package/esm/src/http/wire.d.ts +0 -26
- package/esm/src/http/wire.d.ts.map +0 -1
- package/esm/src/http/wire.js +0 -35
- package/esm/src/inspector/launcher.d.ts +0 -48
- package/esm/src/inspector/launcher.d.ts.map +0 -1
- package/esm/src/inspector/launcher.js +0 -100
- package/esm/src/mcp-app.d.ts +0 -728
- package/esm/src/mcp-app.d.ts.map +0 -1
- package/esm/src/mcp-app.js +0 -3530
- package/esm/src/middleware/backpressure.d.ts +0 -24
- package/esm/src/middleware/backpressure.d.ts.map +0 -1
- package/esm/src/middleware/backpressure.js +0 -31
- package/esm/src/middleware/mod.d.ts +0 -11
- package/esm/src/middleware/mod.d.ts.map +0 -1
- package/esm/src/middleware/mod.js +0 -11
- package/esm/src/middleware/rate-limit.d.ts +0 -22
- package/esm/src/middleware/rate-limit.d.ts.map +0 -1
- package/esm/src/middleware/rate-limit.js +0 -33
- package/esm/src/middleware/runner.d.ts +0 -32
- package/esm/src/middleware/runner.d.ts.map +0 -1
- package/esm/src/middleware/runner.js +0 -49
- package/esm/src/middleware/types.d.ts +0 -76
- package/esm/src/middleware/types.d.ts.map +0 -1
- package/esm/src/middleware/types.js +0 -9
- package/esm/src/middleware/validation.d.ts +0 -24
- package/esm/src/middleware/validation.d.ts.map +0 -1
- package/esm/src/middleware/validation.js +0 -30
- package/esm/src/mrtr/capability-check.d.ts +0 -75
- package/esm/src/mrtr/capability-check.d.ts.map +0 -1
- package/esm/src/mrtr/capability-check.js +0 -233
- package/esm/src/mrtr/mod.d.ts +0 -18
- package/esm/src/mrtr/mod.d.ts.map +0 -1
- package/esm/src/mrtr/mod.js +0 -12
- package/esm/src/mrtr/replay-store.d.ts +0 -50
- package/esm/src/mrtr/replay-store.d.ts.map +0 -1
- package/esm/src/mrtr/replay-store.js +0 -61
- package/esm/src/mrtr/request-state.d.ts +0 -181
- package/esm/src/mrtr/request-state.d.ts.map +0 -1
- package/esm/src/mrtr/request-state.js +0 -313
- package/esm/src/mrtr/retry-guard.d.ts +0 -61
- package/esm/src/mrtr/retry-guard.d.ts.map +0 -1
- package/esm/src/mrtr/retry-guard.js +0 -53
- package/esm/src/mrtr/types.d.ts +0 -99
- package/esm/src/mrtr/types.d.ts.map +0 -1
- package/esm/src/mrtr/types.js +0 -14
- package/esm/src/observability/metrics.d.ts +0 -104
- package/esm/src/observability/metrics.d.ts.map +0 -1
- package/esm/src/observability/metrics.js +0 -207
- package/esm/src/observability/mod.d.ts +0 -12
- package/esm/src/observability/mod.d.ts.map +0 -1
- package/esm/src/observability/mod.js +0 -11
- package/esm/src/observability/otel.d.ts +0 -73
- package/esm/src/observability/otel.d.ts.map +0 -1
- package/esm/src/observability/otel.js +0 -260
- package/esm/src/runtime/runtime.d.ts +0 -10
- package/esm/src/runtime/runtime.d.ts.map +0 -1
- package/esm/src/runtime/runtime.deno.d.ts +0 -50
- package/esm/src/runtime/runtime.deno.d.ts.map +0 -1
- package/esm/src/runtime/runtime.deno.js +0 -120
- package/esm/src/runtime/runtime.js +0 -41
- package/esm/src/runtime/runtime.node.d.ts +0 -51
- package/esm/src/runtime/runtime.node.d.ts.map +0 -1
- package/esm/src/runtime/runtime.node.js +0 -268
- package/esm/src/runtime/types.d.ts +0 -107
- package/esm/src/runtime/types.d.ts.map +0 -1
- package/esm/src/runtime/types.js +0 -12
- package/esm/src/security/channel-hmac.d.ts +0 -43
- package/esm/src/security/channel-hmac.d.ts.map +0 -1
- package/esm/src/security/channel-hmac.js +0 -135
- package/esm/src/security/csp.d.ts +0 -50
- package/esm/src/security/csp.d.ts.map +0 -1
- package/esm/src/security/csp.js +0 -63
- package/esm/src/security/message-signer.d.ts +0 -88
- package/esm/src/security/message-signer.d.ts.map +0 -1
- package/esm/src/security/message-signer.js +0 -166
- package/esm/src/subscriptions/subscription-registry.d.ts +0 -256
- package/esm/src/subscriptions/subscription-registry.d.ts.map +0 -1
- package/esm/src/subscriptions/subscription-registry.js +0 -406
- package/esm/src/tasks/mod.d.ts +0 -13
- package/esm/src/tasks/mod.d.ts.map +0 -1
- package/esm/src/tasks/mod.js +0 -11
- package/esm/src/tasks/task-store.d.ts +0 -342
- package/esm/src/tasks/task-store.d.ts.map +0 -1
- package/esm/src/tasks/task-store.js +0 -649
- package/esm/src/transport/request-headers.d.ts +0 -145
- package/esm/src/transport/request-headers.d.ts.map +0 -1
- package/esm/src/transport/request-headers.js +0 -525
- package/esm/src/types.d.ts +0 -776
- package/esm/src/types.d.ts.map +0 -1
- package/esm/src/types.js +0 -92
- package/esm/src/ui/viewer-utils.d.ts +0 -45
- package/esm/src/ui/viewer-utils.d.ts.map +0 -1
- package/esm/src/ui/viewer-utils.js +0 -97
- package/esm/src/validation/schema-validator.d.ts +0 -115
- package/esm/src/validation/schema-validator.d.ts.map +0 -1
- package/esm/src/validation/schema-validator.js +0 -249
package/esm/src/http/wire.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wire-level primitives shared by the dispatch code and its extracted guards.
|
|
3
|
-
*
|
|
4
|
-
* This module exists to keep `http/request-guards.ts` from importing
|
|
5
|
-
* `mcp-app.ts`, which would be a cycle. It holds only what both need: no state,
|
|
6
|
-
* no `McpApp` reference.
|
|
7
|
-
*
|
|
8
|
-
* Not re-exported from `mod.ts` — internal.
|
|
9
|
-
*
|
|
10
|
-
* @module lib/server/http/wire
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Sentinel used when there is no authentication at all.
|
|
14
|
-
*
|
|
15
|
-
* Deliberately not a plausible subject value. Authenticated callers are also
|
|
16
|
-
* checked against this exact value before MRTR or task state is accepted, so a
|
|
17
|
-
* custom provider cannot create an authority collision by returning it.
|
|
18
|
-
*/
|
|
19
|
-
export const MRTR_NO_AUTH_PRINCIPAL = "\u0000unauthenticated";
|
|
20
|
-
export function jsonRpcResponse(payload, status, headers) {
|
|
21
|
-
return new Response(JSON.stringify(payload), {
|
|
22
|
-
status,
|
|
23
|
-
headers: {
|
|
24
|
-
"Content-Type": "application/json",
|
|
25
|
-
...(headers ?? {}),
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Narrow type-guard: returns true iff `v` is a plain object (not array, not null).
|
|
31
|
-
* Used to safely extract fields from JSON-RPC `params` without unsafe casts.
|
|
32
|
-
*/
|
|
33
|
-
export function isRecord(v) {
|
|
34
|
-
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
35
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Inspector Launcher
|
|
3
|
-
*
|
|
4
|
-
* Launches the official @modelcontextprotocol/inspector to debug
|
|
5
|
-
* and test MCP servers interactively in a browser.
|
|
6
|
-
*
|
|
7
|
-
* Runtime-agnostic: process spawning goes through `node:` builtins, which
|
|
8
|
-
* both Deno (via its Node compat layer) and Node.js support — one code path
|
|
9
|
-
* instead of a per-runtime adapter. The `node:` modules are imported
|
|
10
|
-
* dynamically inside the function bodies so nothing process-related enters
|
|
11
|
-
* the module graph at load time (mod.ts re-exports this module, and its
|
|
12
|
-
* import must stay side-effect free on constrained runtimes like
|
|
13
|
-
* Deno Deploy).
|
|
14
|
-
*
|
|
15
|
-
* Usage from a server script:
|
|
16
|
-
* ```typescript
|
|
17
|
-
* import { launchInspector } from "@casys/mcp-server";
|
|
18
|
-
*
|
|
19
|
-
* if (Deno.args.includes("--inspect")) {
|
|
20
|
-
* await launchInspector("deno", ["run", "--allow-all", "server.ts"]);
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @module lib/server/inspector/launcher
|
|
25
|
-
*/
|
|
26
|
-
/** Options for the MCP Inspector launcher. */
|
|
27
|
-
export interface InspectorOptions {
|
|
28
|
-
/** Port for the inspector web UI (default: 6274) */
|
|
29
|
-
port?: number;
|
|
30
|
-
/** Automatically open the browser (default: true) */
|
|
31
|
-
open?: boolean;
|
|
32
|
-
/** Environment variables to pass to the MCP server process */
|
|
33
|
-
env?: Record<string, string>;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Launch the MCP Inspector to debug a server.
|
|
37
|
-
*
|
|
38
|
-
* Spawns `npx @modelcontextprotocol/inspector` which:
|
|
39
|
-
* 1. Starts a web UI on the given port (default 6274)
|
|
40
|
-
* 2. Proxies stdio to the MCP server subprocess
|
|
41
|
-
* 3. Allows interactive tool calls, resource browsing, etc.
|
|
42
|
-
*
|
|
43
|
-
* @param serverCommand - Command to start the MCP server (e.g. "deno", "node")
|
|
44
|
-
* @param serverArgs - Arguments for the server command (e.g. ["run", "--allow-all", "server.ts"])
|
|
45
|
-
* @param options - Inspector configuration
|
|
46
|
-
*/
|
|
47
|
-
export declare function launchInspector(serverCommand: string, serverArgs: string[], options?: InspectorOptions): Promise<void>;
|
|
48
|
-
//# sourceMappingURL=launcher.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../../../src/src/inspector/launcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,8CAA8C;AAC9C,MAAM,WAAW,gBAAgB;IAC/B,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,8DAA8D;IAC9D,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CACnC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAAE,EACpB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,IAAI,CAAC,CAuDf"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Inspector Launcher
|
|
3
|
-
*
|
|
4
|
-
* Launches the official @modelcontextprotocol/inspector to debug
|
|
5
|
-
* and test MCP servers interactively in a browser.
|
|
6
|
-
*
|
|
7
|
-
* Runtime-agnostic: process spawning goes through `node:` builtins, which
|
|
8
|
-
* both Deno (via its Node compat layer) and Node.js support — one code path
|
|
9
|
-
* instead of a per-runtime adapter. The `node:` modules are imported
|
|
10
|
-
* dynamically inside the function bodies so nothing process-related enters
|
|
11
|
-
* the module graph at load time (mod.ts re-exports this module, and its
|
|
12
|
-
* import must stay side-effect free on constrained runtimes like
|
|
13
|
-
* Deno Deploy).
|
|
14
|
-
*
|
|
15
|
-
* Usage from a server script:
|
|
16
|
-
* ```typescript
|
|
17
|
-
* import { launchInspector } from "@casys/mcp-server";
|
|
18
|
-
*
|
|
19
|
-
* if (Deno.args.includes("--inspect")) {
|
|
20
|
-
* await launchInspector("deno", ["run", "--allow-all", "server.ts"]);
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @module lib/server/inspector/launcher
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* Launch the MCP Inspector to debug a server.
|
|
28
|
-
*
|
|
29
|
-
* Spawns `npx @modelcontextprotocol/inspector` which:
|
|
30
|
-
* 1. Starts a web UI on the given port (default 6274)
|
|
31
|
-
* 2. Proxies stdio to the MCP server subprocess
|
|
32
|
-
* 3. Allows interactive tool calls, resource browsing, etc.
|
|
33
|
-
*
|
|
34
|
-
* @param serverCommand - Command to start the MCP server (e.g. "deno", "node")
|
|
35
|
-
* @param serverArgs - Arguments for the server command (e.g. ["run", "--allow-all", "server.ts"])
|
|
36
|
-
* @param options - Inspector configuration
|
|
37
|
-
*/
|
|
38
|
-
export async function launchInspector(serverCommand, serverArgs, options) {
|
|
39
|
-
const { spawn } = await import("node:child_process");
|
|
40
|
-
const { env, exit } = await import("node:process");
|
|
41
|
-
const port = options?.port ?? 6274;
|
|
42
|
-
const shouldOpen = options?.open ?? true;
|
|
43
|
-
// Filter out --inspect from args to avoid recursion
|
|
44
|
-
const filteredArgs = serverArgs.filter((a) => a !== "--inspect");
|
|
45
|
-
const inspectorEnv = {
|
|
46
|
-
...options?.env,
|
|
47
|
-
CLIENT_PORT: String(port),
|
|
48
|
-
};
|
|
49
|
-
console.error(`[mcp-inspector] Starting inspector on http://localhost:${port}`);
|
|
50
|
-
console.error(`[mcp-inspector] Server: ${serverCommand} ${filteredArgs.join(" ")}`);
|
|
51
|
-
// Use npx to run the inspector
|
|
52
|
-
const child = spawn("npx", [
|
|
53
|
-
"-y",
|
|
54
|
-
"@modelcontextprotocol/inspector",
|
|
55
|
-
serverCommand,
|
|
56
|
-
...filteredArgs,
|
|
57
|
-
], {
|
|
58
|
-
env: { ...env, ...inspectorEnv },
|
|
59
|
-
stdio: "inherit",
|
|
60
|
-
});
|
|
61
|
-
// Open browser after a short delay
|
|
62
|
-
if (shouldOpen) {
|
|
63
|
-
setTimeout(() => {
|
|
64
|
-
openBrowser(`http://localhost:${port}`).catch(() => {
|
|
65
|
-
// Ignore — user can open manually
|
|
66
|
-
});
|
|
67
|
-
}, 2000);
|
|
68
|
-
}
|
|
69
|
-
// Wait for the inspector process to exit
|
|
70
|
-
const code = await new Promise((resolve, reject) => {
|
|
71
|
-
child.on("error", reject);
|
|
72
|
-
child.on("exit", (exitCode) => resolve(exitCode ?? 1));
|
|
73
|
-
});
|
|
74
|
-
if (code !== 0) {
|
|
75
|
-
console.error(`[mcp-inspector] Inspector exited with code ${code}`);
|
|
76
|
-
exit(code);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Open a URL in the default browser (cross-platform).
|
|
81
|
-
*/
|
|
82
|
-
async function openBrowser(url) {
|
|
83
|
-
const { spawn } = await import("node:child_process");
|
|
84
|
-
const { platform } = await import("node:process");
|
|
85
|
-
let cmd;
|
|
86
|
-
if (platform === "darwin") {
|
|
87
|
-
cmd = ["open", url];
|
|
88
|
-
}
|
|
89
|
-
else if (platform === "win32") {
|
|
90
|
-
cmd = ["cmd", "/c", "start", url];
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
cmd = ["xdg-open", url];
|
|
94
|
-
}
|
|
95
|
-
const child = spawn(cmd[0], cmd.slice(1), { stdio: "ignore" });
|
|
96
|
-
await new Promise((resolve, reject) => {
|
|
97
|
-
child.on("error", reject);
|
|
98
|
-
child.on("exit", () => resolve());
|
|
99
|
-
});
|
|
100
|
-
}
|