@nifrajs/mcp 5.1.0 → 5.2.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.
Files changed (2) hide show
  1. package/CHANGELOG.md +428 -0
  2. package/package.json +6 -5
package/CHANGELOG.md ADDED
@@ -0,0 +1,428 @@
1
+ # @nifrajs/mcp
2
+
3
+ ## 5.2.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 9498cf8: The package ships its `CHANGELOG.md`, so the installed package has the notes for every version, as the GitHub release does. Before, the tarball held only the code, `README.md`, `LICENSE` and `package.json`.
8
+ - Updated dependencies [9498cf8]
9
+ - @nifrajs/agent-protocol@5.2.0
10
+
11
+ ## 5.1.0
12
+
13
+ ### Patch Changes
14
+
15
+ - abb4354: The package now ships the MIT `LICENSE` text, as every other @nifrajs package already did.
16
+ - 2b8f235: The HTTP transport no longer opens its GET server-message stream for a caller it has not checked. With `authorizeMessage` set, a GET that asks for `text/event-stream` is now answered `405` (the Streamable HTTP answer for "no stream offered here"), since that stream carries no message the callback could authorize; before, any caller could open one and hold it with keep-alive comments. Without `authorizeMessage`, the stream now closes after five minutes, and a client that wants it again reconnects. Nothing is sent on this stream, so no message is lost; tool calls and their progress still travel on the POST stream.
17
+ - Updated dependencies [abb4354]
18
+ - @nifrajs/agent-protocol@5.1.0
19
+
20
+ ## 5.0.0
21
+
22
+ ### Minor Changes
23
+
24
+ - 1af7543: Event streams stay bounded for a client that stops reading. `mountAgent` takes `maxOutputBytes` (default 4 MiB): past it an SSE response ends with an `output_limit` error frame, and with an `evidenceLog` a `Last-Event-ID` reconnect reads on. `respondMcpHttp` and `createMcpServer` take `maxPendingBytes` (default 4 MiB): an SSE stream with more than that waiting for its client is dropped and its tool call cancelled. The coding agent's `turn.send` stream advances the backend only as the client reads, and a resumable follower that falls `replayBytes` behind is dropped and can attach again from its cursor.
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies [36bdc71]
29
+ - Updated dependencies [2198640]
30
+ - Updated dependencies [6b0db44]
31
+ - Updated dependencies [a3b3c51]
32
+ - Updated dependencies [6b96131]
33
+ - Updated dependencies [d6a7fa0]
34
+ - Updated dependencies [343bae0]
35
+ - Updated dependencies [b435f13]
36
+ - Updated dependencies [6340cd8]
37
+ - Updated dependencies [34b3014]
38
+ - Updated dependencies [848ce97]
39
+ - Updated dependencies [a0a02f4]
40
+ - Updated dependencies [0aed425]
41
+ - Updated dependencies [eaf030b]
42
+ - Updated dependencies [7de0397]
43
+ - Updated dependencies [1af7543]
44
+ - Updated dependencies [4199ff3]
45
+ - Updated dependencies [90d9ee6]
46
+ - Updated dependencies [364a234]
47
+ - Updated dependencies [c06cba5]
48
+ - Updated dependencies [f4d3852]
49
+ - Updated dependencies [4a82ae0]
50
+ - Updated dependencies [0ff867a]
51
+ - Updated dependencies [e7391bf]
52
+ - Updated dependencies [0b80a59]
53
+ - Updated dependencies [c64db12]
54
+ - Updated dependencies [3753104]
55
+ - Updated dependencies [4b3b1fa]
56
+ - Updated dependencies [3562557]
57
+ - Updated dependencies [53087f3]
58
+ - Updated dependencies [2def6c7]
59
+ - Updated dependencies [b5b5bc3]
60
+ - Updated dependencies [22e1777]
61
+ - Updated dependencies [3a483cd]
62
+ - Updated dependencies [35f52c7]
63
+ - Updated dependencies [343cb81]
64
+ - Updated dependencies [d91fd44]
65
+ - Updated dependencies [b13e071]
66
+ - Updated dependencies [077657f]
67
+ - Updated dependencies [a5963cb]
68
+ - Updated dependencies [05aac0e]
69
+ - Updated dependencies [1a6616f]
70
+ - Updated dependencies [7775c2b]
71
+ - Updated dependencies [846e2f6]
72
+ - Updated dependencies [aadd9fc]
73
+ - Updated dependencies [ea16748]
74
+ - Updated dependencies [fc0284a]
75
+ - Updated dependencies [5b22f4d]
76
+ - Updated dependencies [1b94593]
77
+ - Updated dependencies [9f58295]
78
+ - Updated dependencies [b9608ac]
79
+ - Updated dependencies [7a165de]
80
+ - Updated dependencies [4064f36]
81
+ - Updated dependencies [48aad8c]
82
+ - Updated dependencies [41050ed]
83
+ - Updated dependencies [fc837cb]
84
+ - Updated dependencies [b80ce77]
85
+ - Updated dependencies [9b1acc9]
86
+ - Updated dependencies [740109f]
87
+ - Updated dependencies [e0a25fe]
88
+ - Updated dependencies [3630b6e]
89
+ - Updated dependencies [1290c6d]
90
+ - Updated dependencies [d0a7d58]
91
+ - @nifrajs/agent-protocol@5.0.0
92
+ - @nifrajs/agent@5.0.0
93
+ - @nifrajs/core@5.0.0
94
+
95
+ ## 4.0.2
96
+
97
+ ### Patch Changes
98
+
99
+ - @nifrajs/agent-protocol@4.0.2
100
+
101
+ ## 4.0.1
102
+
103
+ ### Patch Changes
104
+
105
+ - @nifrajs/agent-protocol@4.0.1
106
+
107
+ ## 4.0.0
108
+
109
+ ### Minor Changes
110
+
111
+ - d4d40a5: feat(mcp): `allowedHosts` DNS-rebinding guard
112
+
113
+ `createMcpServer()`, `respondMcpHttp()`, and `serveDatabaseAsMcp()` accept `allowedHosts`. A
114
+ request whose Host is not listed gets 403, with or without an Origin. Set it for servers on
115
+ localhost or a private network, where a DNS-rebound page presents a matching Origin. The check reads
116
+ the inbound `Host` header. Host names compare case-insensitively, an entry without a port matches any
117
+ port, and an entry with a port matches the effective port, so `localhost:80` admits
118
+ `http://localhost/`.
119
+
120
+ The same-origin default now accepts an `https:` Origin on an `http:` request URL (a TLS-terminating
121
+ proxy) and still rejects a downgrade.
122
+
123
+ - 9ccf198: `handleRpc` takes `exposeToolErrors`, which answers a throwing tool with `Tool execution failed: <message>` instead of the bare text. It is off by default, so a remote caller still sees nothing from an error message. `nifra mcp` turns it on for its stdio server, so the local agent sees why a project tool failed, for example the error that stopped the backend from loading.
124
+
125
+ ### Patch Changes
126
+
127
+ - Updated dependencies [6695a23]
128
+ - Updated dependencies [7b2ff47]
129
+ - Updated dependencies [422248c]
130
+ - Updated dependencies [62115dd]
131
+ - Updated dependencies [dbc91b6]
132
+ - Updated dependencies [d2329f5]
133
+ - Updated dependencies [1eb77df]
134
+ - Updated dependencies [dde125b]
135
+ - Updated dependencies [72b62fa]
136
+ - Updated dependencies [aa44e93]
137
+ - Updated dependencies [4a3ee60]
138
+ - Updated dependencies [aad6297]
139
+ - Updated dependencies [dad0d41]
140
+ - Updated dependencies [538adc2]
141
+ - Updated dependencies [f47edd1]
142
+ - Updated dependencies [df9530a]
143
+ - Updated dependencies [3e6973f]
144
+ - Updated dependencies [25e8edf]
145
+ - Updated dependencies [2b5e5fc]
146
+ - Updated dependencies [3b090de]
147
+ - Updated dependencies [da7d792]
148
+ - Updated dependencies [612a296]
149
+ - Updated dependencies [fb14dfa]
150
+ - Updated dependencies [8ae97f6]
151
+ - Updated dependencies [4af6f39]
152
+ - Updated dependencies [ca8b50d]
153
+ - Updated dependencies [b00a889]
154
+ - Updated dependencies [b53d64f]
155
+ - Updated dependencies [66fd712]
156
+ - Updated dependencies [9c3d524]
157
+ - Updated dependencies [738e7a1]
158
+ - Updated dependencies [4801cac]
159
+ - Updated dependencies [1b2d53a]
160
+ - Updated dependencies [25fe13d]
161
+ - Updated dependencies [0852290]
162
+ - Updated dependencies [0589dbe]
163
+ - Updated dependencies [2e2d8c0]
164
+ - Updated dependencies [856f5ce]
165
+ - Updated dependencies [18aa5aa]
166
+ - Updated dependencies [cfd86b3]
167
+ - Updated dependencies [8ff96c9]
168
+ - Updated dependencies [4c46199]
169
+ - Updated dependencies [eef4932]
170
+ - Updated dependencies [6de8686]
171
+ - Updated dependencies [d7892ea]
172
+ - Updated dependencies [4936309]
173
+ - Updated dependencies [ff5a779]
174
+ - Updated dependencies [bbdc5a1]
175
+ - Updated dependencies [10bc446]
176
+ - Updated dependencies [e8270d9]
177
+ - Updated dependencies [ff4a062]
178
+ - Updated dependencies [43ba944]
179
+ - Updated dependencies [46c741a]
180
+ - Updated dependencies [7bfa25e]
181
+ - Updated dependencies [4936309]
182
+ - Updated dependencies [6e257a6]
183
+ - Updated dependencies [4a03d30]
184
+ - Updated dependencies [8e30090]
185
+ - Updated dependencies [28f3aaf]
186
+ - Updated dependencies [6d20355]
187
+ - Updated dependencies [6907cbe]
188
+ - Updated dependencies [b64c3ee]
189
+ - Updated dependencies [bda9637]
190
+ - Updated dependencies [81c720e]
191
+ - Updated dependencies [ed60b23]
192
+ - Updated dependencies [a158b74]
193
+ - Updated dependencies [ff25d68]
194
+ - @nifrajs/agent@4.0.0
195
+ - @nifrajs/core@4.0.0
196
+ - @nifrajs/agent-protocol@4.0.0
197
+
198
+ ## 3.5.0
199
+
200
+ ### Patch Changes
201
+
202
+ - @nifrajs/agent-protocol@3.5.0
203
+
204
+ ## 3.4.0
205
+
206
+ ### Minor Changes
207
+
208
+ - Harden MCP error responses and browser-origin defaults, confine scaffold writes to `routes/`, and
209
+ make sanitized HTML require an explicit sanitizer function.
210
+
211
+ ### Patch Changes
212
+
213
+ - 8d23613: Add the opt-in `@nifrajs/webmcp` package: typed WebMCP registration, core-backed receipts, deterministic predictive-UI reconciliation, and host-independent conformance checks. Also tighten agent execution cancellation cleanup so aborted local work cannot leak into later turns.
214
+ - Updated dependencies [8d23613]
215
+ - @nifrajs/agent-protocol@3.4.0
216
+
217
+ ## 3.3.0
218
+
219
+ ## 3.2.0
220
+
221
+ ### Patch Changes
222
+
223
+ - 1a041a9: Add provider-neutral gateway and deployment contracts with deterministic reference adapters and evidence-safe policy checks.
224
+ - cefedc2: Stream progress notifications and final JSON-RPC responses over `text/event-stream`, and support
225
+ cancellable SSE GET connections for Streamable HTTP clients.
226
+
227
+ ## 3.1.0
228
+
229
+ ## 3.0.0
230
+
231
+ ### Patch Changes
232
+
233
+ - Updated dependencies [f3d2a35]
234
+ - Updated dependencies [6e43c15]
235
+ - Updated dependencies [f0fd370]
236
+ - Updated dependencies [86a555b]
237
+ - Updated dependencies [8c5f4cf]
238
+ - Updated dependencies [f0fd370]
239
+ - Updated dependencies [381bbf3]
240
+ - Updated dependencies [36801ae]
241
+ - Updated dependencies [9acadba]
242
+ - Updated dependencies [99fc683]
243
+ - Updated dependencies [73d894d]
244
+ - @nifrajs/core@3.0.0
245
+
246
+ ## 2.14.1
247
+
248
+ ## 2.14.0
249
+
250
+ ## 2.13.0
251
+
252
+ ## 2.12.1
253
+
254
+ ## 2.12.0
255
+
256
+ ### Minor Changes
257
+
258
+ - cb04de8: New `authorizeMessage` option on `createMcpServer` (and per request via
259
+ `mcp.fetch(request, { authorizeMessage })`): a hook run once per parsed message, before any tool runs,
260
+ that answers `403` with a JSON-RPC `unauthorized` error (`MCP_ERROR.UNAUTHORIZED`) when it returns
261
+ `false`. The HTTP layer above an MCP mount only ever sees one opaque POST, so a route guard cannot
262
+ express "this caller may list tools but may not call the write ones" - this is the seam that can. It
263
+ runs after the body has been read under `maxBodyBytes`, so it costs no second read of the stream.
264
+ - e2d1939: Add typed tool contracts with shared fail-closed adapters, static verification work graphs, bounded provider-neutral agent turns, deterministic trajectory replay, and an explicit execution-policy seam with a non-isolating local process adapter.
265
+
266
+ ### Patch Changes
267
+
268
+ - f3cc02e: `handleRpc` rejects a `tools/call` whose request id is already in flight, with
269
+ `-32600 duplicate request id is already in progress`, instead of starting a second call under the same
270
+ id. Registering the second call overwrote the first's `AbortController`, so `notifications/cancelled`
271
+ for that id then cancelled only the newer call and left the earlier one running with nothing able to
272
+ stop it. JSON-RPC requires an id to be unique among in-flight requests, so no conforming client is
273
+ affected.
274
+
275
+ ## 2.11.0
276
+
277
+ ## 2.10.0
278
+
279
+ ## 2.9.1
280
+
281
+ ## 2.9.0
282
+
283
+ ## 2.8.2
284
+
285
+ ### Patch Changes
286
+
287
+ - f7d68e8: Numeric limit options (body/payload byte caps, TTLs, cache sizes, concurrency, ISR revalidate windows) are now validated at construction and throw a `RangeError` on non-finite or out-of-range values instead of silently disabling the bound - a `NaN` cap previously made `size > max` comparisons fail open. JWT `requiredClaims` now checks own properties only, so inherited names like `toString` no longer satisfy a required claim. `@nifrajs/mcp-db` gates multi-statement input with a real tokenizer, bounds `run_query` materialization to `maxRows + 1` via a wrapping subquery, and skips SQLite planner pseudo-nodes when verifying the table allowlist. `nifra scaffold` refuses to write through symlinked route directories.
288
+
289
+ ## 2.8.1
290
+
291
+ ## 2.8.0
292
+
293
+ ## 2.7.1
294
+
295
+ ## 2.7.0
296
+
297
+ ## 2.6.1
298
+
299
+ ## 2.6.0
300
+
301
+ ### Minor Changes
302
+
303
+ - 10fb70c: `defineMcpTool` accepts `annotations` (the MCP tool safety hints - `readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`, `title`), surfaced in `tools/list` and `tools/describe`. Hosts use these to pick confirmation UX, and connector directory reviews expect every tool to declare them. The hosted docs tools (`nifra_docs`, `nifra_example`, `nifra_types`, `nifra_learn`, `nifra_examples_app`) now all declare themselves read-only and closed-world.
304
+
305
+ ## 2.5.0
306
+
307
+ ### Minor Changes
308
+
309
+ - 3731c69: Add the 2026-07-28 modern MCP transport alongside the handshake, so a server speaks both eras on one endpoint. It implements `server/discover` (advertising supported versions, capabilities, and identity), per-request protocol-version negotiation (an `UnsupportedProtocolVersionError` for a version the server does not speak), the `resultType` completion envelope with cache hints on list/read results, and - over HTTP - validation of the mirrored `Mcp-Method`/`Mcp-Name`/`MCP-Protocol-Version` headers against the request body (a `HeaderMismatch` answered with 400) plus the spec's status codes (404 for an unknown method). Clients that still use the `initialize` handshake are served exactly as before. `createMcpServer` and the HTTP handler gain an `instructions` field surfaced in discovery.
310
+ - 0740f77: Harden the Streamable HTTP transport so a hosted MCP server loads cleanly as a remote connector. The CORS preflight now allows the request headers browser-based clients send (`MCP-Protocol-Version`, `Mcp-Method`, `Mcp-Name`, `Authorization`, `Accept`, `Last-Event-ID`) and exposes the protocol-version header. `initialize` negotiates the protocol version, echoing the client's requested revision when the server also speaks it. Notifications are acknowledged with `202 Accepted`; a `GET` that requests `text/event-stream` returns `405`; and `respondMcpHttp` gains an `allowedOrigins` option that rejects any other browser origin with `403` as a DNS-rebinding guard (omitted by default, so a public server stays open).
311
+
312
+ ## 2.4.0
313
+
314
+ ## 2.3.0
315
+
316
+ ## 2.2.0
317
+
318
+ ## 2.1.0
319
+
320
+ ## 2.0.0
321
+
322
+ ### Major Changes
323
+
324
+ - d91a45b: Remove Nifra's remaining deprecated and compatibility-only public surfaces for the 2.0 cutover.
325
+
326
+ - `@nifrajs/core` and `nifra` now expose only the lean HTTP server API at their package roots. Import
327
+ optional systems from their documented subpaths. The deprecated invariant runner and the
328
+ `@nifrajs/budget` compatibility package are removed; use `@nifrajs/testing` and
329
+ `@nifrajs/core/budget` respectively.
330
+ - Web redirects accept only an options object as their second argument, the prerender enumeration
331
+ wrapper is removed in favor of `enumerateStaticRoutes()`, and fragment navigation resolves IDs only.
332
+ - MCP Apps metadata uses only `_meta.ui.resourceUri`; the deprecated flat `ui/resourceUri` key is gone.
333
+ - Telemetry uses `ObservationAdapter` directly; the `AgentSpan`, `AgentSpanExporter`, and `SpanExporter`
334
+ aliases are removed.
335
+ - Invalid HTTP method overrides always fail closed with 400; the legacy ignore mode is removed.
336
+ - `nifra build` always emits a complete target deploy directory and defaults to Bun. The old
337
+ client-only build branch is removed; `nifra start` runs the generated Bun `server.js`.
338
+
339
+ ### Minor Changes
340
+
341
+ - 202e758: Schema-typed MCP tools, and the default template demonstrates the contract.
342
+
343
+ - `defineMcpTool` accepts `input`: a Standard Schema (nifra's `t`, zod, valibot, arktype, …) that
344
+ validates every call's arguments before the handler runs and types the handler's `args`. Invalid
345
+ arguments return an in-band `isError` result naming each issue, so a calling agent can correct
346
+ and retry. Schemas that carry a JSON Schema (nifra's `t` does) become the advertised
347
+ `inputSchema` automatically; an explicit `inputSchema` still overrides. The raw
348
+ `inputSchema`-only form keeps working unchanged.
349
+ - The `api` template's app now ships a `t`-validated route (body + response schemas) and its tests
350
+ drive the app through `testClient` - the contract-first pitch is visible in the first file a new
351
+ user opens, not just the docs.
352
+
353
+ ## 1.13.0
354
+
355
+ ## 1.12.0
356
+
357
+ ## 1.11.0
358
+
359
+ ## 1.10.0
360
+
361
+ ## 1.9.1
362
+
363
+ ### Patch Changes
364
+
365
+ - 3eb27ae: Internal tidy - remove a dead local variable in the query engine and clean up example wording in doc comments. No API or behavior change.
366
+
367
+ ## 1.9.0
368
+
369
+ ## 1.8.0
370
+
371
+ ## 1.7.0
372
+
373
+ ## 1.6.0
374
+
375
+ ## 1.5.0
376
+
377
+ ## 1.4.0
378
+
379
+ ## 1.3.1
380
+
381
+ ## 1.3.0
382
+
383
+ ### Minor Changes
384
+
385
+ - 4a4b1c4: feat: MCP tool annotations on `server().tool()`
386
+
387
+ `.tool()` config now accepts `annotations` - the MCP spec's per-tool safety hints (`title`, `readOnlyHint`,
388
+ `destructiveHint`, `idempotentHint`, `openWorldHint`) - surfaced in `tools/list` and `tools/describe`. An
389
+ agent can now tell a read-only tool from a destructive one and decide whether to auto-invoke or confirm
390
+ first, instead of treating every exposed tool as equally risky.
391
+
392
+ ## 1.2.2
393
+
394
+ ## 1.2.1
395
+
396
+ ## 1.2.0
397
+
398
+ ## 1.1.0
399
+
400
+ ## 1.0.0
401
+
402
+ ### Minor Changes
403
+
404
+ - c099d5f: Add `@nifrajs/mcp` - build MCP servers, and **MCP Apps** (interactive `ui://` widgets, SEP-1865), for a nifra app.
405
+
406
+ MCP tools have only ever returned text. MCP Apps lets a tool return **interactive UI**: a tool links a `ui://` resource (MIME `text/html;profile=mcp-app`); the host renders it in a sandboxed iframe and bridges it to the server over MCP-JSON-RPC-on-`postMessage`. `@nifrajs/mcp` ships:
407
+
408
+ - The transport-agnostic JSON-RPC core (`handleRpc`, shared with `@nifrajs/cli`'s dev MCP) extended for MCP Apps - `structuredContent`, `_meta.ui.resourceUri`, and the `io.modelcontextprotocol/ui` capability.
409
+ - `respondMcpHttp` - a Web `fetch` handler you mount at `POST /mcp`. nifra route handlers can return a raw `Response`, so mounting is one line per verb.
410
+ - `defineMcpWidget` - author a `ui://` widget as one self-contained HTML doc with a tiny zero-dependency `postMessage` bridge inlined (`mcpApp.onData(render)` to render the host-pushed `structuredContent`; `mcpApp.callTool(...)` to re-invoke a tool through the host).
411
+ - `defineMcpTool` + `createMcpServer` - wire tools to widgets and get a mountable server. See `examples/mcp-app/`.
412
+ - `@nifrajs/mcp/react` - `reactWidget({ component })` authors a widget from a React component instead of an HTML string: the component is bundled for the browser (Bun.build) and re-renders on each `structuredContent` push over the bridge. `react`/`react-dom` resolve from the consumer; the core stays dependency-free.
413
+ - **Host theming + render intent** (see `THEMING.md`). `defineMcpTool({ intent })` adds `_meta.ui.intent` (`table`/`list`/`form`/…) so a generative host renders `structuredContent` with its own themed component. For iframe widgets, the bridge handles a `ui/notifications/theme` push and auto-applies the host's shadcn/Tailwind semantic tokens (`--primary`, `--card`, `--border`, `--radius`, …) to the widget root - so a widget that styles with `hsl(var(--primary))` matches the embedding app with zero extra code.
414
+
415
+ `@nifrajs/cli`'s MCP protocol core moved into `@nifrajs/mcp` (the CLI re-exports it); behavior is unchanged - a tool whose handler returns a plain `string` behaves exactly as before. nifra's own public docs MCP (nifra.dev `/mcp`) now also dogfoods this - `nifra_examples_app` renders the examples as an interactive widget.
416
+
417
+ ### Patch Changes
418
+
419
+ - de9675b: Pre-1.0 security hardening pass. A framework-wide audit found no critical/high issues; these close the medium/low items it surfaced.
420
+
421
+ - **`cache()` - no cross-user leak by default.** A `200` to a request bearing `Authorization`/`Cookie` is no longer stored (and replayed to other users) unless the response is explicitly `Cache-Control: public`/`s-maxage` (RFC 9111 §3.5). Opt back in per cache with `cacheAuthenticated: true` for a route that's identical for every caller.
422
+ - **`idempotency()` - route-scoped keys + a `key` hook.** The default store key is now scoped by method+path, so the same `Idempotency-Key` on a different endpoint can't collide and replay another resource's response. Added a `key(req, header)` option to scope by principal (e.g. user id). Method matching normalized to upper-case.
423
+ - **`etag()` - a `304` no longer carries the `200`'s `Content-Length`/`Content-Type`.**
424
+ - **`@nifrajs/core` - inbound WebSocket frames are capped** when serving on Bun (`listen()`): frames over `wsMaxPayloadBytes` (default `maxBodyBytes`, 1 MB) are rejected by the runtime before reaching a handler, so a huge frame can't be buffered/parsed into memory. New `ServerOptions.wsMaxPayloadBytes`.
425
+ - **`@nifrajs/core` - WebSocket routes are same-origin by default (CSWSH).** A `ws()` route with no `allowedOrigins` now rejects a **cross-origin browser** handshake (an `Origin` whose host differs from the request's) with `403` - closing cross-site WebSocket hijacking, since browsers send cookies on WS handshakes and don't apply CORS. Non-browser clients (no `Origin`) and same-origin browsers are unaffected. **Breaking** for a route that served a cross-origin browser without declaring `allowedOrigins`: set `allowedOrigins` to the permitted origins (or `() => true` for a genuinely public socket).
426
+ - **`@nifrajs/node` - static file handler** now adds `X-Content-Type-Options: nosniff` and re-checks the real path (symlink containment) before streaming, matching the image server.
427
+ - **`@nifrajs/mcp` - widget bridge** now rejects `postMessage` events whose source isn't the parent window (including null-source synthetic events), closing a spoofing gap the previous guard left open.
428
+ - **`@nifrajs/cli` - the MCP `nifra_run`/`nifra_ws` `entry` arg** is kept inside the project root, so a crafted `entry` can't import/execute a module outside the project.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nifrajs/mcp",
3
- "version": "5.1.0",
3
+ "version": "5.2.0",
4
4
  "description": "Build MCP servers - and MCP Apps (interactive `ui://` widgets, SEP-1865) - for a nifra app. The transport-agnostic JSON-RPC core (also used by `@nifrajs/cli`'s dev MCP), a Streamable-HTTP handler you mount at `POST /mcp`, and `defineMcpWidget`/`defineMcpTool` for tool results that render real UI in MCP hosts.",
5
5
  "keywords": [
6
6
  "bun",
@@ -56,7 +56,8 @@
56
56
  },
57
57
  "files": [
58
58
  "dist",
59
- "src"
59
+ "src",
60
+ "CHANGELOG.md"
60
61
  ],
61
62
  "sideEffects": false,
62
63
  "scripts": {
@@ -67,11 +68,11 @@
67
68
  "access": "public"
68
69
  },
69
70
  "dependencies": {
70
- "@nifrajs/agent-protocol": "5.1.0"
71
+ "@nifrajs/agent-protocol": "5.2.0"
71
72
  },
72
73
  "peerDependencies": {
73
- "@nifrajs/agent": "^5.1.0",
74
- "@nifrajs/core": "^5.1.0"
74
+ "@nifrajs/agent": "^5.2.0",
75
+ "@nifrajs/core": "^5.2.0"
75
76
  },
76
77
  "peerDependenciesMeta": {
77
78
  "@nifrajs/agent": {