@shivaedev/mcp 0.8.4 → 0.9.1

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.1 - 2026-11-05
4
+
5
+ ### Changed
6
+
7
+ - Update `@shivaedev/identity` from 0.27.0 to 0.28.0.
8
+
9
+ ## 0.9.0 - 2026-11-05
10
+
11
+ ### Breaking
12
+
13
+ - Require Effect 4.1.0 and its matching companion packages. Move `effect`, `@effect/platform-node`, `@effect/platform-node-shared`, `@effect/sql-pg`, `@effect/sql-sqlite-node`, `@effect/atom-react` and `@effect/vitest` to exactly 4.1.0 together. A tool's `dependencies` are request-level in Effect 4.1.0, so `Layer.provide` of the service no longer satisfies them. Supply them through `McpServer.middleware<{ provides: Service }>()((effect) => Effect.provideService(effect, Service, value)).layer` provided to the tools layer.
14
+
15
+ ## 0.8.5 - 2026-11-05
16
+
17
+ ### Changed
18
+
19
+ - Update `@shivaedev/identity` from 0.26.2 to 0.26.3.
20
+
3
21
  ## 0.8.4 - 2026-11-05
4
22
 
5
23
  ### Changed
package/README.md CHANGED
@@ -71,11 +71,13 @@ Use `mcpStdio` from `@shivaedev/mcp/stdio.ts` when an MCP client starts your int
71
71
  ```ts
72
72
  import { NodeRuntime, NodeServices } from "@effect/platform-node";
73
73
  import { Effect, Layer, Logger } from "effect";
74
+ import { McpServer } from "effect/ai";
74
75
  import { Identity } from "@shivaedev/identity/identity.ts";
75
76
  import { mcpStdio } from "@shivaedev/mcp/stdio.ts";
76
77
 
77
- mcpStdio({ name: "Local integration", version: "1", tools: userTools }).pipe(
78
- Layer.provide(Layer.succeed(Identity, { id: "local-user" })),
78
+ const localUser = McpServer.middleware<{ provides: Identity }>()((effect) => Effect.provideService(effect, Identity, { id: "local-user" }));
79
+
80
+ mcpStdio({ name: "Local integration", version: "1", tools: userTools.pipe(Layer.provide(localUser.layer)) }).pipe(
79
81
  Layer.launch,
80
82
  Effect.provideService(Logger.LogToStderr, true),
81
83
  Effect.provide(NodeServices.layer),
@@ -85,7 +87,7 @@ mcpStdio({ name: "Local integration", version: "1", tools: userTools }).pipe(
85
87
 
86
88
  `userTools` is the toolkit Layer declared above. The stdio entry point requires Effect's `Stdio` service, supplied here by `NodeServices.layer` from `@effect/platform-node`. Keep stdout for MCP messages and direct application logs to stderr. The server supports MCP `2026-07-28` and `2025-11-25` over newline-delimited JSON-RPC. Its Layer scope owns the transport and handlers: cancelling a tool call releases its scoped resources, and closing the client stops the child process and releases in-flight tool resources.
87
89
 
88
- Stdio uses the services supplied by the local application. It does not run the HTTP session policy or select permission-based audiences; the application chooses which toolkits and identity services to provide to its local client.
90
+ Stdio uses the services supplied by the local application. It does not run the HTTP session policy or select permission-based audiences; the application chooses which toolkits to serve and supplies the identity its tools read. Services a tool declares in `dependencies` are request-level in Effect's `McpServer`: supply them through `McpServer.middleware` provided to the toolkit Layer, as `localUser` does here, because `Layer.provide` with the service itself does not satisfy them.
89
91
 
90
92
  ### Connect OAuth to identity and the host
91
93
 
@@ -1,6 +1,7 @@
1
1
  import { Effect } from "effect";
2
+ import { McpProtocol, McpServer } from "effect/ai";
2
3
  import { HttpRouter } from "effect/http";
3
4
  import { SessionUser } from "@shivaedev/identity/identity.ts";
4
5
  import type { McpOptions } from "./routes.ts";
5
- export declare const requestServer: <E, R>(options: McpOptions<E, R>) => Effect.Effect<import("effect/http/HttpServerResponse").HttpServerResponse, unknown, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope | SessionUser | Exclude<R, HttpRouter.HttpRouter>>;
6
+ export declare const requestServer: <E, R>(options: McpOptions<E, R>) => Effect.Effect<import("effect/http/HttpServerResponse").HttpServerResponse, import("effect/http/HttpServerError").HttpServerError | import("effect/Cause").IllegalArgumentError | HttpRouter.Request.Only<"Error", Exclude<Exclude<McpServer.McpRequest.Without<R>, McpServer.McpServer>, HttpRouter.HttpRouter>> | HttpRouter.Request.Only<"Error", Exclude<HttpRouter.Request.From<"Requires", Exclude<McpServer.McpRequest.Only<"Requires", R>, McpServer.ProvidedServices<readonly [McpProtocol.ProtocolAdapter<"2026-07-28", McpProtocol.StatelessRuntimeDescriptor>], true>>>, HttpRouter.HttpRouter>> | HttpRouter.Request.Only<"GlobalError", Exclude<Exclude<McpServer.McpRequest.Without<R>, McpServer.McpServer>, HttpRouter.HttpRouter>> | HttpRouter.Request.Only<"GlobalError", Exclude<HttpRouter.Request.From<"Requires", Exclude<McpServer.McpRequest.Only<"Requires", R>, McpServer.ProvidedServices<readonly [McpProtocol.ProtocolAdapter<"2026-07-28", McpProtocol.StatelessRuntimeDescriptor>], true>>>, HttpRouter.HttpRouter>> | HttpRouter.Request.Without<E>, import("effect/http/HttpServerRequest").HttpServerRequest | import("effect/Scope").Scope | SessionUser | Exclude<HttpRouter.Request.Without<Exclude<Exclude<McpServer.McpRequest.Without<R>, McpServer.McpServer>, HttpRouter.HttpRouter>>, HttpRouter.HttpRouter> | Exclude<HttpRouter.Request.Without<Exclude<HttpRouter.Request.From<"Requires", Exclude<McpServer.McpRequest.Only<"Requires", R>, McpServer.ProvidedServices<readonly [McpProtocol.ProtocolAdapter<"2026-07-28", McpProtocol.StatelessRuntimeDescriptor>], true>>>, HttpRouter.HttpRouter>>, HttpRouter.HttpRouter> | HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<McpServer.McpRequest.Without<R>, McpServer.McpServer>, HttpRouter.HttpRouter>> | HttpRouter.Request.Only<"GlobalRequires", Exclude<HttpRouter.Request.From<"Requires", Exclude<McpServer.McpRequest.Only<"Requires", R>, McpServer.ProvidedServices<readonly [McpProtocol.ProtocolAdapter<"2026-07-28", McpProtocol.StatelessRuntimeDescriptor>], true>>>, HttpRouter.HttpRouter>> | HttpRouter.Request.Only<"Requires", Exclude<Exclude<McpServer.McpRequest.Without<R>, McpServer.McpServer>, HttpRouter.HttpRouter>> | HttpRouter.Request.Only<"Requires", Exclude<HttpRouter.Request.From<"Requires", Exclude<McpServer.McpRequest.Only<"Requires", R>, McpServer.ProvidedServices<readonly [McpProtocol.ProtocolAdapter<"2026-07-28", McpProtocol.StatelessRuntimeDescriptor>], true>>>, HttpRouter.HttpRouter>>>;
6
7
  //# sourceMappingURL=requestServer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"requestServer.d.ts","sourceRoot":"","sources":["../src/requestServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAS,MAAM,QAAQ,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,eAAO,MAAM,aAAa,GAA6C,CAAC,EAAE,CAAC,+PASzE,CAAC"}
1
+ {"version":3,"file":"requestServer.d.ts","sourceRoot":"","sources":["../src/requestServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAS,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,eAAO,MAAM,aAAa,GAA6C,CAAC,EAAE,CAAC,g8EAczE,CAAC"}
@@ -5,12 +5,17 @@ import { SessionUser } from "@shivaedev/identity/identity.ts";
5
5
  import { hasPermission } from "@shivaedev/identity/permission.ts";
6
6
  export const requestServer = Effect.fn("Mcp.requestServer")(function* (options) {
7
7
  const user = yield* SessionUser;
8
- const inner = yield* HttpRouter.make;
9
- const transport = McpServer.layerHttpRequestScoped({ ...options, protocols: [McpProtocol.v2026_07_28] });
10
8
  const tools = options.audiences
11
9
  .filter(({ permission }) => permission === undefined || hasPermission(user, permission))
12
10
  .map((audience) => audience.tools);
13
- yield* Layer.build(Layer.mergeAll(transport, ...tools)).pipe(Effect.provideService(HttpRouter.HttpRouter, inner));
14
- return yield* inner.asHttpEffect();
11
+ const transport = McpServer.layerHttpRequestScoped({
12
+ ...options,
13
+ protocols: [McpProtocol.v2026_07_28],
14
+ registrations: Layer.mergeAll(Layer.empty, ...tools),
15
+ });
16
+ // A router built from the shared HttpRouter.layer would come back memoized as the app's own router, which already holds this path.
17
+ const router = Layer.effect(HttpRouter.HttpRouter, HttpRouter.make);
18
+ const handler = yield* HttpRouter.toHttpEffect(transport.pipe(Layer.provideMerge(router)));
19
+ return yield* handler;
15
20
  });
16
21
  //# sourceMappingURL=requestServer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"requestServer.js","sourceRoot":"","sources":["../src/requestServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,QAAQ,CAAC,EAAQ,OAAyB;IACrG,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,WAAW,CAAC;IAChC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC;IACrC,MAAM,SAAS,GAAG,SAAS,CAAC,sBAAsB,CAAC,EAAE,GAAG,OAAO,EAAE,SAAS,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACzG,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS;SAC7B,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AC,CAAC;IACpC,MAAM,SAAS,GAAG,SAAS,CAAC,sBAAsB,CAAC;QAClD,GAAG,OAAO;QACV,SAAS,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC;QACpC,aAAa,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC;KACpD,CAAC,CAAC;IACH,mIAAmI;IACnI,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IACpE,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC3F,OAAO,KAAK,CAAC,CAAC,OAAO,CAAC;AACvB,CAAC,CAAC,CAAC"}
package/dist/routes.d.ts CHANGED
@@ -14,5 +14,5 @@ export interface McpOptions<E, R> {
14
14
  readonly resourceMetadataUrl: string;
15
15
  readonly version: string;
16
16
  }
17
- export declare function mcpRoutes<E, R>(options: McpOptions<E, R>): Layer.Layer<never, never, HttpRouter.HttpRouter | HttpRouter.Request<"Error", unknown> | HttpRouter.Request<"Requires", import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy> | Exclude<HttpRouter.Request.From<"Requires", Exclude<Exclude<Exclude<R, HttpRouter.HttpRouter>, Identity | SessionUser>, HttpRouter.Provided>>, import("effect/Scope").Scope>>;
17
+ export declare function mcpRoutes<E, R>(options: McpOptions<E, R>): Layer.Layer<never, never, HttpRouter.HttpRouter | HttpRouter.Request<"Error", import("effect/http/HttpServerError").HttpServerError> | HttpRouter.Request<"Error", import("effect/Cause").IllegalArgumentError> | HttpRouter.Request<"Requires", import("@shivaedev/identity/server/SessionPolicy.ts").SessionPolicy> | Exclude<HttpRouter.Request.From<"Error", HttpRouter.Request.Only<"Error", Exclude<Exclude<import("effect/ai/McpServer").McpRequest.Without<R>, import("effect/ai/McpServer").McpServer>, HttpRouter.HttpRouter>>>, import("effect/Scope").Scope> | Exclude<HttpRouter.Request.From<"Error", HttpRouter.Request.Only<"Error", Exclude<HttpRouter.Request.From<"Requires", Exclude<import("effect/ai/McpServer").McpRequest.Only<"Requires", R>, import("effect/ai/McpServer").ProvidedServices<readonly [import("effect/ai/McpProtocol").ProtocolAdapter<"2026-07-28", import("effect/ai/McpProtocol").StatelessRuntimeDescriptor>], true>>>, HttpRouter.HttpRouter>>>, import("effect/Scope").Scope> | Exclude<HttpRouter.Request.From<"Error", HttpRouter.Request.Only<"GlobalError", Exclude<Exclude<import("effect/ai/McpServer").McpRequest.Without<R>, import("effect/ai/McpServer").McpServer>, HttpRouter.HttpRouter>>>, import("effect/Scope").Scope> | Exclude<HttpRouter.Request.From<"Error", HttpRouter.Request.Only<"GlobalError", Exclude<HttpRouter.Request.From<"Requires", Exclude<import("effect/ai/McpServer").McpRequest.Only<"Requires", R>, import("effect/ai/McpServer").ProvidedServices<readonly [import("effect/ai/McpProtocol").ProtocolAdapter<"2026-07-28", import("effect/ai/McpProtocol").StatelessRuntimeDescriptor>], true>>>, HttpRouter.HttpRouter>>>, import("effect/Scope").Scope> | Exclude<HttpRouter.Request.From<"Error", HttpRouter.Request.Without<E>>, import("effect/Scope").Scope> | Exclude<HttpRouter.Request.From<"Requires", Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<Exclude<import("effect/ai/McpServer").McpRequest.Without<R>, import("effect/ai/McpServer").McpServer>, HttpRouter.HttpRouter>>, HttpRouter.HttpRouter>, Identity | SessionUser>, HttpRouter.Provided>>, import("effect/Scope").Scope> | Exclude<HttpRouter.Request.From<"Requires", Exclude<Exclude<Exclude<HttpRouter.Request.Without<Exclude<HttpRouter.Request.From<"Requires", Exclude<import("effect/ai/McpServer").McpRequest.Only<"Requires", R>, import("effect/ai/McpServer").ProvidedServices<readonly [import("effect/ai/McpProtocol").ProtocolAdapter<"2026-07-28", import("effect/ai/McpProtocol").StatelessRuntimeDescriptor>], true>>>, HttpRouter.HttpRouter>>, HttpRouter.HttpRouter>, Identity | SessionUser>, HttpRouter.Provided>>, import("effect/Scope").Scope> | Exclude<HttpRouter.Request.From<"Requires", Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<Exclude<import("effect/ai/McpServer").McpRequest.Without<R>, import("effect/ai/McpServer").McpServer>, HttpRouter.HttpRouter>>, Identity | SessionUser>, HttpRouter.Provided>>, import("effect/Scope").Scope> | Exclude<HttpRouter.Request.From<"Requires", Exclude<Exclude<HttpRouter.Request.Only<"GlobalRequires", Exclude<HttpRouter.Request.From<"Requires", Exclude<import("effect/ai/McpServer").McpRequest.Only<"Requires", R>, import("effect/ai/McpServer").ProvidedServices<readonly [import("effect/ai/McpProtocol").ProtocolAdapter<"2026-07-28", import("effect/ai/McpProtocol").StatelessRuntimeDescriptor>], true>>>, HttpRouter.HttpRouter>>, Identity | SessionUser>, HttpRouter.Provided>>, import("effect/Scope").Scope> | Exclude<HttpRouter.Request.From<"Requires", Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<Exclude<import("effect/ai/McpServer").McpRequest.Without<R>, import("effect/ai/McpServer").McpServer>, HttpRouter.HttpRouter>>, Identity | SessionUser>, HttpRouter.Provided>>, import("effect/Scope").Scope> | Exclude<HttpRouter.Request.From<"Requires", Exclude<Exclude<HttpRouter.Request.Only<"Requires", Exclude<HttpRouter.Request.From<"Requires", Exclude<import("effect/ai/McpServer").McpRequest.Only<"Requires", R>, import("effect/ai/McpServer").ProvidedServices<readonly [import("effect/ai/McpProtocol").ProtocolAdapter<"2026-07-28", import("effect/ai/McpProtocol").StatelessRuntimeDescriptor>], true>>>, HttpRouter.HttpRouter>>, Identity | SessionUser>, HttpRouter.Provided>>, import("effect/Scope").Scope>>;
18
18
  //# sourceMappingURL=routes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"A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AAW,EAAE,MAAM,iCAAiC,CAAC;AAI7E,MAAM,WAAW,QAAQ,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,KAAK;IAC7C,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,EAAE,CAAC;IAC/B,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,SAAS,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC;IACpC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAaD,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,0sIAaxD"}
package/dist/stdio.d.ts CHANGED
@@ -5,5 +5,5 @@ export interface StdioOptions<E, R> {
5
5
  readonly tools: Layer.Layer<never, E, R>;
6
6
  readonly version: string;
7
7
  }
8
- export declare function mcpStdio<E, R>(options: StdioOptions<E, R>): Layer.Layer<never, E | import("effect/Cause").IllegalArgumentError, import("effect/Stdio").Stdio | Exclude<R, McpServer.McpServer | import("effect/ai/McpSchema").McpServerClient>>;
8
+ export declare function mcpStdio<E, R>(options: StdioOptions<E, R>): Layer.Layer<never, E | import("effect/Cause").IllegalArgumentError, import("effect/Stdio").Stdio | Exclude<R, McpServer.McpRequest<"Requires", import("effect/Scope").Scope> | McpServer.McpServer>>;
9
9
  //# sourceMappingURL=stdio.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAe,SAAS,EAAE,MAAM,WAAW,CAAC;AAEnD,MAAM,WAAW,YAAY,CAAC,CAAC,EAAE,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,uLAUzD"}
1
+ {"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAe,SAAS,EAAE,MAAM,WAAW,CAAC;AAEnD,MAAM,WAAW,YAAY,CAAC,CAAC,EAAE,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,wMAUzD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shivaedev/mcp",
3
- "version": "0.8.4",
3
+ "version": "0.9.1",
4
4
  "description": "Identity-aware Effect MCP tools mounted on the application host",
5
5
  "keywords": [
6
6
  "effect"
@@ -43,28 +43,28 @@
43
43
  "README.md"
44
44
  ],
45
45
  "dependencies": {
46
- "@shivaedev/access": "0.5.1",
47
- "@shivaedev/errors": "0.9.1",
48
- "@shivaedev/identity": "0.26.2"
46
+ "@shivaedev/access": "0.6.0",
47
+ "@shivaedev/errors": "0.10.0",
48
+ "@shivaedev/identity": "0.28.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@effect/platform-node": "4.0.7",
52
- "@effect/sql-pg": "4.0.7",
53
- "@shivaedev/quality": "0.63.0",
54
- "@shivaedev/rate-limit": "0.5.3",
55
- "@shivaedev/server": "0.26.0",
56
- "@shivaedev/test-kits": "0.6.0",
57
- "@shivaedev/test-sql": "0.22.0",
58
- "@shivaedev/test-story": "0.40.0",
51
+ "@effect/platform-node": "4.1.0",
52
+ "@effect/sql-pg": "4.1.0",
53
+ "@shivaedev/quality": "0.66.0",
54
+ "@shivaedev/rate-limit": "0.6.1",
55
+ "@shivaedev/server": "0.28.0",
56
+ "@shivaedev/test-kits": "0.8.1",
57
+ "@shivaedev/test-sql": "0.24.1",
58
+ "@shivaedev/test-story": "0.42.1",
59
59
  "@types/node": "24.19.2",
60
60
  "better-auth": "1.7.14",
61
- "effect": "4.0.7",
61
+ "effect": "4.1.0",
62
62
  "typescript": "7.0.2",
63
63
  "vitest": "5.0.5"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "better-auth": "1.7.14",
67
- "effect": "4.0.7"
67
+ "effect": "4.1.0"
68
68
  },
69
69
  "peerDependenciesMeta": {
70
70
  "better-auth": {
@@ -7,11 +7,16 @@ import type { McpOptions } from "./routes.ts";
7
7
 
8
8
  export const requestServer = Effect.fn("Mcp.requestServer")(function* <E, R>(options: McpOptions<E, R>) {
9
9
  const user = yield* SessionUser;
10
- const inner = yield* HttpRouter.make;
11
- const transport = McpServer.layerHttpRequestScoped({ ...options, protocols: [McpProtocol.v2026_07_28] });
12
10
  const tools = options.audiences
13
11
  .filter(({ permission }) => permission === undefined || hasPermission(user, permission))
14
12
  .map((audience) => audience.tools);
15
- yield* Layer.build(Layer.mergeAll(transport, ...tools)).pipe(Effect.provideService(HttpRouter.HttpRouter, inner));
16
- return yield* inner.asHttpEffect();
13
+ const transport = McpServer.layerHttpRequestScoped({
14
+ ...options,
15
+ protocols: [McpProtocol.v2026_07_28],
16
+ registrations: Layer.mergeAll(Layer.empty, ...tools),
17
+ });
18
+ // A router built from the shared HttpRouter.layer would come back memoized as the app's own router, which already holds this path.
19
+ const router = Layer.effect(HttpRouter.HttpRouter, HttpRouter.make);
20
+ const handler = yield* HttpRouter.toHttpEffect(transport.pipe(Layer.provideMerge(router)));
21
+ return yield* handler;
17
22
  });