@rsc-kit/mcp 0.40.0 → 0.42.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 (60) hide show
  1. package/dist/recipes.js +37 -20
  2. package/dist/recipes.js.map +1 -1
  3. package/guides/admin-plugins.md +206 -6
  4. package/guides/api-routes.md +159 -215
  5. package/guides/authorization.md +103 -114
  6. package/guides/backend-answered-pages.md +301 -250
  7. package/guides/bap-vs-inertia.md +67 -25
  8. package/guides/blueprints.md +307 -174
  9. package/guides/bun.md +42 -25
  10. package/guides/caching.md +46 -49
  11. package/guides/coming-from-inertia.md +5 -5
  12. package/guides/commands.md +251 -200
  13. package/guides/connection.md +50 -54
  14. package/guides/content-security-policy.md +133 -84
  15. package/guides/domains.md +190 -149
  16. package/guides/edge-caching.md +242 -268
  17. package/guides/emails.md +96 -45
  18. package/guides/errors.md +116 -137
  19. package/guides/feature-flags.md +100 -30
  20. package/guides/file-uploads.md +101 -26
  21. package/guides/fonts.md +139 -110
  22. package/guides/forms.md +520 -538
  23. package/guides/images.md +87 -28
  24. package/guides/index.json +13 -33
  25. package/guides/instrumentation.md +134 -95
  26. package/guides/isr.md +3 -3
  27. package/guides/live-data-in-production.md +695 -0
  28. package/guides/live-data.md +170 -839
  29. package/guides/mcp.md +83 -59
  30. package/guides/metadata.md +124 -179
  31. package/guides/navigation.md +118 -147
  32. package/guides/no-javascript.md +49 -57
  33. package/guides/offline.md +118 -153
  34. package/guides/openapi.md +100 -35
  35. package/guides/pages.md +160 -50
  36. package/guides/ppr.md +178 -256
  37. package/guides/pwa.md +251 -218
  38. package/guides/queries.md +171 -300
  39. package/guides/react-compiler.md +90 -50
  40. package/guides/redirects.md +141 -177
  41. package/guides/response-headers.md +76 -74
  42. package/guides/route-interception.md +112 -111
  43. package/guides/routing.md +216 -322
  44. package/guides/sections.md +63 -66
  45. package/guides/seo-files.md +127 -65
  46. package/guides/server-actions.md +285 -357
  47. package/guides/static-generation.md +131 -199
  48. package/guides/testing.md +272 -150
  49. package/guides/third-party-scripts.md +94 -47
  50. package/guides/typed-routes.md +115 -113
  51. package/guides/url-validation.md +113 -61
  52. package/guides/validation.md +53 -62
  53. package/guides/view-transitions.md +159 -132
  54. package/guides/where-it-runs.md +226 -162
  55. package/package.json +2 -2
  56. package/guides/admin.md +0 -520
  57. package/guides/deployment.md +0 -598
  58. package/guides/go.md +0 -538
  59. package/guides/laravel.md +0 -786
  60. package/guides/your-own-backend.md +0 -587
package/guides/mcp.md CHANGED
@@ -2,16 +2,21 @@
2
2
 
3
3
  > An MCP server that answers from your actual build, and the AGENTS.md written into every project.
4
4
 
5
- Two things ship for this, and they do different jobs.
5
+ Every project ships with two things for an agent. `AGENTS.md` states the
6
+ rules, and an MCP server answers questions from your actual build:
6
7
 
7
- `AGENTS.md` is written into your project by the scaffold. It is short on
8
- purpose — it sits in an agent's context on every turn, so it states the rules
9
- and nothing more.
8
+ ```text title="explain_route /locale"
9
+ /locale — a stored shell, with the rest rendered per request (from the last build, 5 minutes ago)
10
+ Rendered by app/locale/page.
11
+ Ships 85 kB of javascript, gzipped.
12
+
13
+ Why it is not stored whole: cookies(), headers() stream per request; the rest is stored
14
+ ```
10
15
 
11
- The **MCP server** is for everything that does not fit in that budget: what your
12
- build actually did, and the long-form answer to "how do I do X here".
16
+ `AGENTS.md` is short on purpose: it sits in an agent's context on every turn.
17
+ The MCP server holds everything that doesn't fit in that budget.
13
18
 
14
- ## Connecting it
19
+ ## Connecting the server
15
20
 
16
21
  The scaffold already did. Every project gets a `.mcp.json` at its root:
17
22
 
@@ -23,33 +28,54 @@ The scaffold already did. Every project gets a `.mcp.json` at its root:
23
28
  }
24
29
  ```
25
30
 
26
- On a Node project, `"command": "npx", "args": ["-y", "@rsc-kit/mcp"]` — the
27
- same server, launched by the runtime the project has. The scaffold writes
31
+ On a Node project it is `"command": "npx", "args": ["-y", "@rsc-kit/mcp"]`:
32
+ the same server, launched by the runtime the project has. The scaffold writes
28
33
  whichever fits.
29
34
 
30
35
  Claude Code reads that as project-scoped configuration and asks you to approve
31
36
  it the first time it starts the server. Nothing is installed until then, and
32
- nothing about your build or dev server changes — it is a file an agent reads.
33
- Commit it; it is the same for everyone on the project.
37
+ your build and dev server don't change. Commit the file; it is the same for
38
+ everyone on the project.
34
39
 
35
- For a project that predates the file, `create-rsc-kit init` writes it (and
36
- leaves one that is already there alone), or add it by hand:
40
+ ### In an older project
41
+
42
+ `create-rsc-kit init` writes the file, and leaves one that is already there
43
+ alone. Or add it by hand:
37
44
 
38
45
  ```sh
39
46
  claude mcp add rsc-kit -- bunx @rsc-kit/mcp # or: npx -y @rsc-kit/mcp
40
47
  ```
41
48
 
42
- Any other MCP client takes the same entry — a stdio server, command `bunx`
43
- (or `npx`), argument `@rsc-kit/mcp` — in its own file: `.cursor/mcp.json`
44
- under `mcpServers`, `.vscode/mcp.json` under `servers`. If a client reports
45
- the server as unreachable, run the command by hand: `bunx @rsc-kit/mcp`
46
- waits on stdin for a client, and printing nothing is it working.
49
+ ### In another client
47
50
 
48
- ## What it answers about your app
51
+ Any MCP client takes the same entry — a stdio server, command `bunx` (or
52
+ `npx`), argument `@rsc-kit/mcp` — in its own file:
49
53
 
50
- Every build writes `build-report.json` — the same rows it printed, plus every
51
- server action and whether a client built it. These read
52
- it, so nothing runs a build or imports your code:
54
+ ```json title=".cursor/mcp.json"
55
+ {
56
+ "mcpServers": {
57
+ "rsc-kit": { "command": "bunx", "args": ["@rsc-kit/mcp"] }
58
+ }
59
+ }
60
+ ```
61
+
62
+ ```json title=".vscode/mcp.json"
63
+ {
64
+ "servers": {
65
+ "rsc-kit": { "command": "bunx", "args": ["@rsc-kit/mcp"] }
66
+ }
67
+ }
68
+ ```
69
+
70
+ If a client reports the server as unreachable, run the command by hand.
71
+ `bunx @rsc-kit/mcp` waits on stdin for a client, and printing nothing is it
72
+ working.
73
+
74
+ ## Asking about your app
75
+
76
+ Every build writes `build-report.json`: the same rows it printed, plus every
77
+ server action and whether a client built it. These tools read it, so nothing
78
+ runs a build or imports your code:
53
79
 
54
80
  | tool | answers |
55
81
  | --- | --- |
@@ -58,21 +84,16 @@ it, so nothing runs a build or imports your code:
58
84
  | `what_is_dynamic` | the routes that are not stored, with reasons |
59
85
  | `heaviest_routes` | what costs the browser most |
60
86
 
61
- The reason a page is dynamic is **recorded, not guessed**:
87
+ The reason a page is dynamic is **recorded, not guessed** — the call that made
88
+ it dynamic is in the answer above. Asked to "make this page faster", an agent
89
+ without it guesses at a cause and edits something.
62
90
 
63
- ```
64
- /locale — a stored shell, with the rest rendered per request (from the last build, 5 minutes ago)
65
- Rendered by app/locale/page.
66
- Ships 85 kB of javascript, gzipped.
67
-
68
- Why it is not stored whole: cookies(), headers() stream per request; the rest is stored
69
- ```
70
-
71
- That matters more than it sounds. Asked to "make this page faster", an agent
72
- without this guesses at a cause and edits something. With it, the call that did
73
- it is on the screen.
91
+ **Every answer says how old it is.** It reports the last build, and your files
92
+ may have changed since, so `(from the last build, 5 minutes ago)` is on every
93
+ response. With no build at all it says to run one, rather than reporting that
94
+ there are no routes.
74
95
 
75
- ## What it answers about the framework
96
+ ## Asking about the framework
76
97
 
77
98
  | tool | answers |
78
99
  | --- | --- |
@@ -84,16 +105,16 @@ it is on the screen.
84
105
  | `search_guides` | every line in the guides mentioning a word, with the guide it is in |
85
106
 
86
107
  `how_to` is the opinionated summary an agent should read first; `read_guide`
87
- is for when the summary is not enough. Both come from the same source, and the
108
+ is for when the summary isn't enough. Both come from the same source, and the
88
109
  guides are copied in at build time, so what an agent reads is what this site
89
110
  says for the version it has.
90
111
 
91
112
  These exist because the patterns here differ from Next and plain React **in
92
- ways that compile either way** — a check written in the component instead of the
93
- action, a hand-parsed query string, `"use server"` at the top of a page. An
94
- agent that has not been told writes those confidently.
113
+ ways that compile either way**: a check written in the component instead of
114
+ the action, a hand-parsed query string, `"use server"` at the top of a page.
115
+ An agent that hasn't been told writes those confidently.
95
116
 
96
- ## The rules an agent follows
117
+ ## The rules in AGENTS.md
97
118
 
98
119
  `bun create rsc-kit` writes an `AGENTS.md`, and `rsc-kit init` adds a section
99
120
  to the one you have. It opens with **Rules** - the things an agent gets wrong
@@ -115,33 +136,30 @@ in ways that compile:
115
136
  - generated files are never edited; secrets are generated, never committed;
116
137
  - ask `how_to` before reaching for a pattern from another framework.
117
138
 
118
- The section is rsc-kit's - between `<!-- rsc-kit:start -->` and
119
- `<!-- rsc-kit:end -->`, stamped with the version that wrote it - and
120
- everything around it is yours. When rsc-kit changes, bring it up to date:
139
+ A Laravel app gets the same rules from its Boost skill, in Laravel's terms.
140
+
141
+ ## Keeping AGENTS.md current
121
142
 
122
143
  ```sh
123
144
  bunx rsc-kit agents # rewrites the rsc-kit section only; review it in git
124
145
  ```
125
146
 
126
- The dev server says when the section is older than the rsc-kit installed. An
127
- `AGENTS.md` from before the stamp needs `--host` and `--source-dir` once; one
128
- with no section at all is only rewritten with `--replace`. The `rules` tool
129
- answers the same rules for the installed version, so an agent that reads it
130
- first is never working from an outdated file. A Laravel app gets the same
131
- rules from its Boost skill, in Laravel's terms.
147
+ The section is rsc-kit's - between `<!-- rsc-kit:start -->` and
148
+ `<!-- rsc-kit:end -->`, stamped with the version that wrote it - and
149
+ everything around it is yours. The dev server says when the section is older
150
+ than the rsc-kit installed.
132
151
 
133
- ## Two things worth knowing
152
+ An `AGENTS.md` from before the stamp needs `--host` and `--source-dir` once:
134
153
 
135
- **Every answer says how old it is.** It reports the last build, and your files
136
- may have changed since — so `(from the last build, 5 minutes ago)` is on every
137
- response. With no build at all it says to run one, rather than reporting that
138
- there are no routes.
154
+ ```sh
155
+ bunx rsc-kit agents --host bun --source-dir src/app
156
+ ```
139
157
 
140
- **It is read-only.** Nothing here edits, builds or deploys. Your agent already
141
- has a shell for those, and a server that can change a project is one that can
142
- change it while answering a question about it.
158
+ One with no section at all is only rewritten with `--replace`. The `rules`
159
+ tool answers the same rules for the installed version, so an agent that reads
160
+ it first is never working from an outdated file.
143
161
 
144
- ## The docs are markdown too
162
+ ## Reading the docs as markdown
145
163
 
146
164
  Every page on this site is also a markdown file at the same url with
147
165
  `index.md` added — `/guides/forms/index.md` — and
@@ -150,8 +168,14 @@ Every page on this site is also a markdown file at the same url with
150
168
  server, or one asked about a version other than the one installed, reads
151
169
  those. `read_guide` is the same text, offline, at the installed version.
152
170
 
153
- ## Without an agent
171
+ ## Checking the build report in CI
154
172
 
155
173
  `build-report.json` is an ordinary file. A CI step can assert on it — that
156
174
  nothing stopped being prerendered, that no route crossed a size budget — which
157
175
  is the check most likely to catch a regression nobody would otherwise see.
176
+
177
+ ## Why it is read-only
178
+
179
+ Nothing here edits, builds or deploys. Your agent already has a shell for
180
+ those, and a server that can change a project is one that can change it while
181
+ answering a question about it.