@effected/mcp 0.7.0 → 0.9.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/McpGuard.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ProcessGuard } from "@effected/engine/guard";
2
2
 
3
- //#region src/McpGuard.ts
3
+ // src/McpGuard.ts
4
4
  /**
5
5
  * Crash guards for an MCP server process, installed before the server's
6
6
  * module graph is loaded. Imported from `@effected/mcp/guard`.
@@ -78,5 +78,4 @@ var McpGuard = class {
78
78
  });
79
79
  };
80
80
 
81
- //#endregion
82
81
  export { McpGuard };
package/McpHarness.js CHANGED
@@ -4,7 +4,7 @@ import { McpTestFailure } from "./McpTestFailure.js";
4
4
  import { Console, Deferred, Effect, Exit, Fiber, Layer, Queue, Sink, Stdio, Stream } from "effect";
5
5
  import { McpProtocol } from "effect/ai";
6
6
 
7
- //#region src/McpHarness.ts
7
+ // src/McpHarness.ts
8
8
  /**
9
9
  * An in-process MCP client for a real server layer, over queue-backed stdio.
10
10
  *
@@ -297,5 +297,4 @@ var McpHarness = class McpHarness {
297
297
  });
298
298
  };
299
299
 
300
- //#endregion
301
300
  export { McpHarness };
package/McpProbe.js CHANGED
@@ -5,7 +5,7 @@ import { McpProcess } from "./McpProcess.js";
5
5
  import { Effect } from "effect";
6
6
  import { McpProtocol } from "effect/ai";
7
7
 
8
- //#region src/McpProbe.ts
8
+ // src/McpProbe.ts
9
9
  /**
10
10
  * The smallest proof that an installed MCP bin boots: one initialize, a clean
11
11
  * close, and exit 0.
@@ -91,5 +91,4 @@ var McpProbe = class {
91
91
  }));
92
92
  };
93
93
 
94
- //#endregion
95
94
  export { McpProbe };
package/McpProcess.js CHANGED
@@ -5,7 +5,7 @@ import { Deferred, Duration, Effect, Option, Queue, Ref, Stream, SubscriptionRef
5
5
  import { McpProtocol } from "effect/ai";
6
6
  import { ChildProcessSpawner } from "effect/process";
7
7
 
8
- //#region src/McpProcess.ts
8
+ // src/McpProcess.ts
9
9
  /**
10
10
  * A spawned MCP server bin a test writes to while it runs.
11
11
  *
@@ -193,5 +193,4 @@ var McpProcess = class McpProcess {
193
193
  });
194
194
  };
195
195
 
196
- //#endregion
197
196
  export { McpProcess };
package/McpStdio.js CHANGED
@@ -3,7 +3,7 @@ import { makeGuardedStdio } from "./internal/StdinFrames.js";
3
3
  import { Cause, Effect, Exit, Layer, References, Runtime } from "effect";
4
4
  import { McpProtocol, McpServer } from "effect/ai";
5
5
 
6
- //#region src/McpStdio.ts
6
+ // src/McpStdio.ts
7
7
  /**
8
8
  * Serve an MCP server over stdio without ever writing a log line or a failure
9
9
  * report onto stdout, which is the JSON-RPC wire.
@@ -164,5 +164,4 @@ var McpStdio = class McpStdio {
164
164
  static teardown = (exit, onExit) => Exit.isSuccess(exit) || Cause.hasInterruptsOnly(exit.cause) ? onExit(0) : Runtime.defaultTeardown(exit, onExit);
165
165
  };
166
166
 
167
- //#endregion
168
167
  export { McpStdio };
package/McpTestFailure.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
 
3
- //#region src/McpTestFailure.ts
3
+ // src/McpTestFailure.ts
4
4
  /**
5
5
  * Why an MCP test client could not produce what was asked of it.
6
6
  *
@@ -46,5 +46,4 @@ var McpTestFailure = class extends Schema.TaggedError()("McpTestFailure", {
46
46
  message: Schema.String
47
47
  }) {};
48
48
 
49
- //#endregion
50
49
  export { McpTestFailure };
package/McpToolAudit.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/McpToolAudit.ts
1
+ // src/McpToolAudit.ts
2
2
  const isNode = (u) => typeof u === "object" && u !== null && !Array.isArray(u);
3
3
  const HINTS = [
4
4
  "readOnlyHint",
@@ -106,5 +106,4 @@ var McpToolAudit = class {
106
106
  };
107
107
  };
108
108
 
109
- //#endregion
110
109
  export { McpToolAudit };
package/McpToolkit.js CHANGED
@@ -3,7 +3,7 @@ import { ToolInputSchema } from "./ToolInputSchema.js";
3
3
  import { Context, Effect, Layer, Schema } from "effect";
4
4
  import { McpSchema, McpServer, Tool, Toolkit } from "effect/ai";
5
5
 
6
- //#region src/McpToolkit.ts
6
+ // src/McpToolkit.ts
7
7
  /** The union a {@link McpToolkit.unionTool} decodes with; read by the `McpToolkit.layer` decorator. */
8
8
  const UnionParameters = Context.Reference("@effected/mcp/UnionParameters", { defaultValue: () => void 0 });
9
9
  /**
@@ -243,5 +243,4 @@ var McpToolkit = class {
243
243
  })).pipe(Layer.provide(McpServer.McpServer.layer));
244
244
  };
245
245
 
246
- //#endregion
247
246
  export { McpToolkit, guardRegistration };
package/ToolFailure.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Schema } from "effect";
2
2
  import { Remediation } from "@effected/engine";
3
3
 
4
- //#region src/ToolFailure.ts
4
+ // src/ToolFailure.ts
5
5
  const isHighSurrogate = (code) => code >= 55296 && code <= 56319;
6
6
  /**
7
7
  * How a tool's declared failure should read on the wire.
@@ -68,5 +68,4 @@ var ToolFailure = class ToolFailure {
68
68
  };
69
69
  };
70
70
 
71
- //#endregion
72
71
  export { ToolFailure };
@@ -1,7 +1,7 @@
1
1
  import { ToolFailure } from "./ToolFailure.js";
2
2
  import { Result } from "effect";
3
3
 
4
- //#region src/ToolInputSchema.ts
4
+ // src/ToolInputSchema.ts
5
5
  const MAX_DEPTH = 256;
6
6
  const MAX_ECHOED = 20;
7
7
  const DISCRIMINANTS = [
@@ -177,5 +177,4 @@ var ToolInputSchema = class {
177
177
  };
178
178
  };
179
179
 
180
- //#endregion
181
180
  export { ToolInputSchema };
@@ -1,6 +1,6 @@
1
1
  import { Schema, SchemaAST } from "effect";
2
2
 
3
- //#region src/ToolOutputSchema.ts
3
+ // src/ToolOutputSchema.ts
4
4
  const MARK = "~effected/mcp/objectRooted";
5
5
  /** Always passes; contributes `type: "object"` beside whatever the node already emits. */
6
6
  const objectRoot = Schema.makeFilter(() => true, {
@@ -62,5 +62,4 @@ var ToolOutputSchema = class {
62
62
  };
63
63
  };
64
64
 
65
- //#endregion
66
65
  export { ToolOutputSchema };
package/ToolRefusal.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ToolFailure } from "./ToolFailure.js";
2
2
  import { Schema } from "effect";
3
3
 
4
- //#region src/ToolRefusal.ts
4
+ // src/ToolRefusal.ts
5
5
  /**
6
6
  * A tool call refused for a reason the caller can fix: the kit's ready-made
7
7
  * declared failure, built on {@link ToolFailure.fields}.
@@ -54,5 +54,4 @@ var ToolRefusal = class ToolRefusal extends Schema.TaggedError()("ToolRefusal",
54
54
  });
55
55
  };
56
56
 
57
- //#endregion
58
57
  export { ToolRefusal };
package/guard.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Effect, Layer, Runtime } from "effect";
2
- //#region src/McpGuard.d.ts
3
2
  /**
4
3
  * The slice of the host process the guard uses. Node's `process` satisfies it.
5
4
  *
@@ -175,6 +174,5 @@ export declare class McpGuard {
175
174
  /** Install the guards, load the server, and launch it. Resolves once the server is launched. */
176
175
  static readonly run: <ROut, E>(options: McpGuardRunOptions<ROut, E>) => Promise<void>;
177
176
  }
178
- //#endregion
179
177
  export type { McpGuardHost, McpGuardPolicy, McpGuardRunOptions, McpGuardedServer };
180
178
  //# sourceMappingURL=guard.d.ts.map
package/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { Array, Context, Effect, JsonSchema, Layer, Runtime, Schema, Stdio } from "effect";
2
2
  import { McpProtocol, McpSchema, McpServer, Tool, Toolkit } from "effect/ai";
3
3
  import { Remediation } from "@effected/engine";
4
- //#region src/McpStdio.d.ts
5
4
  /**
6
5
  * Options for {@link McpStdio.layer}.
7
6
  *
@@ -188,8 +187,6 @@ export declare class McpStdio {
188
187
  */
189
188
  static readonly teardown: Runtime.Teardown;
190
189
  }
191
- //#endregion
192
- //#region src/ToolInputSchema.d.ts
193
190
  /**
194
191
  * The unknown keys found at one object level of a tool-call payload.
195
192
  *
@@ -271,8 +268,6 @@ export declare class ToolInputSchema {
271
268
  */
272
269
  static readonly objectRooted: (schema: JsonSchema.JsonSchema) => JsonSchema.JsonSchema;
273
270
  }
274
- //#endregion
275
- //#region src/McpToolkit.d.ts
276
271
  /**
277
272
  * Options for {@link McpToolkit.layer}.
278
273
  *
@@ -477,8 +472,6 @@ export declare class McpToolkit {
477
472
  */
478
473
  static readonly layer: <Tools extends Record<string, Tool.Any>>(toolkit: Toolkit.Toolkit<Tools>, options?: McpToolkitOptions) => Layer.Layer<never, never, Tool.HandlersFor<Tools> | Exclude<Tool.HandlerServices<Tools>, McpSchema.McpRequestContext>>;
479
474
  }
480
- //#endregion
481
- //#region src/ToolFailure.d.ts
482
475
  /**
483
476
  * How a tool's declared failure should read on the wire.
484
477
  *
@@ -539,8 +532,6 @@ export declare class ToolFailure {
539
532
  */
540
533
  static readonly truncate: (value: string, limit?: number) => string;
541
534
  }
542
- //#endregion
543
- //#region src/ToolOutputSchema.d.ts
544
535
  /**
545
536
  * Shaping for a tool's `success` schema, so the `outputSchema` core serves
546
537
  * is one every client accepts.
@@ -589,8 +580,6 @@ export declare class ToolOutputSchema {
589
580
  */
590
581
  static readonly objectRooted: <S extends Schema.Top>(schema: S) => S;
591
582
  }
592
- //#endregion
593
- //#region src/ToolRefusal.d.ts
594
583
  declare const ToolRefusal_base: Schema.Class<ToolRefusal, Schema.TaggedStruct<"ToolRefusal", {
595
584
  readonly message: Schema.String;
596
585
  readonly remediation: Schema.Struct<{
@@ -647,6 +636,5 @@ export declare class ToolRefusal extends ToolRefusal_base {
647
636
  */
648
637
  static readonly refuse: (reason: string, remediation: Remediation) => ToolRefusal;
649
638
  }
650
- //#endregion
651
639
  export type { FormatUnknownKeysOptions, McpLaunchOptions, McpStdioOptions, McpToolkitOptions, UnionHandlerOptions, UnionTool, UnionToolOptions, UnknownKeysLevel };
652
640
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { Runtime } from "effect";
2
2
 
3
- //#region src/internal/LaunchFailed.ts
3
+ // src/internal/LaunchFailed.ts
4
4
  /**
5
5
  * The failure `McpStdio.launch` re-raises after reporting a launch failure on
6
6
  * stderr itself. `errorReported: false` keeps `runMain` from reporting it a
@@ -31,5 +31,4 @@ var LaunchFailed = class extends Error {
31
31
  }
32
32
  };
33
33
 
34
- //#endregion
35
34
  export { LaunchFailed };
@@ -1,7 +1,7 @@
1
1
  import { Effect, Layer, Stdio, Stream } from "effect";
2
2
  import { McpSchema } from "effect/ai";
3
3
 
4
- //#region src/internal/StdinFrames.ts
4
+ // src/internal/StdinFrames.ts
5
5
  /**
6
6
  * The line-length cap core's stdio NDJSON decoder applies, in the same unit
7
7
  * (UTF-16 code units of the decoded text) and with the same predicate
@@ -235,5 +235,4 @@ const guardStdin = (stdio) => {
235
235
  */
236
236
  const makeGuardedStdio = () => Layer.effect(Stdio.Stdio, Effect.map(Stdio.Stdio, guardStdin));
237
237
 
238
- //#endregion
239
238
  export { INVALID_REQUEST_FRAME, MAX_FRAME_LENGTH, PARSE_ERROR_FRAME, RPC_CONTROL_PREFIX, guardStdin, makeFrameGuard, makeGuardedStdio, methodNotFoundFrame };
@@ -1,7 +1,7 @@
1
1
  import { McpStdio } from "../McpStdio.js";
2
2
  import { Effect } from "effect";
3
3
 
4
- //#region src/internal/guardLaunch.ts
4
+ // src/internal/guardLaunch.ts
5
5
  /**
6
6
  * The server half of `McpGuard.run`, reached only through a dynamic import so
7
7
  * the guard module itself evaluates nothing but its own code.
@@ -10,5 +10,4 @@ import { Effect } from "effect";
10
10
  */
11
11
  const launchGuarded = (server, onReady) => server.runMain(McpStdio.launch(server.layer, { onReady: Effect.sync(onReady) }), { teardown: McpStdio.teardown });
12
12
 
13
- //#endregion
14
13
  export { launchGuarded };
package/internal/wire.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Result } from "effect";
2
2
 
3
- //#region src/internal/wire.ts
3
+ // src/internal/wire.ts
4
4
  /** @internal */
5
5
  const DEFAULT_CLIENT_INFO = {
6
6
  name: "effected-mcp-testing",
@@ -62,5 +62,4 @@ const initializeParams = (protocol, clientInfo) => ({
62
62
  clientInfo
63
63
  });
64
64
 
65
- //#endregion
66
65
  export { DEFAULT_CLIENT_INFO, STDERR_HINT, frame, initializeParams, isJsonRpcMessage, isResponse, isStateless, parseFrame, requestKey };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effected/mcp",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "private": false,
5
5
  "description": "The boundary layer of an effect/ai MCP server: stdio wiring that keeps stdout the wire, tool-failure shaping, strict-input walkers, and test clients",
6
6
  "keywords": [
@@ -47,7 +47,7 @@
47
47
  "./package.json": "./package.json"
48
48
  },
49
49
  "peerDependencies": {
50
- "@effected/engine": "^0.6.0",
50
+ "@effected/engine": "^0.8.0",
51
51
  "effect": "^4.0.0"
52
52
  },
53
53
  "engines": {
package/testing.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { Duration, Effect, JsonSchema, Layer, PlatformError, Schema, Scope, Stdio } from "effect";
2
2
  import { McpProtocol } from "effect/ai";
3
3
  import { ChildProcess, ChildProcessSpawner } from "effect/process";
4
- //#region src/McpTestFailure.d.ts
5
4
  declare const McpTestFailure_base: Schema.Class<McpTestFailure, Schema.TaggedStruct<"McpTestFailure", {
6
5
  /** Which failure occurred; see the list above for which client raises which. */
7
6
  readonly reason: Schema.Literals<readonly ["StreamEnded", "ServerStopped", "NotJsonRpc", "NotInitialized", "ErrorResponse", "TimedOut"]>;
@@ -40,8 +39,6 @@ declare const McpTestFailure_base: Schema.Class<McpTestFailure, Schema.TaggedStr
40
39
  * @public
41
40
  */
42
41
  export declare class McpTestFailure extends McpTestFailure_base {}
43
- //#endregion
44
- //#region src/McpWire.d.ts
45
42
  /**
46
43
  * One JSON-RPC 2.0 frame as an MCP test client sees it.
47
44
  *
@@ -92,8 +89,6 @@ interface ServedResource {
92
89
  readonly [key: string]: unknown;
93
90
  } | undefined;
94
91
  }
95
- //#endregion
96
- //#region src/McpHarness.d.ts
97
92
  /**
98
93
  * Options for {@link McpHarness.make}.
99
94
  *
@@ -238,8 +233,6 @@ export declare class McpHarness {
238
233
  /** Build `server` over queue-backed stdio and return a client for it; fails with the layer's own error if it cannot build. */
239
234
  static readonly make: <ROut, E, R>(server: Layer.Layer<ROut, E, R>, options?: McpHarnessOptions) => Effect.Effect<McpHarness, E, Scope.Scope | Exclude<R, Stdio.Stdio>>;
240
235
  }
241
- //#endregion
242
- //#region src/McpProbe.d.ts
243
236
  /**
244
237
  * Options for {@link McpProbe.initialize}.
245
238
  *
@@ -310,8 +303,6 @@ export declare class McpProbe {
310
303
  */
311
304
  static readonly initialize: (command: ChildProcess.Command, options?: McpProbeOptions) => Effect.Effect<McpProbeResult, McpTestFailure | PlatformError.PlatformError, ChildProcessSpawner.ChildProcessSpawner>;
312
305
  }
313
- //#endregion
314
- //#region src/McpProcess.d.ts
315
306
  /**
316
307
  * Options for {@link McpProcess.stderrUntil}.
317
308
  *
@@ -423,8 +414,6 @@ export declare class McpProcess {
423
414
  /** Spawn `command` for the life of the current scope. */
424
415
  static readonly spawn: (command: ChildProcess.Command) => Effect.Effect<McpProcess, PlatformError.PlatformError, ChildProcessSpawner.ChildProcessSpawner | Scope.Scope>;
425
416
  }
426
- //#endregion
427
- //#region src/McpToolAudit.d.ts
428
417
  /**
429
418
  * The policy {@link McpToolAudit.check} enforces.
430
419
  *
@@ -489,6 +478,5 @@ export declare class McpToolAudit {
489
478
  */
490
479
  static readonly check: (tools: ReadonlyArray<ServedTool>, policy: McpToolAuditPolicy) => ReadonlyArray<string>;
491
480
  }
492
- //#endregion
493
481
  export type { JsonRpcMessage, McpHarnessOptions, McpProbeOptions, McpProbeResult, McpProcessStderrUntilOptions, McpToolAuditPolicy, ServedResource, ServedTool };
494
482
  //# sourceMappingURL=testing.d.ts.map