bestax-mcp 0.0.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.
- package/README.md +90 -0
- package/data/catalog.json +1869 -0
- package/data/components/Autocomplete.json +604 -0
- package/data/components/Avatar.json +220 -0
- package/data/components/Avatars.json +294 -0
- package/data/components/Badge.json +261 -0
- package/data/components/Block.json +105 -0
- package/data/components/Box.json +157 -0
- package/data/components/Breadcrumb.json +155 -0
- package/data/components/Button.json +599 -0
- package/data/components/Buttons.json +533 -0
- package/data/components/Card.json +506 -0
- package/data/components/Carousel.json +512 -0
- package/data/components/Cell.json +154 -0
- package/data/components/Checkbox.json +176 -0
- package/data/components/Checkboxes.json +240 -0
- package/data/components/Code.json +128 -0
- package/data/components/Collapse.json +218 -0
- package/data/components/Column.json +284 -0
- package/data/components/Columns.json +542 -0
- package/data/components/ConfigProvider.json +16 -0
- package/data/components/Container.json +149 -0
- package/data/components/Content.json +228 -0
- package/data/components/Control.json +484 -0
- package/data/components/DateInput.json +872 -0
- package/data/components/DateTimeInput.json +952 -0
- package/data/components/Delete.json +153 -0
- package/data/components/Dialog.json +285 -0
- package/data/components/Divider.json +68 -0
- package/data/components/Dropdown.json +353 -0
- package/data/components/Emphasis.json +99 -0
- package/data/components/Field.json +539 -0
- package/data/components/Figure.json +143 -0
- package/data/components/File.json +403 -0
- package/data/components/Footer.json +109 -0
- package/data/components/Grid.json +357 -0
- package/data/components/Hero.json +340 -0
- package/data/components/Icon.json +232 -0
- package/data/components/IconText.json +307 -0
- package/data/components/Image.json +166 -0
- package/data/components/Input.json +583 -0
- package/data/components/Level.json +332 -0
- package/data/components/Link.json +154 -0
- package/data/components/LinkButton.json +247 -0
- package/data/components/ListItem.json +101 -0
- package/data/components/Loading.json +323 -0
- package/data/components/Media.json +345 -0
- package/data/components/Menu.json +317 -0
- package/data/components/Message.json +303 -0
- package/data/components/Modal.json +444 -0
- package/data/components/Navbar.json +996 -0
- package/data/components/Notification.json +165 -0
- package/data/components/Numberinput.json +364 -0
- package/data/components/OrderedList.json +189 -0
- package/data/components/Pagination.json +619 -0
- package/data/components/Panel.json +582 -0
- package/data/components/Paragraph.json +107 -0
- package/data/components/Pre.json +114 -0
- package/data/components/Progress.json +137 -0
- package/data/components/Radio.json +164 -0
- package/data/components/Radios.json +240 -0
- package/data/components/Rate.json +466 -0
- package/data/components/Reveal.json +177 -0
- package/data/components/Section.json +123 -0
- package/data/components/Select.json +526 -0
- package/data/components/Sidebar.json +488 -0
- package/data/components/Skeleton.json +162 -0
- package/data/components/Slider.json +534 -0
- package/data/components/Span.json +100 -0
- package/data/components/Steps.json +452 -0
- package/data/components/Strong.json +105 -0
- package/data/components/SubTitle.json +233 -0
- package/data/components/Switch.json +291 -0
- package/data/components/Table.json +490 -0
- package/data/components/Tabs.json +592 -0
- package/data/components/Tag.json +197 -0
- package/data/components/Taginput.json +587 -0
- package/data/components/Tags.json +181 -0
- package/data/components/TextArea.json +483 -0
- package/data/components/Theme.json +65 -0
- package/data/components/TimeInput.json +906 -0
- package/data/components/Title.json +240 -0
- package/data/components/Toast.json +308 -0
- package/data/components/Tooltip.json +212 -0
- package/data/components/UnorderedList.json +149 -0
- package/data/components/Valid value constants.json +16 -0
- package/data/components/classNames.json +65 -0
- package/data/components/useBulmaClasses.json +169 -0
- package/data/components/usePrefixedClassNames.json +25 -0
- package/data/skills/bestax-custom-component/SKILL.md +196 -0
- package/data/skills/bestax-custom-component/examples/stat-card.tsx +105 -0
- package/data/skills/bestax-custom-component/references/api.md +90 -0
- package/data/skills/bestax-custom-component/references/component-catalog.md +149 -0
- package/data/skills/bestax-custom-component/references/library-contributor.md +395 -0
- package/data/skills/bestax-custom-component/references/patterns.md +136 -0
- package/data/skills/bestax-form/SKILL.md +254 -0
- package/data/skills/bestax-form/references/api.md +103 -0
- package/data/skills/bestax-form/references/patterns.md +210 -0
- package/data/skills/bestax-icons/SKILL.md +80 -0
- package/data/skills/bestax-icons/examples/icon-usage.tsx +80 -0
- package/data/skills/bestax-icons/references/icon-libraries.md +131 -0
- package/data/skills/bestax-layout-scaffold/SKILL.md +196 -0
- package/data/skills/bestax-layout-scaffold/examples/app-shell.tsx +86 -0
- package/data/skills/bestax-layout-scaffold/examples/card-grid.tsx +106 -0
- package/data/skills/bestax-layout-scaffold/examples/centered.tsx +56 -0
- package/data/skills/bestax-layout-scaffold/examples/content-page.tsx +90 -0
- package/data/skills/bestax-layout-scaffold/examples/landing.tsx +122 -0
- package/data/skills/bestax-layout-scaffold/references/archetypes.md +246 -0
- package/data/skills/bestax-layout-scaffold/references/layout-components.md +269 -0
- package/data/skills/bestax-migrate/SKILL.md +78 -0
- package/data/skills/bestax-migrate/references/component-map.md +91 -0
- package/data/skills/bestax-migrate/references/css-migration.md +100 -0
- package/data/skills/bestax-migrate/references/prop-map.md +48 -0
- package/data/skills/bestax-migrate/references/unmappables.md +124 -0
- package/data/skills/bestax-optimize/SKILL.md +131 -0
- package/data/skills/bestax-optimize/references/modular-build.md +173 -0
- package/data/skills/bestax-theming/SKILL.md +117 -0
- package/data/skills/bestax-theming/examples/dark-mode.tsx +38 -0
- package/data/skills/bestax-theming/examples/theme-config.tsx +60 -0
- package/data/skills/bestax-theming/references/css-variables.md +466 -0
- package/data/skills/bestax-theming/references/themeable-components.md +119 -0
- package/data/skills.json +148 -0
- package/dist/data.d.ts +131 -0
- package/dist/data.d.ts.map +1 -0
- package/dist/data.js +111 -0
- package/dist/format.d.ts +37 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +178 -0
- package/dist/helper-props.d.ts +57 -0
- package/dist/helper-props.d.ts.map +1 -0
- package/dist/helper-props.js +249 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/search.d.ts +32 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +194 -0
- package/dist/server.d.ts +28 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +616 -0
- package/dist/version.d.ts +29 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +147 -0
- package/package.json +70 -0
package/dist/version.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which `@allxsmith/bestax-bulma` is the user actually building against?
|
|
3
|
+
*
|
|
4
|
+
* The index shipped in this tarball documents one specific release. Mantine's
|
|
5
|
+
* server fetches always-latest docs from the network, which means it will
|
|
6
|
+
* happily describe a prop that does not exist in the version installed in the
|
|
7
|
+
* project — the failure is silent and lands as a runtime error much later.
|
|
8
|
+
*
|
|
9
|
+
* Pinning the index avoids serving the wrong version by accident, but it does
|
|
10
|
+
* not avoid the user having a different one installed. So: look for it, and say
|
|
11
|
+
* so when they disagree. Not finding it is not an error — someone evaluating
|
|
12
|
+
* the library before installing it is a normal thing to be doing.
|
|
13
|
+
*
|
|
14
|
+
* Set BESTAX_MCP_NO_VERSION_CHECK=1 to skip this entirely.
|
|
15
|
+
*/
|
|
16
|
+
import { readFile } from 'node:fs/promises';
|
|
17
|
+
import { dirname, join, parse } from 'node:path';
|
|
18
|
+
const PACKAGE = '@allxsmith/bestax-bulma';
|
|
19
|
+
/**
|
|
20
|
+
* The one string in this server that does not come from its own committed data.
|
|
21
|
+
*
|
|
22
|
+
* `version` is read out of a `package.json` in the user's project and then quoted back into
|
|
23
|
+
* a note that rides along with every successful tool result — so it lands in a model's
|
|
24
|
+
* context wearing this server's authority. A tampered or typosquatted package at that path
|
|
25
|
+
* can put anything there, and it does not need to execute: the manifest is read, never
|
|
26
|
+
* required, so a payload works even under `--ignore-scripts`.
|
|
27
|
+
*
|
|
28
|
+
* Anything that is not a plain semver-shaped string is therefore treated as "no version
|
|
29
|
+
* found", which is already a normal, non-error state (see the header comment). The length
|
|
30
|
+
* cap is belt and braces — a conforming version cannot approach it.
|
|
31
|
+
*/
|
|
32
|
+
const SEMVER_ISH = /^\d+\.\d+\.\d+[\w.+-]*$/;
|
|
33
|
+
const MAX_VERSION_LENGTH = 64;
|
|
34
|
+
export function sanitizeVersion(value) {
|
|
35
|
+
if (typeof value !== 'string')
|
|
36
|
+
return null;
|
|
37
|
+
if (value.length > MAX_VERSION_LENGTH)
|
|
38
|
+
return null;
|
|
39
|
+
return SEMVER_ISH.test(value) ? value : null;
|
|
40
|
+
}
|
|
41
|
+
const majorMinor = (v) => v.replace(/^[^\d]*/, '').split('.');
|
|
42
|
+
function compare(indexed, installed) {
|
|
43
|
+
if (indexed === installed)
|
|
44
|
+
return 'none';
|
|
45
|
+
const a = majorMinor(indexed);
|
|
46
|
+
const b = majorMinor(installed);
|
|
47
|
+
if (!a[0] || !b[0])
|
|
48
|
+
return 'unknown';
|
|
49
|
+
if (a[0] !== b[0])
|
|
50
|
+
return 'major';
|
|
51
|
+
if (a[1] !== b[1])
|
|
52
|
+
return 'minor';
|
|
53
|
+
return 'patch';
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Walk up from `cwd` looking for the package in a node_modules directory.
|
|
57
|
+
*
|
|
58
|
+
* Deliberately a filesystem walk rather than `createRequire(cwd).resolve`:
|
|
59
|
+
* pnpm's isolated linker puts the real package under `.pnpm` and exposes it
|
|
60
|
+
* through a symlink, and `resolve` from a directory that is not itself a
|
|
61
|
+
* package can throw for reasons that have nothing to do with the answer.
|
|
62
|
+
*/
|
|
63
|
+
export async function findInstalledVersion(cwd = process.cwd()) {
|
|
64
|
+
let dir = cwd;
|
|
65
|
+
const { root } = parse(dir);
|
|
66
|
+
for (;;) {
|
|
67
|
+
try {
|
|
68
|
+
const manifest = join(dir, 'node_modules', ...PACKAGE.split('/'), 'package.json');
|
|
69
|
+
const pkg = JSON.parse(await readFile(manifest, 'utf8'));
|
|
70
|
+
const version = sanitizeVersion(pkg?.version);
|
|
71
|
+
if (version)
|
|
72
|
+
return version;
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// Not here — keep walking.
|
|
76
|
+
}
|
|
77
|
+
if (dir === root)
|
|
78
|
+
return null;
|
|
79
|
+
const up = dirname(dir);
|
|
80
|
+
if (up === dir)
|
|
81
|
+
return null;
|
|
82
|
+
dir = up;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* How long the probe above may take before we stop caring.
|
|
87
|
+
*
|
|
88
|
+
* `readFile` on a FIFO blocks forever and a stalled network mount blocks for as long as the
|
|
89
|
+
* mount does; the try/catch around it catches throws, not hangs. Since the probe runs before
|
|
90
|
+
* the stdio transport connects, a hang there presents as "the MCP server never came up" with
|
|
91
|
+
* no output at all — the exact failure this package's entry point is written to avoid. A
|
|
92
|
+
* missing version is a supported state, so giving up is always safe.
|
|
93
|
+
*/
|
|
94
|
+
const PROBE_TIMEOUT_MS = 500;
|
|
95
|
+
function withTimeout(work, fallback) {
|
|
96
|
+
return new Promise(resolve => {
|
|
97
|
+
const timer = setTimeout(() => resolve(fallback), PROBE_TIMEOUT_MS);
|
|
98
|
+
timer.unref?.();
|
|
99
|
+
work.then(value => {
|
|
100
|
+
clearTimeout(timer);
|
|
101
|
+
resolve(value);
|
|
102
|
+
}, () => {
|
|
103
|
+
clearTimeout(timer);
|
|
104
|
+
resolve(fallback);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Opting out takes any non-empty value, so `=0` and `=false` also disable the check. That
|
|
110
|
+
* reads backwards, so those two are treated as "leave it on" — an explicit off switch should
|
|
111
|
+
* not be something you trip by writing the word for "no".
|
|
112
|
+
*/
|
|
113
|
+
function versionCheckDisabled() {
|
|
114
|
+
const flag = process.env.BESTAX_MCP_NO_VERSION_CHECK;
|
|
115
|
+
if (!flag)
|
|
116
|
+
return false;
|
|
117
|
+
return !['0', 'false', 'no', 'off'].includes(flag.trim().toLowerCase());
|
|
118
|
+
}
|
|
119
|
+
export async function resolveVersions(indexed, cwd) {
|
|
120
|
+
if (versionCheckDisabled()) {
|
|
121
|
+
return { indexed, installed: null, drift: 'none' };
|
|
122
|
+
}
|
|
123
|
+
// Never let a version probe decide whether the docs server starts. Everything below is
|
|
124
|
+
// best-effort by design, and the caller runs it before the transport connects.
|
|
125
|
+
const installed = await withTimeout(findInstalledVersion(cwd).catch(() => null), null);
|
|
126
|
+
return {
|
|
127
|
+
indexed,
|
|
128
|
+
installed,
|
|
129
|
+
drift: installed ? compare(indexed, installed) : 'none',
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* A one-line warning to append to a response, or null when there is nothing
|
|
134
|
+
* worth saying.
|
|
135
|
+
*
|
|
136
|
+
* Patch drift is deliberately silent: a patch release of this library does not
|
|
137
|
+
* move props, and a line on every single response is a line a model learns to
|
|
138
|
+
* skip — which is exactly what must not happen when the drift is real.
|
|
139
|
+
*/
|
|
140
|
+
export function versionNote(info) {
|
|
141
|
+
if (!info.installed || info.drift === 'none' || info.drift === 'patch') {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
return (`⚠ This index documents ${PACKAGE} ${info.indexed}; this project has ` +
|
|
145
|
+
`${info.installed}. Props, defaults and CSS variables may differ — check ` +
|
|
146
|
+
`https://bestax.io/docs before relying on anything above.`);
|
|
147
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bestax-mcp",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "MCP server for @allxsmith/bestax-bulma — component props, examples, CSS variables and agent skills, served offline from a version-pinned index",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"bestax-mcp": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"data"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "node scripts/sync-skills.mjs && tsc",
|
|
15
|
+
"dev": "tsc --watch",
|
|
16
|
+
"test": "node scripts/sync-skills.mjs && NODE_OPTIONS=\"--experimental-vm-modules\" jest",
|
|
17
|
+
"test:watch": "node scripts/sync-skills.mjs && NODE_OPTIONS=\"--experimental-vm-modules\" jest --watch",
|
|
18
|
+
"test:coverage": "node scripts/sync-skills.mjs && NODE_OPTIONS=\"--experimental-vm-modules\" jest --coverage",
|
|
19
|
+
"lint": "eslint src",
|
|
20
|
+
"typecheck": "tsc --noEmit",
|
|
21
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
22
|
+
"format:check": "prettier --check \"src/**/*.ts\"",
|
|
23
|
+
"clean": "rimraf dist",
|
|
24
|
+
"release": "npx semantic-release",
|
|
25
|
+
"prepack": "node scripts/sync-skills.mjs"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"bestax",
|
|
29
|
+
"bulma",
|
|
30
|
+
"react",
|
|
31
|
+
"mcp",
|
|
32
|
+
"model-context-protocol",
|
|
33
|
+
"ai",
|
|
34
|
+
"agents",
|
|
35
|
+
"llms",
|
|
36
|
+
"components",
|
|
37
|
+
"documentation"
|
|
38
|
+
],
|
|
39
|
+
"author": "Alex Smith",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=22"
|
|
43
|
+
},
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "git+https://github.com/allxsmith/bestax.git",
|
|
47
|
+
"directory": "bestax-mcp"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://bestax.io/docs/guides/llms",
|
|
50
|
+
"llms": "https://bestax.io/llms.txt",
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/allxsmith/bestax/issues"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
56
|
+
"zod": "^4.4.3"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@jest/globals": "^30.0.0",
|
|
60
|
+
"@types/jest": "^30.0.0",
|
|
61
|
+
"@types/node": "^26.1.2",
|
|
62
|
+
"jest": "^30.2.0",
|
|
63
|
+
"ts-jest": "^29.4.12",
|
|
64
|
+
"typescript": "^6.0.3"
|
|
65
|
+
},
|
|
66
|
+
"publishConfig": {
|
|
67
|
+
"access": "public",
|
|
68
|
+
"provenance": true
|
|
69
|
+
}
|
|
70
|
+
}
|