@lism-css/mcp 0.11.0 → 0.12.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.ja.md +4 -2
- package/README.md +4 -2
- package/dist/data/docs-index.json +278 -51
- package/dist/data/guides/SKILL.md +113 -0
- package/dist/data/guides/base-styles.md +106 -0
- package/dist/data/guides/components-core.md +338 -0
- package/dist/data/guides/components-ui.md +351 -0
- package/dist/data/guides/css-rules.md +146 -0
- package/dist/data/guides/module-class.md +162 -0
- package/dist/data/guides/prop-responsive.md +54 -0
- package/dist/data/guides/property-class.md +400 -0
- package/dist/data/guides/set-class.md +190 -0
- package/dist/data/guides/tokens.md +210 -0
- package/dist/data/guides/utility-class.md +81 -0
- package/dist/index.js +4 -0
- package/dist/lib/load-data.js +2 -11
- package/dist/lib/load-markdown.d.ts +6 -0
- package/dist/lib/load-markdown.js +29 -0
- package/dist/lib/markdown-utils.d.ts +42 -0
- package/dist/lib/markdown-utils.js +158 -0
- package/dist/lib/schemas.d.ts +0 -242
- package/dist/lib/schemas.js +0 -64
- package/dist/lib/search.d.ts +2 -16
- package/dist/lib/search.js +9 -68
- package/dist/lib/types.d.ts +0 -64
- package/dist/tools/convert-css.js +96 -55
- package/dist/tools/get-component.js +60 -29
- package/dist/tools/get-guide.d.ts +2 -0
- package/dist/tools/get-guide.js +45 -0
- package/dist/tools/get-overview.js +26 -39
- package/dist/tools/get-props-system.js +45 -33
- package/dist/tools/get-tokens.js +9 -14
- package/dist/tools/search-docs.js +27 -9
- package/package.json +2 -2
- package/dist/data/components.json +0 -564
- package/dist/data/overview.json +0 -114
- package/dist/data/props-system.json +0 -1147
- package/dist/data/tokens.json +0 -148
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { loadJSON } from '../lib/load-data.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { loadMarkdown } from '../lib/load-markdown.js';
|
|
4
|
+
import { DocsEntrySchema } from '../lib/schemas.js';
|
|
5
|
+
import { parsePropRows } from '../lib/markdown-utils.js';
|
|
6
|
+
import { searchDocs } from '../lib/search.js';
|
|
5
7
|
import { success, error, READ_ONLY_ANNOTATIONS } from '../lib/response.js';
|
|
6
8
|
const DOC_CATEGORIES = ['all', 'core-components', 'modules', 'props', 'ui', 'guide'];
|
|
9
|
+
/**
|
|
10
|
+
* property-class.md のテーブルから CSSプロパティ名 → Lism prop名 のマップを構築する。
|
|
11
|
+
* search.ts の buildCssPropertyMap と同じインターフェースを返す。
|
|
12
|
+
*/
|
|
13
|
+
function buildCssPropertyMapFromMarkdown(md) {
|
|
14
|
+
const map = new Map();
|
|
15
|
+
for (const row of parsePropRows(md)) {
|
|
16
|
+
const normalized = row.cssProperty.toLowerCase();
|
|
17
|
+
if (normalized.startsWith('(class:'))
|
|
18
|
+
continue;
|
|
19
|
+
const existing = map.get(normalized) ?? [];
|
|
20
|
+
existing.push(row.prop.toLowerCase());
|
|
21
|
+
map.set(normalized, existing);
|
|
22
|
+
}
|
|
23
|
+
return map;
|
|
24
|
+
}
|
|
7
25
|
export function registerSearchDocs(server) {
|
|
8
26
|
server.registerTool('search_docs', {
|
|
9
|
-
description: "Search lism-css documentation by keyword. Returns matching pages with relevance scores. Supports CSS property names (e.g. 'font-size', 'padding') which are automatically expanded to corresponding lism prop names
|
|
27
|
+
description: "Search lism-css documentation by keyword. Returns matching pages with relevance scores. Supports CSS property names (e.g. 'font-size', 'padding') which are automatically expanded to corresponding lism prop names.\n" +
|
|
28
|
+
'Use this when you cannot find information with other tools, or to discover available components, features, and guides by keyword.\n' +
|
|
29
|
+
'Do NOT use this as your first step — prefer get_component for a known component, get_props_system for a known prop, or get_guide for a specific topic. This is a fallback search tool.\n' +
|
|
30
|
+
'Returns JSON with search results including page URLs and relevance scores.',
|
|
10
31
|
inputSchema: {
|
|
11
32
|
query: z.string().describe('Search query (keywords separated by spaces). CSS property names like "font-size" are also accepted.'),
|
|
12
33
|
category: z.enum(DOC_CATEGORIES).default('all').describe('Filter by documentation category.'),
|
|
@@ -16,15 +37,12 @@ export function registerSearchDocs(server) {
|
|
|
16
37
|
}, ({ query, category, limit }) => {
|
|
17
38
|
try {
|
|
18
39
|
const entries = loadJSON('docs-index.json', z.array(DocsEntrySchema));
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const aliasMap = buildAliasMap(components);
|
|
22
|
-
const cssPropertyMap = buildCssPropertyMap(propsData.categories);
|
|
23
|
-
const results = searchDocs(entries, query, { category, limit, aliasMap, cssPropertyMap });
|
|
40
|
+
const cssPropertyMap = buildCssPropertyMapFromMarkdown(loadMarkdown('property-class.md'));
|
|
41
|
+
const results = searchDocs(entries, query, { category, limit, cssPropertyMap });
|
|
24
42
|
return success({ query, results });
|
|
25
43
|
}
|
|
26
44
|
catch (e) {
|
|
27
|
-
return error(`Failed to search docs: ${e instanceof Error ? e.message : String(e)}. The data files may not be built yet.
|
|
45
|
+
return error(`Failed to search docs: ${e instanceof Error ? e.message : String(e)}. The data files may not be built yet. Run "pnpm build" in packages/mcp first.`);
|
|
28
46
|
}
|
|
29
47
|
});
|
|
30
48
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lism-css/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "MCP server for lism-css documentation and API reference.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"scripts": {
|
|
25
25
|
"format": "prettier --write . --ignore-path ../../.prettierignore",
|
|
26
|
-
"build": "tsc -p tsconfig.build.json && cp src/data
|
|
26
|
+
"build": "tsc -p tsconfig.build.json && cp src/data/docs-index.json dist/data/ && rm -rf dist/data/guides && cp -r ../../.claude/skills/lism-css-guide dist/data/guides",
|
|
27
27
|
"dev": "tsc --watch",
|
|
28
28
|
"test": "vitest run"
|
|
29
29
|
}
|