m3ui-mcp 0.0.0-stage → 0.4.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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +152 -2
  3. package/THIRD_PARTY_NOTICES.md +63 -0
  4. package/data/components.json +59495 -0
  5. package/data/examples.json +2179 -0
  6. package/data/guidelines.json +4514 -0
  7. package/data/icons.json +174412 -0
  8. package/data/locale.json +6824 -0
  9. package/data/manifest.json +47 -0
  10. package/data/md-tokens.json +4116 -0
  11. package/data/nuxt.json +1296 -0
  12. package/data/recipes.json +3866 -0
  13. package/data/search-index.json +59654 -0
  14. package/data/specs.json +4404 -0
  15. package/data/tokens.json +2273 -0
  16. package/data/types.json +4442 -0
  17. package/data/values.json +20963 -0
  18. package/dist/categories.js +31 -0
  19. package/dist/create-server.js +151 -0
  20. package/dist/data.js +179 -0
  21. package/dist/dynamic-slots.js +35 -0
  22. package/dist/format.js +129 -0
  23. package/dist/input-attrs.js +7 -0
  24. package/dist/render-value.js +114 -0
  25. package/dist/search.js +392 -0
  26. package/dist/server.js +13 -0
  27. package/dist/template.js +190 -0
  28. package/dist/text.js +67 -0
  29. package/dist/tool.js +149 -0
  30. package/dist/tools/check-template.js +473 -0
  31. package/dist/tools/examples.js +67 -0
  32. package/dist/tools/find-token.js +178 -0
  33. package/dist/tools/get-component.js +238 -0
  34. package/dist/tools/get-composable.js +20 -0
  35. package/dist/tools/get-demo-source.js +48 -0
  36. package/dist/tools/get-directive.js +22 -0
  37. package/dist/tools/get-guideline.js +87 -0
  38. package/dist/tools/get-locale-keys.js +44 -0
  39. package/dist/tools/get-setup.js +241 -0
  40. package/dist/tools/get-tokens.js +66 -0
  41. package/dist/tools/get-type.js +57 -0
  42. package/dist/tools/index.js +4 -0
  43. package/dist/tools/list-components.js +61 -0
  44. package/dist/tools/list-composables.js +53 -0
  45. package/dist/tools/list-guidelines.js +31 -0
  46. package/dist/tools/public.js +259 -0
  47. package/dist/tools/recipes.js +116 -0
  48. package/dist/tools/search-icons.js +70 -0
  49. package/dist/tools/search.js +47 -0
  50. package/dist/types.js +2 -0
  51. package/package.json +69 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 smerechuk
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,153 @@
1
- # Temporary Holding Version
1
+ # m3ui-mcp
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![M8ven Score](https://m8ven.ai/badge/mcp/smerechuk-m3ui-mcp-ua2pzg?v=48b836a0855fe38035965ecdfcea49db)](https://m8ven.ai/mcp/smerechuk-m3ui-mcp-ua2pzg?s=readme)
4
+
5
+ A local MCP server (stdio) with a complete, verified knowledge base for **`@m3ui-vue/m3ui-vue` (1.13.0)**, the optional **`@m3ui-vue/nuxt` (0.8.2)** module, and **Material Design 3** / **M3 Expressive** guidelines — designed for any **Vue 3** project (Vite, SPA, SSR, Astro) or **Nuxt 3/4**.
6
+
7
+ Search works on English names and descriptions, with synonyms, typo tolerance and prefixes.
8
+
9
+ All API tables (`props`, `events`, `slots`, `exposed`, `types`, `tokens`, `locale`) are generated automatically from the package's `dist/api.json` and `.d.ts` files (P1). Curated descriptions, M3 principles, screen recipes, and verified per-component SFC examples live in `content/`.
10
+
11
+ ## Requirements & installation
12
+
13
+ - **Node.js >= 24.11** (runs TypeScript without a build step via type stripping — server start ~0.4–0.8 s).
14
+ - Install in the repository directory (no dependency needs an install script, so they can stay off):
15
+
16
+ ```bash
17
+ npm ci --ignore-scripts
18
+ ```
19
+
20
+ Optionally, to populate `.cache/` for the `demo-source` section of `get_api` and `check-coverage.ts` (`.cache/` is not tracked in git):
21
+
22
+ ```bash
23
+ node scripts/fetch-sources.ts --skip-issues
24
+ ```
25
+
26
+ ### Working on the project on a new computer
27
+
28
+ ```bash
29
+ git clone https://github.com/smerechuk/m3ui-mcp.git
30
+ cd m3ui-mcp
31
+ npm ci --ignore-scripts
32
+ npm run setup
33
+ ```
34
+
35
+ `npm run setup` restores `.cache/` exactly as `SOURCES.lock.json` describes it and runs `npm run verify`; when it passes,
36
+ the clone is ready for work. It never changes the lock. The libraries' repositories come at the locked commits; the
37
+ three downloaded files (`llms.txt`, `llms-full.txt`, the Material Symbols metadata) come from the web, and when the web
38
+ version has moved on since the lock, from the copy attached to a GitHub release of this repository (`npm run
39
+ release-assets`). Issues need a logged-in `gh`; without it they are skipped.
40
+
41
+ If `data/` is empty or stale:
42
+
43
+ ```bash
44
+ npm run build-index
45
+ ```
46
+
47
+ ## Connecting the MCP server to any project
48
+
49
+ The package ships the compiled server and its data (`data/*.json`), so it works offline with no clone and no build
50
+ (Node 24.11+). Only the `demo-source` section of `get_api` needs a local copy of the docs (`.cache/m3ui-vue-docs`,
51
+ see below); without it, it returns the online links.
52
+
53
+ - **Claude Code** (`--scope user`: every project on this machine; without it only the folder you run it in):
54
+ ```bash
55
+ claude mcp add --scope user m3ui -- npx -y m3ui-mcp
56
+ ```
57
+ - **`.mcp.json` in your project, Cursor, Kiro and other clients with an `mcp.json`:**
58
+ ```json
59
+ {
60
+ "mcpServers": {
61
+ "m3ui": {
62
+ "command": "npx",
63
+ "args": ["-y", "m3ui-mcp"]
64
+ }
65
+ }
66
+ }
67
+ ```
68
+ On Windows, a client that does not start commands through a shell needs `"command": "cmd"` and
69
+ `"args": ["/c", "npx", "-y", "m3ui-mcp"]`.
70
+ - **From a clone** (development, or the `demo-source` section with `npm run fetch-sources`): run
71
+ `npm ci --ignore-scripts` in the clone, then point the client at `node /absolute/path/to/m3ui-mcp/src/server.ts`
72
+ (Node runs the TypeScript sources directly; no build step). A client that starts it from a checkout without
73
+ `node_modules` fails with a missing-module error.
74
+
75
+ Check the setup in the client's tool list (8 tools), or by hand: `npx -y m3ui-mcp` waits on stdin (stop it with Ctrl+C).
76
+
77
+ ## MCP tools
78
+
79
+ Stdio server (`npx -y m3ui-mcp`, or `node src/server.ts` in a clone; Node 24.11+). Works offline on `data/*.json` (generated by
80
+ `npm run build-index`); the `demo-source` section of `get_api` additionally reads `.cache/m3ui-vue-docs`. Both directories can be
81
+ overridden with `M3UI_MCP_DATA` and `M3UI_MCP_CACHE` env vars. Cold start is ~0.4 s: data files and the search
82
+ index are loaded on first use, the `@vue/compiler-sfc` parser on first `check_template` call.
83
+
84
+ Every tool answers in Markdown and accepts `page`. An answer longer than 8000 characters is split into pages (before a
85
+ heading where possible, code blocks closed and reopened) and ends with `Page n of m. Next: …`, the same call with the
86
+ next page. `search`, `get_api`, `tokens` and `check_template` also return `structuredContent` described by an
87
+ `outputSchema` (results, the component API, tokens, issues) with the same `pagination`; the data is never cut. Errors
88
+ return `isError` with a "Did you mean" suggestion and the code (`not_found`, `invalid_input`, `cache_missing`,
89
+ `internal_error`) in `_meta.errorCode`.
90
+
91
+ | Tool | Input | Returns |
92
+ |---|---|---|
93
+ | `search` | `query?`, `kind?` (component, composable, directive, type, token, guideline, recipe, example, icon, nuxt, spec), `category?`, `entry?`, `m3Only?`, `ssr?`, `limit?`, `page?` | With `query`: ranked results with a one-sentence description and the next call (exact name first; synonyms, typos, prefixes; kind `icon` ranks Material Symbols names). Without `query`: lists components by category, or composables, directives, guidelines, recipes, examples, tokens for that `kind` |
94
+ | `get_api` | `name`, `sections?`, `page?` | The card of a component, composable, function, directive or exported type (kind detected from the name): API from `api.json` + curated description; section `demo-source` returns the upstream demo page from `.cache` (read-only, no license) |
95
+ | `get_guideline` | `topic?`, `group?`, `sections?`, `page?` | M3 and Expressive guidelines plus Material Web cards (kind `spec`, group `material-web`: M3 facts, not M3UI API); without `topic` the list |
96
+ | `get_recipe` | `id?`, `device?`, `sections?`, `page?` | Screen patterns with code; without `id` the list |
97
+ | `get_example` | `id?`, `relevance?`, `sections?`, `page?` | Summaries of the upstream example apps; without `id` the list |
98
+ | `tokens` | `intent?`, `group?`, `limit?`, `page?` | Token suggestions for a purpose ("card background on surface"), a whole group with Tailwind classes, or an overview |
99
+ | `get_setup` | `target?` (vue, nuxt), `topic?`, `prefix?`, `component?`, `query?`, `page?` | Vue 3 setup (Vite/SPA/SSR: `css`, `plugin`, `fonts`, `ssr`) and Nuxt setup (docs, `m3ui.*` options), locale presets and entry points; topic `locale-keys` lists `M3Locale` keys with English text and usage |
100
+ | `check_template` | `code`, `target?` (auto, vue, nuxt), `page?` | Unknown components, props, events, slots, out-of-union values, missing required prop, wrong `v-model`, missing/wrong import (`@m3ui-vue/m3ui-vue/chart`, …), `use*` vs `useM3*` names; line numbers |
101
+
102
+ Resources: `m3ui://component/{name}` (full card) and `m3ui://guideline/{topic}` (guideline or `spec` card), with
103
+ listing and auto-complete. Prompt `m3ui_build_screen` (arguments `description`, `device?`, `framework?`) guides the
104
+ agent: guidelines → components → recipe → code → `check_template`.
105
+
106
+ ### Manual invocation via stdio
107
+
108
+ ```bash
109
+ printf '%s\n' \
110
+ '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"cli","version":"0"}}}' \
111
+ '{"jsonrpc":"2.0","method":"notifications/initialized"}' \
112
+ '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' \
113
+ '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"search","arguments":{"query":"dialog"}}}' \
114
+ | npx -y m3ui-mcp
115
+ ```
116
+
117
+ ## Update procedure after a new M3UI release
118
+
119
+ The mechanical part is one command; what is left is reading the short lists it prints.
120
+
121
+ 1. Install the new versions and run the update:
122
+ ```bash
123
+ npm install -D @m3ui-vue/m3ui-vue@<new> @m3ui-vue/nuxt@<new>
124
+ npm run update
125
+ ```
126
+ `scripts/update.ts` runs, in order:
127
+ - `fetch-sources --update`: new tags, the docs of the installed release (see below) and new downloads in `.cache/`, new `SOURCES.lock.json`;
128
+ - `rebase-refs`: every line reference (`pkg:src/x.vue:74-82`, `lib@<sha>:CHANGELOG.md:1198`, …) in `content/` and `src/` is moved to the same code in the new version, with the new commit hash. The old version comes from `npm pack` and `git fetch` of the old commit;
129
+ - `diff-api`: API changes against `data/`;
130
+ - `build-index`, `check-coverage` and `check-demos` for both targets.
131
+ 2. Read what it lists:
132
+ - the CHANGELOG entries since the last release: behaviour api.json cannot show (render strategy, SSR, layout classes, defaults). A change in `theme.css` changes components whose own code did not change.
133
+ - `.cache/rebase-refs.md`: claims whose cited lines changed, and changed library files that no card cites;
134
+ - `diff-api`: new, removed and renamed API (new cards, `covers:` entries, references to update);
135
+ - `check-coverage` errors. `ref-drift` means the code under a claim changed. Fix the claim if needed, then accept the current code with `npm run check-coverage -- --pin-refs` (rewrites `refs.lock.json`);
136
+ - new `check-demos` findings. Each is either a false positive of `check_template` (fix `src/tools/check-template.ts`; runtime slot names go to `DYNAMIC_SLOTS` with a `source:` line) or a real library change. Accept them with `node scripts/check-demos.ts --target <vue|nuxt> --update-baseline`;
137
+ - `content/gaps.md` and the recipes: limitations the new version may have removed.
138
+ 3. Raise the package version: `npm version minor --no-git-tag-version` (a new library release is a new minor version; content-only fixes between releases take a patch version, `npm version patch --no-git-tag-version`).
139
+ 4. `npm run verify`. Version numbers in this README and in the `content/gaps.md` heading are checked by the tests, and `scripts/check-version.ts` fails when the library versions changed since the last `v*` tag but the package version did not.
140
+ 5. Commit, then tag the release: `git tag v<version>` (pushed with `git push origin main v<version>`).
141
+ 6. Create the GitHub release (`gh release create v<version>`) and attach the locked downloads with `npm run release-assets`, so a clone on another computer can restore them after the live files change.
142
+ 7. Publish to npm: `npm publish` (needs two-factor authentication on the npm account; the build runs in `prepack`).
143
+
144
+ `fetch-sources --update` pins the docs (`m3ui-vue-docs`) to the last commit before the next library release after the installed one, or to HEAD when the installed version is the newest, so pages of later releases do not enter the knowledge base early. Override it with `--docs-sha=<sha>`.
145
+
146
+ Rules written from the library source, in cards or in the server code, carry a `(source: …)` reference. That keeps them inside steps 1–2: they are moved, fingerprinted and flagged like every other claim.
147
+
148
+ ## Tests & verification
149
+
150
+ - Full verification (`build-index --check`, `check-coverage --quiet`, `typecheck`, `npm test`): `npm run verify`
151
+ - All tests (`generator`, `server`, `examples`, `eval`): `npm test`
152
+ - TypeScript type check (Node 24 type stripping): `npm run typecheck`
153
+ - Content coverage check: `npm run check-coverage`
@@ -0,0 +1,63 @@
1
+ # Third-party notices
2
+
3
+ This directory (`tools/m3ui-mcp/`) includes in `data/` and `content/` excerpts of API descriptions,
4
+ signatures, types and token names from the packages below, as well as icon names from Google Fonts
5
+ metadata. Versions and checksums: `SOURCES.lock.json`.
6
+
7
+ ## @m3ui-vue/m3ui-vue and @m3ui-vue/nuxt
8
+
9
+ - Packages: `@m3ui-vue/m3ui-vue` (https://github.com/m3ui-vue/m3ui-vue), `@m3ui-vue/nuxt`
10
+ (https://github.com/m3ui-vue/m3ui-vue-nuxt). Both licensed MIT; copyright holder per `LICENSE` files: Fadel
11
+ (GitHub account SrWither).
12
+ - Used: descriptions and signatures from `dist/api.json`, `dist/API.md`, `.d.ts` files, token and class names
13
+ from `src/styles/`, locale keys from `src/locales/`, module options from `dist/module.d.mts`; short source-code
14
+ excerpts in inline citations.
15
+ - `@m3ui-vue/m3ui-vue` itself bundles third-party code described in its `dist/THIRD_PARTY_LICENSES.md`;
16
+ this directory does not copy that code.
17
+
18
+ ```
19
+ MIT License
20
+
21
+ Copyright (c) 2026 Fadel
22
+
23
+ Permission is hereby granted, free of charge, to any person obtaining a copy
24
+ of this software and associated documentation files (the "Software"), to deal
25
+ in the Software without restriction, including without limitation the rights
26
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
27
+ copies of the Software, and to permit persons to whom the Software is
28
+ furnished to do so, subject to the following conditions:
29
+
30
+ The above copyright notice and this permission notice shall be included in all
31
+ copies or substantial portions of the Software.
32
+
33
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
36
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
38
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39
+ SOFTWARE.
40
+ ```
41
+
42
+ ## Material Symbols (icon names)
43
+
44
+ - Source: Google Fonts metadata, `https://fonts.google.com/metadata/icons?key=material_symbols`
45
+ (cached at `.cache/downloads/material-symbols-metadata.json`, sha256 in `SOURCES.lock.json`).
46
+ - License: Apache License 2.0 (https://www.apache.org/licenses/LICENSE-2.0), Google LLC.
47
+ - Used in `data/icons.json`: icon names, categories and search tags (font files and graphics are not included).
48
+ Polish synonyms are original.
49
+
50
+ ## Unlicensed content (links and original summaries only)
51
+
52
+ - `m3ui-vue/m3ui-vue-docs` (demo pages, example apps, `llms.txt`, `llms-full.txt` from https://m3ui.dev):
53
+ the repository carries no license. Nothing from it is copied into `data/` or `content/`: we store the path,
54
+ SHA, URL, an original summary, and the list of components used. A working copy lives in `.cache/` (outside
55
+ git) and is read only by the `get_demo_source` tool on the user's machine.
56
+ - m3.material.io and design.google (Google): original summaries only, at most short quoted phrases, each with
57
+ a link to the specific page.
58
+
59
+ ## Tool dependencies (not distributed in the repository)
60
+
61
+ Installed by `npm install` into `tools/m3ui-mcp/node_modules/` (outside git): `@modelcontextprotocol/sdk` (MIT),
62
+ `zod` (MIT), `yaml` (ISC), `minisearch` (MIT), `@vue/compiler-sfc` (MIT), dev dependencies `vitest` (MIT),
63
+ `typescript` (Apache-2.0), `vue-tsc` (MIT), `@types/node` (MIT).