@softure-ai/mcp-access 0.2.3 → 0.2.4

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
@@ -4,6 +4,15 @@ Newest first. Each version lists what changed for an app that uses `@softure-ai/
4
4
  production, the version gets a line `verified in: <app>@<commit>` ([docs/05](../../docs/05-adoption-playbook.md),
5
5
  "Definition of done"). Versions before the first one below are described in their GitHub Releases (`mcp-access@x.y.z`).
6
6
 
7
+ ## 0.2.4
8
+
9
+ - `stdio/register` works for CommonJS (#571): it resolved `server-only` to a `data:` module, which an ES `import`
10
+ loads but a CommonJS `require` reads as a file path (`ENOENT … open 'data:text/javascript,…'`), so every `.cjs` file
11
+ and every script tsx compiles to CommonJS failed. It now resolves the installed `server-only` through its
12
+ `react-server` condition to the package's empty file, which both loaders open; nothing else resolves differently.
13
+ Migrate: an app that seeds `require.cache` for `server-only` (with `server-only/empty.js`) in its scripts or its
14
+ stdio entry drops that shim and keeps only `--import @softure-ai/mcp-access/stdio/register` (`node` or `tsx`).
15
+
7
16
  ## 0.2.3
8
17
 
9
18
  - OAuth clients now ask for writes (#553): while `allowWrites` is on, the endpoint's `401` challenge names
package/README.md CHANGED
@@ -204,8 +204,10 @@ claude mcp add acme -e MCP_USER_ID=<account id> -- npx tsx --import @softure-ai/
204
204
  - `canWrite` needs `allowWrites: true` here and the app's `allowWrites`. The token id is `"stdio"`.
205
205
  - The database opens like a package command's (`database.handle`, else `database.url`) and closes with the
206
206
  connection. Messages go to stderr; stdout is the protocol.
207
- - `@softure-ai/mcp-access/stdio/register` (`--import`) resolves `server-only` to an empty module, so a factory
208
- written for Next runs in plain Node. It needs Node 22.15 or later (`module.registerHooks`).
207
+ - `@softure-ai/mcp-access/stdio/register` (`--import`) resolves `server-only` the way Next does (its `react-server`
208
+ condition, the installed package's empty file), so a factory written for Next runs in plain Node, through a
209
+ CommonJS `require` (`.cjs`, scripts tsx compiles to CommonJS) as well as an ES `import`. Without `server-only`
210
+ installed, an ES import gets an empty module. It needs Node 22.15 or later (`module.registerHooks`).
209
211
 
210
212
  ### Catalog parity
211
213
 
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ export const MCP_RATE_LIMIT_BUCKETS = {
30
30
  export const mcpAccess = defineModule({
31
31
  manifest: {
32
32
  id: MODULE_ID,
33
- version: "0.2.3",
33
+ version: "0.2.4",
34
34
  dependsOn: { security: "^0.2.0", auth: "^0.2.0", jobs: "^0.1.1?", ops: "^0.2.0?" },
35
35
  dbSchema: "mcp",
36
36
  tables: ["access_tokens", "oauth_clients", "oauth_authorization_codes", "oauth_grants", "oauth_registration_window"],
@@ -1,10 +1,21 @@
1
- // `node --import @softure-ai/mcp-access/stdio/register` (or `tsx --import …`): resolves `server-only` to
2
- // an empty module, so an MCP server factory written for Next (which marks its files with
3
- // `import "server-only"`) runs in a plain Node process. Nothing else is resolved differently; unlike
1
+ // `node --import @softure-ai/mcp-access/stdio/register` (or `tsx --import …`): resolves `server-only` the way Next
2
+ // does, through its `react-server` condition, to the installed package's empty file, so an MCP server factory written
3
+ // for Next (which marks its files with `import "server-only"`) runs in a plain Node process. The result is a real
4
+ // file, so a CommonJS `require` loads it as well as an ES `import`. Nothing else is resolved differently; unlike
4
5
  // `--conditions=react-server`, React keeps its regular build.
5
6
  import { registerHooks } from "node:module";
7
+ // Only when `server-only` is not installed next to the importer: an ES import still loads this.
6
8
  const EMPTY_MODULE = "data:text/javascript,export%20%7B%7D%3B";
7
9
  registerHooks({
8
- resolve: (specifier, context, nextResolve) => (specifier === "server-only" ? { url: EMPTY_MODULE, format: "module", shortCircuit: true } : nextResolve(specifier, context)),
10
+ resolve: (specifier, context, nextResolve) => {
11
+ if (specifier !== "server-only")
12
+ return nextResolve(specifier, context);
13
+ try {
14
+ return nextResolve(specifier, { ...context, conditions: [...context.conditions, "react-server"] });
15
+ }
16
+ catch {
17
+ return { url: EMPTY_MODULE, format: "module", shortCircuit: true };
18
+ }
19
+ },
9
20
  });
10
21
  //# sourceMappingURL=register.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/stdio/register.ts"],"names":[],"mappings":"AAAA,yGAAyG;AACzG,yFAAyF;AACzF,qGAAqG;AACrG,8DAA8D;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,YAAY,GAAG,yCAAyC,CAAC;AAE/D,aAAa,CAAC;IACZ,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC,SAAS,KAAK,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;CAC5K,CAAC,CAAC"}
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/stdio/register.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,sHAAsH;AACtH,kHAAkH;AAClH,iHAAiH;AACjH,8DAA8D;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,gGAAgG;AAChG,MAAM,YAAY,GAAG,yCAAyC,CAAC;AAE/D,aAAa,CAAC;IACZ,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE;QAC3C,IAAI,SAAS,KAAK,aAAa;YAAE,OAAO,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACxE,IAAI,CAAC;YACH,OAAO,WAAW,CAAC,SAAS,EAAE,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,CAAC,GAAG,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC;QACrG,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;QACrE,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
package/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "id": "mcp-access",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "dependsOn": { "security": "^0.2.0", "auth": "^0.2.0", "jobs": "^0.1.1?", "ops": "^0.2.0?" },
5
5
  "dbSchema": "mcp",
6
6
  "tables": ["access_tokens", "oauth_clients", "oauth_authorization_codes", "oauth_grants", "oauth_registration_window"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softure-ai/mcp-access",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "SOFTURE AI MCP access module: hashed, scoped, expiring access tokens, a rate-limited Bearer endpoint around the app's MCP server factory, and a token page with client setup instructions for Next.js; tool result helpers with a safe error boundary, a stdio entry, a catalog parity check and the softure-mcp prune command.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -34,7 +34,7 @@ export const MCP_RATE_LIMIT_BUCKETS = {
34
34
  export const mcpAccess = defineModule({
35
35
  manifest: {
36
36
  id: MODULE_ID,
37
- version: "0.2.3",
37
+ version: "0.2.4",
38
38
  dependsOn: { security: "^0.2.0", auth: "^0.2.0", jobs: "^0.1.1?", ops: "^0.2.0?" },
39
39
  dbSchema: "mcp",
40
40
  tables: ["access_tokens", "oauth_clients", "oauth_authorization_codes", "oauth_grants", "oauth_registration_window"],
@@ -1,11 +1,20 @@
1
- // `node --import @softure-ai/mcp-access/stdio/register` (or `tsx --import …`): resolves `server-only` to
2
- // an empty module, so an MCP server factory written for Next (which marks its files with
3
- // `import "server-only"`) runs in a plain Node process. Nothing else is resolved differently; unlike
1
+ // `node --import @softure-ai/mcp-access/stdio/register` (or `tsx --import …`): resolves `server-only` the way Next
2
+ // does, through its `react-server` condition, to the installed package's empty file, so an MCP server factory written
3
+ // for Next (which marks its files with `import "server-only"`) runs in a plain Node process. The result is a real
4
+ // file, so a CommonJS `require` loads it as well as an ES `import`. Nothing else is resolved differently; unlike
4
5
  // `--conditions=react-server`, React keeps its regular build.
5
6
  import { registerHooks } from "node:module";
6
7
 
8
+ // Only when `server-only` is not installed next to the importer: an ES import still loads this.
7
9
  const EMPTY_MODULE = "data:text/javascript,export%20%7B%7D%3B";
8
10
 
9
11
  registerHooks({
10
- resolve: (specifier, context, nextResolve) => (specifier === "server-only" ? { url: EMPTY_MODULE, format: "module", shortCircuit: true } : nextResolve(specifier, context)),
12
+ resolve: (specifier, context, nextResolve) => {
13
+ if (specifier !== "server-only") return nextResolve(specifier, context);
14
+ try {
15
+ return nextResolve(specifier, { ...context, conditions: [...context.conditions, "react-server"] });
16
+ } catch {
17
+ return { url: EMPTY_MODULE, format: "module", shortCircuit: true };
18
+ }
19
+ },
11
20
  });