@shivaedev/mcp 0.6.1 → 0.7.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 +18 -0
- package/README.md +24 -1
- package/dist/stdio.d.ts +9 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +10 -0
- package/dist/stdio.js.map +1 -0
- package/package.json +10 -10
- package/src/stdio.ts +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.0 - 2026-11-04
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Serve native Effect toolkit layers over stdio with `mcpStdio` from `@shivaedev/mcp/stdio.ts`. The server scope owns the transport and tool handlers, including cancellation and resource cleanup.
|
|
8
|
+
|
|
9
|
+
## 0.6.3 - 2026-11-03
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Update `@shivaedev/identity` from 0.22.0 to 0.22.1.
|
|
14
|
+
|
|
15
|
+
## 0.6.2 - 2026-11-03
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Update `@shivaedev/identity` from 0.21.0 to 0.22.0.
|
|
20
|
+
|
|
3
21
|
## 0.6.1 - 2026-11-03
|
|
4
22
|
|
|
5
23
|
### Changed
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @shivaedev/mcp
|
|
2
2
|
|
|
3
|
-
Let AI clients act on application data
|
|
3
|
+
Let AI clients act on application data through native Effect toolkits. Mount them on your application host with the same identity and permissions as your contracts, or serve them locally over stdio.
|
|
4
4
|
|
|
5
5
|
## Tools for each audience
|
|
6
6
|
|
|
@@ -64,6 +64,29 @@ const adminTools = McpServer.toolkit(AdminTools).pipe(
|
|
|
64
64
|
|
|
65
65
|
Application roles and grants come from `@shivaedev/access`; identity resolves the current stored role and checks those grants. An audience without a permission is available to every signed-in caller. Add `failure: YourErrorSchema` to a tool and return that failure in its Effect handler; native MCP error results carry the declared failure.
|
|
66
66
|
|
|
67
|
+
### Run a local stdio server
|
|
68
|
+
|
|
69
|
+
Use `mcpStdio` from `@shivaedev/mcp/stdio.ts` when an MCP client starts your integration as a child process. Pass the same native toolkit Layer used for HTTP; combine several toolkits with `Layer.mergeAll`. Provide the handlers' application services through Layers.
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
import { NodeRuntime, NodeServices } from "@effect/platform-node";
|
|
73
|
+
import { Effect, Layer, Logger } from "effect";
|
|
74
|
+
import { Identity } from "@shivaedev/identity/identity.ts";
|
|
75
|
+
import { mcpStdio } from "@shivaedev/mcp/stdio.ts";
|
|
76
|
+
|
|
77
|
+
mcpStdio({ name: "Local integration", version: "1", tools: userTools }).pipe(
|
|
78
|
+
Layer.provide(Layer.succeed(Identity, { id: "local-user" })),
|
|
79
|
+
Layer.launch,
|
|
80
|
+
Effect.provideService(Logger.LogToStderr, true),
|
|
81
|
+
Effect.provide(NodeServices.layer),
|
|
82
|
+
NodeRuntime.runMain,
|
|
83
|
+
);
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`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
|
+
|
|
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.
|
|
89
|
+
|
|
67
90
|
### Connect OAuth to identity and the host
|
|
68
91
|
|
|
69
92
|
The Better Auth adapter is an optional edge module. Add its provider to the auth instance used by identity, alongside Better Auth's JWT plugin. `mcpProvider` defaults to the `mcp` scope and configures the endpoint's OAuth resource. Pass `scopes: ["mcp", "offline_access"]` to allow refresh tokens; the client must also register the `refresh_token` grant and request `offline_access` during authorization. The application's login and consent pages implement the provider's ordinary UI flow; the provider owns authorization codes, PKCE and tokens.
|
package/dist/stdio.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Layer } from "effect";
|
|
2
|
+
import { McpServer } from "effect/ai";
|
|
3
|
+
export interface StdioOptions<E, R> {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly tools: Layer.Layer<never, E, R>;
|
|
6
|
+
readonly version: string;
|
|
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>>;
|
|
9
|
+
//# sourceMappingURL=stdio.d.ts.map
|
|
@@ -0,0 +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"}
|
package/dist/stdio.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Layer } from "effect";
|
|
2
|
+
import { McpProtocol, McpServer } from "effect/ai";
|
|
3
|
+
export function mcpStdio(options) {
|
|
4
|
+
return options.tools.pipe(Layer.provide(McpServer.layerStdio({
|
|
5
|
+
name: options.name,
|
|
6
|
+
protocols: [McpProtocol.v2026_07_28, McpProtocol.v2025_11_25],
|
|
7
|
+
version: options.version,
|
|
8
|
+
})));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=stdio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAQnD,MAAM,UAAU,QAAQ,CAAO,OAA2B;IACzD,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CACxB,KAAK,CAAC,OAAO,CACZ,SAAS,CAAC,UAAU,CAAC;QACpB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,SAAS,EAAE,CAAC,WAAW,CAAC,WAAW,EAAE,WAAW,CAAC,WAAW,CAAC;QAC7D,OAAO,EAAE,OAAO,CAAC,OAAO;KACxB,CAAC,CACF,CACD,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Identity-aware Effect MCP tools mounted on the application host",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"effect"
|
|
@@ -43,19 +43,19 @@
|
|
|
43
43
|
"README.md"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@shivaedev/access": "0.4.
|
|
47
|
-
"@shivaedev/errors": "0.
|
|
48
|
-
"@shivaedev/identity": "0.
|
|
46
|
+
"@shivaedev/access": "0.4.2",
|
|
47
|
+
"@shivaedev/errors": "0.8.0",
|
|
48
|
+
"@shivaedev/identity": "0.23.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@effect/platform-node": "4.0.6",
|
|
52
52
|
"@effect/sql-pg": "4.0.6",
|
|
53
|
-
"@shivaedev/quality": "0.
|
|
54
|
-
"@shivaedev/rate-limit": "0.3.
|
|
55
|
-
"@shivaedev/server": "0.
|
|
56
|
-
"@shivaedev/test-kits": "0.1
|
|
57
|
-
"@shivaedev/test-sql": "0.18.
|
|
58
|
-
"@shivaedev/test-story": "0.
|
|
53
|
+
"@shivaedev/quality": "0.58.0",
|
|
54
|
+
"@shivaedev/rate-limit": "0.3.3",
|
|
55
|
+
"@shivaedev/server": "0.22.0",
|
|
56
|
+
"@shivaedev/test-kits": "0.2.1",
|
|
57
|
+
"@shivaedev/test-sql": "0.18.2",
|
|
58
|
+
"@shivaedev/test-story": "0.37.0",
|
|
59
59
|
"@types/node": "24.19.2",
|
|
60
60
|
"better-auth": "1.7.14",
|
|
61
61
|
"effect": "4.0.6",
|
package/src/stdio.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Layer } from "effect";
|
|
2
|
+
import { McpProtocol, McpServer } from "effect/ai";
|
|
3
|
+
|
|
4
|
+
export interface StdioOptions<E, R> {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly tools: Layer.Layer<never, E, R>;
|
|
7
|
+
readonly version: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function mcpStdio<E, R>(options: StdioOptions<E, R>) {
|
|
11
|
+
return options.tools.pipe(
|
|
12
|
+
Layer.provide(
|
|
13
|
+
McpServer.layerStdio({
|
|
14
|
+
name: options.name,
|
|
15
|
+
protocols: [McpProtocol.v2026_07_28, McpProtocol.v2025_11_25],
|
|
16
|
+
version: options.version,
|
|
17
|
+
}),
|
|
18
|
+
),
|
|
19
|
+
);
|
|
20
|
+
}
|