@rsc-kit/mcp 0.36.0 → 0.38.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.
@@ -108,7 +108,9 @@ browser → renderer ──render──▶ React
108
108
  the React tree has it, React renders it; otherwise the backend does. Nothing
109
109
  is half-and-half on one url. A dynamic root route that would also match one
110
110
  of the backend's urls does not get it: name the backend's prefixes with
111
- `backendPaths` and they go first. The build lists them in
111
+ `backendPaths` and they go first. A whole segment in brackets is any one
112
+ segment (`'/login/[provider]'` is `/login/google` and what is under it, not
113
+ `/login`), and a page it would cover stops the build. The build lists the plain prefixes in
112
114
  `.output/rsc-kit.json`, so a proxy in front can send them straight to the
113
115
  backend without going through the renderer
114
116
  ([deployment](/hosts/deployment/#sending-the-backends-urls-past-the-renderer)).
@@ -310,7 +310,10 @@ the rest with `info`.
310
310
  `[]` when it names none, so a proxy can tell "none" from a build too old to say
311
311
  (before 0.30.53). The renderer forwards those urls to the backend anyway, but
312
312
  every request it forwards costs its CPU and memory and is cut off by its
313
- timeouts. A proxy in front can send them straight to the backend:
313
+ timeouts. A proxy in front can send them straight to the backend. The list is
314
+ the plain prefixes only, so "equal to one or under it" stays the whole rule: an
315
+ entry with a dynamic segment (`'/login/[provider]'`) is left out, and reaches
316
+ the backend through the renderer.
314
317
 
315
318
  ```json
316
319
  { "version": "0.30.53", "output": "server", "backendPaths": ["/auth", "/github"] }
package/guides/domains.md CHANGED
@@ -190,8 +190,35 @@ as it was rendered, and it works in `visit()` and `redirect()` too. On the
190
190
  host it names already, Link navigates without a reload; to another host it is
191
191
  a full page load, as a link to another origin always is.
192
192
 
193
- Nothing redirects between the two addresses. When one of them should not be
194
- reachable, a `redirect()` in that folder's `middleware.ts` says which.
193
+ Nothing redirects between the two addresses unless you name the folder, below.
194
+
195
+ ## A folder that lives on its subdomain
196
+
197
+ When a folder is only ever meant to be seen on its subdomain - a merchant
198
+ dashboard, an admin - name it, and its subdomain becomes the page's only url:
199
+
200
+ ```ts title="vite.config.ts"
201
+ rscKit({ hosts: [new URL(env.APP_URL).host], subdomains: ['merchant'] })
202
+ ```
203
+
204
+ - `example.com/merchant/orders` answers 301 to `merchant.example.com/orders`,
205
+ query kept. On `localhost` or an address the path form still renders, since
206
+ there is no subdomain of it to go to.
207
+ - `<Link href="/merchant/orders">`, `visit('/merchant/orders')` and
208
+ `redirect('/merchant/orders')` go to `merchant.example.com/orders`: the typed
209
+ href stays the folder path, and the host is placed for you. No `hostUrl`.
210
+ - On the subdomain, a root path that is not under the folder is the site's:
211
+ `<Link href="/pricing">` goes to `example.com/pricing`.
212
+ - The build's route table lists the folder, so a backend that names routes
213
+ puts them on the subdomain - Laravel's `route('merchant.orders')` is
214
+ `https://merchant.example.com/orders`.
215
+
216
+ The trade is that `example.com/merchant` is no longer a page of the site: it
217
+ is the subdomain's home page. A landing page about merchants goes in a folder
218
+ of its own, such as `app/sell/`. It needs the site's host (`hosts`) and a
219
+ folder of that name, or dev and the build stop and say which. `hostUrl` is
220
+ still how you link to a tenant or a custom domain, and still works for a
221
+ named folder.
195
222
 
196
223
  ## Domains in a database
197
224
 
@@ -211,15 +211,15 @@ vendors. A purge that fails is logged and never fails the change: the CDN
211
211
  still drops its copy at its `max-age` in `CDN-Cache-Control`. `purge({ tags, paths, all })` sends
212
212
  one yourself, from a deploy step or a webhook.
213
213
 
214
- With `RSC_PURGE_URL` set, the hook is `homeportPurge()`, posting
215
- `{"tags": [...]}` there, unless you installed another. On Homeport there is
216
- nothing to set: it gives its apps `HOMEPORT_PURGE_URL`, which is read when
217
- `RSC_PURGE_URL` is not. `RSC_PURGE_URL` is read from `@rsc-kit/core` 0.30.53,
218
- `rsc-kit/go` v0.16.1 and `rsc-kit/laravel` 0.20.1; before those, only
219
- `HOMEPORT_PURGE_URL` is. With a Laravel or Go
214
+ With `CDN_PURGE_URL` set, the hook is `cdnPurge()`, posting
215
+ `{"tags": [...]}` there, unless you installed another. It is the only name
216
+ read, and it names neither this engine nor a platform, so a host can set it
217
+ for any framework. `RSC_PURGE_URL` and `HOMEPORT_PURGE_URL` were read before
218
+ and no longer are, and `homeportPurge()` is now `cdnPurge()`, with no alias
219
+ left behind: set `CDN_PURGE_URL` and change the import. With a Laravel or Go
220
220
  backend, the change is made there - `Rsc::changed()`, `reg.Changed()` - and
221
221
  never passes through the engine, so the backend posts the purge itself; both
222
- do when `RSC_PURGE_URL` is set. A tag with a comma or a space cannot go in the header, and
222
+ do when `CDN_PURGE_URL` is set. A tag with a comma or a space cannot go in the header, and
223
223
  is left out with a warning.
224
224
 
225
225
  Homeport's edge is stricter about what it keeps than the page's headers alone
package/guides/go.md CHANGED
@@ -448,7 +448,7 @@ has the whole picture.
448
448
  `export const revalidate = 60` keeps a page and refreshes it behind the visitor,
449
449
  and `reg.Changed(ctx, "posts")` renders it again at once on every instance, when
450
450
  it read that tag through `cache()`. A kept page calls Go as nobody: no `Cookie`,
451
- no `Authorization`. With `RSC_PURGE_URL` set, `Changed` purges the CDN as
451
+ no `Authorization`. With `CDN_PURGE_URL` set, `Changed` purges the CDN as
452
452
  well; `reg.SetPurger` replaces it. Call it after your transaction commits.
453
453
  [ISR](/guides/isr) has the whole of it.
454
454
 
package/guides/laravel.md CHANGED
@@ -151,11 +151,16 @@ Laravel does not route is handed through to the address inside it. Stop the
151
151
  dev server and the file goes with it, and so does the proxy.
152
152
 
153
153
  One dev server per application. A second `vite` in the same app names the
154
- one already running and waits, starting only when that one stops: two at
155
- once would share Vite's pre-bundle cache and break each other
156
- (`ERR_OUTDATED_OPTIMIZED_DEP`). `composer dev`, or Herd running `artisan
157
- dev`, may already have started one for you; use it. Stop it and the waiting
158
- one takes over, so Laravel is never left without a renderer.
154
+ one already running, because two at once would share Vite's pre-bundle cache
155
+ and break each other (`ERR_OUTDATED_OPTIMIZED_DEP`). `composer dev`, or Herd
156
+ running `artisan dev`, may already have started one for you; use it. What the
157
+ second one does next depends on how it was started:
158
+
159
+ - **In a terminal it exits**, with the pid to stop if this is the one you
160
+ wanted.
161
+ - **Under a runner it waits** — `composer dev`, `artisan dev`, an editor
162
+ task — and starts when the first stops, so Laravel is never left without a
163
+ renderer.
159
164
 
160
165
  Per url the rule is: **if the React tree has it, React renders it**;
161
166
  otherwise Laravel does. That holds for a url Laravel also routes — a fresh
@@ -456,7 +461,7 @@ sent after the transaction commits.
456
461
  `export const revalidate = 60` keeps a page and refreshes it behind the visitor,
457
462
  and `Rsc::changed('posts')` renders it again at once on every instance, when it
458
463
  read that tag through `cache()`. A kept page calls PHP as nobody, so
459
- `auth()->user()` is null there. With `RSC_PURGE_URL` set, `Rsc::changed()`
464
+ `auth()->user()` is null there. With `CDN_PURGE_URL` set, `Rsc::changed()`
460
465
  purges the CDN as well, after the transaction commits and the response has gone.
461
466
  [ISR](/guides/isr) has the whole of it.
462
467
 
@@ -657,6 +662,25 @@ Each is a prefix at a segment boundary, for every method, and a team called
657
662
  `auth` is then unreachable. With Laravel in front instead, the routes you
658
663
  registered win over a page route's, which is registered after them.
659
664
 
665
+ A whole segment in brackets is any one segment, for a Laravel route with a
666
+ parameter under a url that is a page:
667
+
668
+ ```ts title="vite.config.ts"
669
+ // Route::get('/login/{provider}', …) beside the page at /login
670
+ rscKit({ backendPaths: ['/login/[provider]'] })
671
+ ```
672
+
673
+ - **What it covers.** `/login/google` and everything under it, such as
674
+ `/login/google/callback`. Not `/login` itself, which stays your page.
675
+ - **What it refuses.** A page it would cover, `login/forgot/page.tsx` here,
676
+ stops `vite dev` and the build with both named: the page would never render,
677
+ since a backend path is forwarded before any page is asked. Nothing is
678
+ checked per request. A dynamic first segment (`/[team]/hooks`) and a
679
+ catch-all are refused too.
680
+ - **A prefix of its own is still simpler.** `Route::prefix('auth')` and
681
+ `backendPaths: ['/auth']` needs no bracket and cannot cover a page by
682
+ accident.
683
+
660
684
  In the browser a named prefix is never a page. A `Link`, `visit()` or
661
685
  `redirect('/oauth/github')` to it loads the document and is never
662
686
  prefetched, so the Laravel route may answer with a redirect to another site, as
@@ -190,6 +190,10 @@ redirect('/gitlab/connect'); // ✅
190
190
  <Link href="/gitlabs">…</Link> // ❌ not the prefix
191
191
  ```
192
192
 
193
+ A dynamic segment in one is any string there: `backendPaths: ['/login/[provider]']`
194
+ types `/login/google` and `/login/google/callback`, and leaves `/login` to the
195
+ page.
196
+
193
197
  The prefix is a segment boundary, as it is for the server: `/gitlab`, anything
194
198
  under it, and a query or fragment, never `/gitlabs`. What is behind it is the
195
199
  backend's, so nothing past the prefix is checked. Like a `route.ts`, the browser
@@ -333,7 +333,7 @@ so no authorization is needed here beyond the secret.
333
333
  **A purge, when a CDN keeps pages.** A `revalidate` page goes out with the
334
334
  `Cache-Tag` of every `cache()` answer it used, and the names you change are
335
335
  those tags. A change you make never passes through the renderer, so when
336
- `RSC_PURGE_URL` is set, your backend tells the CDN itself: after the
336
+ `CDN_PURGE_URL` is set, your backend tells the CDN itself: after the
337
337
  version has moved - after the transaction commits, and after the call has
338
338
  answered if you can - post
339
339
 
@@ -486,7 +486,7 @@ visitor to `/conformance-login`, and `conformance-page`, which passes only when
486
486
  the page it is asked about is `/conformance/orders/7` with `{order}` bound to
487
487
  `"7"`. Then serve them and run:
488
488
 
489
- Start it with `RSC_PURGE_URL=http://127.0.0.1:8790/`, where the suite
489
+ Start it with `CDN_PURGE_URL=http://127.0.0.1:8790/`, where the suite
490
490
  listens for its purges, and `RSC_HOST_CALL_SECRET_PREVIOUS=old`, then:
491
491
 
492
492
  ```sh
@@ -520,7 +520,7 @@ It checks the whole contract on this page:
520
520
  - **live data** - a name never changed at 0, a change moving it to a time in
521
521
  milliseconds that never comes round again, only the names that differ
522
522
  answered, and a held call bounded by `wait`;
523
- - **purges** - a change posted to `RSC_PURGE_URL` as its tag, as JSON,
523
+ - **purges** - a change posted to `CDN_PURGE_URL` as its tag, as JSON,
524
524
  only once the version has moved. Without `--purge-port` these fail: every
525
525
  adapter purges.
526
526
  - **debug** - with `--debug`, for an adapter started with its debug on, a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsc-kit/mcp",
3
- "version": "0.36.0",
3
+ "version": "0.38.0",
4
4
  "description": "An MCP server over what an rsc-kit build decided: the routes, why each one is static or not, and what it costs the browser.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@modelcontextprotocol/sdk": "^1.30.0",
37
- "create-rsc-kit": "^0.36.0",
37
+ "create-rsc-kit": "^0.38.0",
38
38
  "zod": "^3.25"
39
39
  },
40
40
  "devDependencies": {