@webjsdev/mcp 0.1.13 → 0.1.15

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/README.md CHANGED
@@ -34,9 +34,11 @@ subcommand) delegates to this same server, so both routes run identical code.
34
34
  no verdict at all; identical to `webjs elision --json`),
35
35
  `check` (the structured `webjs check` violations). Each projects an existing
36
36
  `@webjsdev/server` data function and mutates nothing.
37
- - **Knowledge layer**: an `init` mental-model primer, a `docs` retrieval tool,
38
- MCP `resources` (the skill references + `SKILL.md` + `AGENTS.md` as `webjs-docs://*`),
39
- and `prompts` (the recipes as guided workflows).
37
+ - **Knowledge layer**: an `init` mental-model primer (which also names the docs
38
+ corpus it is serving, and warns when this server's copy looks stale against
39
+ the app's), a `docs` retrieval tool, MCP `resources` (the skill references +
40
+ `SKILL.md` + `AGENTS.md` as `webjs-docs://*`), and `prompts` (the recipes as
41
+ guided workflows).
40
42
  - **`source` tool**: reads the framework's own no-build source from
41
43
  `node_modules/@webjsdev/*/src` (read-only, traversal-guarded).
42
44
  - **`ui` tool**: the `@webjsdev/ui` kit inventory (no args) or one component's
@@ -44,10 +46,65 @@ subcommand) delegates to this same server, so both routes run identical code.
44
46
  `name`). Kit-scoped (not `appDir`-scoped); shares one projector with
45
47
  `webjsui view`.
46
48
 
47
- The docs corpus is bundled into the package at `prepack`, so `npx @webjsdev/mcp`
48
- is self-contained; in the monorepo it falls back to the live repo-root docs.
49
+ ## Which docs you get
49
50
 
50
- That bundle is a snapshot frozen at publish time, so a published tarball keeps
51
+ The corpus is resolved in three rungs, highest first:
52
+
53
+ 1. `<appDir>/node_modules/@webjsdev/mcp/resources`, the app's own installed copy.
54
+ 2. `<pkg>/resources`, this server's bundled snapshot, so `npx @webjsdev/mcp` is
55
+ self-contained.
56
+ 3. Whatever the server resolves locally, which is the repo-root skill on the
57
+ monorepo dev path. This rung is an unconditional fallback rather than a
58
+ checkout probe, so a published install whose `resources/` bundle is missing
59
+ lands here too, with an empty corpus. That is why neither the corpus line nor
60
+ the warning asserts a checkout.
61
+
62
+ The app's copy wins because it is version-matched to the framework you are
63
+ editing, and so is the only corpus that can be correct about that app. This
64
+ matters most for a GLOBAL install (`npm i -g` / `bun add -g`), which otherwise
65
+ keeps serving the docs it was published with forever, contradicting the copy
66
+ sitting in your own `node_modules`. That is a real incident, not a hypothetical:
67
+ a server published one day before the client router stopped needing an explicit
68
+ `import '@webjsdev/core/client-router'` kept teaching that import for months, and
69
+ an agent following it wrote dead imports into three layouts, each of which the
70
+ elision analyser then correctly refused to strip.
71
+
72
+ `appDir` is a per-call argument, so the corpus follows it. `resources/list` and
73
+ `resources/read` carry no `appDir` in the MCP protocol and resolve from the
74
+ server's working directory, which is what a `tools/call` with no `appDir`
75
+ defaults to, so in the ordinary case every surface reads one corpus.
76
+
77
+ `init` names the corpus it served on its first line, and prepends a warning when
78
+ the app's installed `@webjsdev/mcp` is strictly newer than the running server's:
79
+
80
+ ```
81
+ Warning: this MCP server is @webjsdev/mcp@0.1.4, but this app has @webjsdev/mcp@0.1.12,
82
+ so the server may be stale. The docs below come from this app's own copy, so they
83
+ match it; update the server so its TOOLS match too. Update whichever copy runs this
84
+ server: a global install (npm i -g @webjsdev/mcp@latest, or bun add -g @webjsdev/mcp),
85
+ the package cache behind npx @webjsdev/mcp, @webjsdev/cli when the server is started
86
+ as webjs mcp, or the checkout it runs from.
87
+ Docs corpus: @webjsdev/mcp@0.1.12, copied from webjsdev/webjs e5806e2 on 2026-08-08.
88
+ ```
89
+
90
+ It warns rather than refusing to answer, because a knowledge tool that declines
91
+ sends the agent back to its training data, which is what the caveat exists to
92
+ correct. Equal versions, an older app, and an unreadable app manifest are all
93
+ silent.
94
+
95
+ Two details the wording is deliberate about. It does not name a global install as
96
+ the thing to fix, because nothing observes how the server was started and the two
97
+ shipped configurations are an `npx` invocation (whose staleness is a package
98
+ cache) and `webjs mcp` (whose staleness is the CLI's own dependency). And it does
99
+ not promise the docs below came from the app: the warning reads the app's
100
+ `package.json` while the corpus rung probes that install's `resources/`, so a
101
+ workspace-linked install can have a manifest to compare and no corpus to serve.
102
+ In that case the corpus falls through to the server's snapshot and the warning
103
+ says so, rather than contradicting the corpus line printed under it.
104
+
105
+ ## The build stamp
106
+
107
+ The bundle is a snapshot frozen at publish time, so a published tarball keeps
51
108
  serving the docs as they read on the day it was cut. `prepack` stamps it with
52
109
  `resources/corpus.json` so the snapshot can say which docs it holds:
53
110
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webjsdev/mcp",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "type": "module",
5
5
  "description": "The Model Context Protocol server for WebJs, a full-stack JavaScript framework built on web components with server-side rendering and no build step. Gives AI coding agents live app introspection over routes, actions, components, and convention checks, plus a knowledge layer of docs, recipes, and framework source.",
6
6
  "bin": {