@schemyx/mcp 0.1.8 → 0.1.10
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 +6 -40
- package/dist/codebase-scanner/bundle.d.ts +1 -1
- package/dist/codebase-scanner/bundle.js +27 -3
- package/dist/codebase-scanner/bundle.js.map +1 -1
- package/dist/codebase-scanner/index.js +32 -1
- package/dist/codebase-scanner/index.js.map +1 -1
- package/dist/codebase-scanner/utils.js +25 -6
- package/dist/codebase-scanner/utils.js.map +1 -1
- package/dist/main.js +1 -6
- package/dist/main.js.map +1 -1
- package/dist/server/index.d.ts +2 -7
- package/dist/server/index.js +14 -105
- package/dist/server/index.js.map +1 -1
- package/dist/server/tool-definitions.d.ts +1 -13
- package/dist/server/tool-definitions.js +3 -173
- package/dist/server/tool-definitions.js.map +1 -1
- package/package.json +2 -2
- package/dist/backend-client.d.ts +0 -1
- package/dist/backend-client.js +0 -18
- package/dist/backend-client.js.map +0 -1
- package/dist/client/backend-client.d.ts +0 -17
- package/dist/client/backend-client.js +0 -97
- package/dist/client/backend-client.js.map +0 -1
- package/dist/client/local-theme-source.d.ts +0 -19
- package/dist/client/local-theme-source.js +0 -737
- package/dist/client/local-theme-source.js.map +0 -1
- package/dist/client/mcp-client.d.ts +0 -15
- package/dist/client/mcp-client.js +0 -46
- package/dist/client/mcp-client.js.map +0 -1
- package/dist/config.d.ts +0 -1
- package/dist/config.js +0 -18
- package/dist/config.js.map +0 -1
- package/dist/local-theme-source.d.ts +0 -1
- package/dist/local-theme-source.js +0 -18
- package/dist/local-theme-source.js.map +0 -1
- package/dist/mcp-client.d.ts +0 -1
- package/dist/mcp-client.js +0 -18
- package/dist/mcp-client.js.map +0 -1
- package/dist/prompts.d.ts +0 -1
- package/dist/prompts.js +0 -18
- package/dist/prompts.js.map +0 -1
- package/dist/server/prompts.d.ts +0 -7
- package/dist/server/prompts.js +0 -55
- package/dist/server/prompts.js.map +0 -1
- package/dist/server.d.ts +0 -4
- package/dist/server.js +0 -163
- package/dist/server.js.map +0 -1
- package/dist/shared/config.d.ts +0 -2
- package/dist/shared/config.js +0 -59
- package/dist/shared/config.js.map +0 -1
- package/dist/shared/types.d.ts +0 -119
- package/dist/shared/types.js +0 -3
- package/dist/shared/types.js.map +0 -1
- package/dist/shared/uri.d.ts +0 -6
- package/dist/shared/uri.js +0 -24
- package/dist/shared/uri.js.map +0 -1
- package/dist/style-recipes.d.ts +0 -1
- package/dist/style-recipes.js +0 -18
- package/dist/style-recipes.js.map +0 -1
- package/dist/text.d.ts +0 -1
- package/dist/text.js +0 -18
- package/dist/text.js.map +0 -1
- package/dist/theme/style-recipes.d.ts +0 -26
- package/dist/theme/style-recipes.js +0 -129
- package/dist/theme/style-recipes.js.map +0 -1
- package/dist/tool-definitions.d.ts +0 -1
- package/dist/tool-definitions.js +0 -18
- package/dist/tool-definitions.js.map +0 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -18
- package/dist/types.js.map +0 -1
- package/dist/uri.d.ts +0 -1
- package/dist/uri.js +0 -18
- package/dist/uri.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
# @schemyx/mcp
|
|
2
2
|
|
|
3
|
-
Local stdio MCP server for reading Schemyx
|
|
3
|
+
Local stdio MCP server for building and reading Schemyx local codebase context.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This agent-facing MCP exposes only local codebase scan tools. It does not expose saved Schemyx config registry tools, Theme Forge files, or local theme exports, so agents cannot accidentally use config from a different project.
|
|
6
6
|
|
|
7
7
|
## Usage
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
From the project an agent should work on:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
# From a repo that contains ./schemyx-ui-theme/themeforge.json
|
|
13
12
|
npx -y @schemyx/mcp
|
|
14
13
|
```
|
|
15
14
|
|
|
16
|
-
Hosted Schemyx:
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
SCHEMYX_API_KEY=skx_live_replace_me npx -y @schemyx/mcp
|
|
20
|
-
```
|
|
21
|
-
|
|
22
15
|
MCP client config:
|
|
23
16
|
|
|
24
17
|
```json
|
|
@@ -26,10 +19,7 @@ MCP client config:
|
|
|
26
19
|
"mcpServers": {
|
|
27
20
|
"schemyx": {
|
|
28
21
|
"command": "npx",
|
|
29
|
-
"args": ["-y", "@schemyx/mcp@latest"]
|
|
30
|
-
"env": {
|
|
31
|
-
"SCHEMYX_API_KEY": "$SCHEMYX_API_KEY"
|
|
32
|
-
}
|
|
22
|
+
"args": ["-y", "@schemyx/mcp@latest"]
|
|
33
23
|
}
|
|
34
24
|
}
|
|
35
25
|
}
|
|
@@ -37,29 +27,7 @@ MCP client config:
|
|
|
37
27
|
|
|
38
28
|
## Environment
|
|
39
29
|
|
|
40
|
-
- `
|
|
41
|
-
- `SCHEMYX_API_URL`: optional API base URL, defaults to `https://api.schemyx.com`
|
|
42
|
-
- `SCHEMYX_PROJECT_ID`: optional project filter
|
|
43
|
-
- `SCHEMYX_CONFIG_ID`: optional config filter
|
|
44
|
-
- `SCHEMYX_MCP_CACHE_TTL_MS`: optional discovery cache TTL, defaults to `10000`
|
|
45
|
-
- `SCHEMYX_MCP_SOURCE`: optional source mode, `auto`, `local`, or `remote`; defaults to `auto`
|
|
46
|
-
- `SCHEMYX_THEME_DIR`: optional local theme directory containing `themeforge.json`
|
|
47
|
-
- `SCHEMYX_MCP_EXPOSE_SAVED_CONFIG_TOOLS`: set to `true` only for intentional saved Theme Forge/config registry workflows. Defaults to hidden so local codebase generation starts from `schemyx_prepare_task`.
|
|
48
|
-
- `SCHEMYX_MCP_CWD`: optional cwd used for local theme discovery
|
|
49
|
-
|
|
50
|
-
## Local Theme Discovery
|
|
51
|
-
|
|
52
|
-
In `auto` mode, the MCP server searches upward from the current working directory and uses the first local theme it finds:
|
|
53
|
-
|
|
54
|
-
1. `./schemyx-ui-theme/themeforge.json`
|
|
55
|
-
2. `./.schemyx/theme/themeforge.json`
|
|
56
|
-
3. `./themeforge.json`
|
|
57
|
-
|
|
58
|
-
If none exists, it uses the hosted API.
|
|
59
|
-
|
|
60
|
-
Local discovery exposes the compact style index (`agent-style-index.json`), agent style contract (`agent-style-contract.json`), standard Theme Forge files, all current target-stack artifacts (`tailwind-theme.css`, `shadcn-globals.css`, `mui-theme.ts`, `chakra-system.ts`, `mantine-theme.ts`, `styled-theme.ts`, `theme.scss`, `tokens.json`, `react-native-theme.ts`), stack helper files placed next to `themeforge.json` such as `components.json` or `tailwind.config.ts`, and any extra safe relative paths listed in `schemyx-theme-bundle.manifest.json`.
|
|
61
|
-
|
|
62
|
-
For targeted lookup, use `schemyx_list_style_recipes` and `schemyx_get_style_recipe`. Example: `schemyx_get_style_recipe` with `{ "key": "ui.input" }` returns only the input recipe and direct dependencies.
|
|
30
|
+
- `SCHEMYX_MCP_CWD`: optional project root used when a tool call does not pass `rootPath`
|
|
63
31
|
|
|
64
32
|
## Local Codebase Scan
|
|
65
33
|
|
|
@@ -100,7 +68,7 @@ For generation or editing, start with `schemyx_prepare_task`:
|
|
|
100
68
|
|
|
101
69
|
`schemyx_prepare_task` verifies or creates the local scan, resolves the task context pack, includes required source-backed reads through Schemyx, and returns the no-invention policy agents should follow before writing code.
|
|
102
70
|
|
|
103
|
-
Saved Theme Forge/config registry tools
|
|
71
|
+
Saved Theme Forge/config registry tools and resources are not exposed by this codebase agent MCP. This prevents agents from accidentally using a theme export from a different project when you asked them to build from the current codebase.
|
|
104
72
|
|
|
105
73
|
Use `schemyx_scan_codebase` with an explicit scope:
|
|
106
74
|
|
|
@@ -128,7 +96,5 @@ From the backend repo root:
|
|
|
128
96
|
|
|
129
97
|
```bash
|
|
130
98
|
npm run build:mcp
|
|
131
|
-
SCHEMYX_API_URL=http://localhost:3001 \
|
|
132
|
-
SCHEMYX_API_KEY=skx_test_replace_me \
|
|
133
99
|
npm run mcp:local
|
|
134
100
|
```
|
|
@@ -244,7 +244,7 @@ export declare function createUiGenerationGuidance(kind: string, elements: UiEle
|
|
|
244
244
|
export declare function summarizeActionUsages(elements: UiElement[]): Array<Record<string, unknown>>;
|
|
245
245
|
export declare function actionVariantNamesForElement(element: UiElement): string[];
|
|
246
246
|
export declare function addUiPatternRules(entries: RegistryEntry[], usedKeys: Set<string>, nodes: GraphNode[], edges: GraphEdge[], files: AnalyzedFile[], styleContext?: StyleResolutionContext): void;
|
|
247
|
-
export declare function addUiCompositionRules(entries: RegistryEntry[], usedKeys: Set<string>, nodes: GraphNode[], edges: GraphEdge[], files: AnalyzedFile[], styleContext?: StyleResolutionContext): void;
|
|
247
|
+
export declare function addUiCompositionRules(entries: RegistryEntry[], usedKeys: Set<string>, nodes: GraphNode[], edges: GraphEdge[], files: AnalyzedFile[], rootPath: string, styleContext?: StyleResolutionContext): void;
|
|
248
248
|
export declare function addGlobalUiContractRules(entries: RegistryEntry[], usedKeys: Set<string>, nodes: GraphNode[], edges: GraphEdge[], files: AnalyzedFile[]): void;
|
|
249
249
|
export declare function addConnectedPatternRules(entries: RegistryEntry[], usedKeys: Set<string>, nodes: GraphNode[], edges: GraphEdge[], reviewItems: ReviewItem[], files: AnalyzedFile[], styleContext?: StyleResolutionContext): void;
|
|
250
250
|
export declare function buildConnectedPatternClusters(files: AnalyzedFile[], styleContext?: StyleResolutionContext): ConnectedPatternCluster[];
|
|
@@ -186,14 +186,19 @@ function createBundle(rootPath, projectType, files) {
|
|
|
186
186
|
const componentStyleContext = createComponentStyleContext(files);
|
|
187
187
|
enrichUiElementsWithComponentStyles(files, componentStyleContext);
|
|
188
188
|
const styleResolutionContext = createStyleResolutionContext(files);
|
|
189
|
+
const localImportKeysByPath = createLocalImportKeyMap(rootPath, files);
|
|
189
190
|
for (const file of files) {
|
|
190
191
|
const fileSource = sourceInfo('core.files', 'high', [`path:${file.relPath}`], file);
|
|
192
|
+
const localImportKeys = localImportKeysByPath.get(file.relPath) ?? [];
|
|
191
193
|
addEntry(entries, usedKeys, {
|
|
192
194
|
key: file.key,
|
|
193
195
|
group: 'file',
|
|
194
196
|
summary: file.summary,
|
|
195
197
|
tags: file.tags,
|
|
196
|
-
dependencies:
|
|
198
|
+
dependencies: (0, utils_1.unique)([
|
|
199
|
+
...file.dependencies.map((dependency) => (0, utils_1.toRegistryKey)('dep', dependency)),
|
|
200
|
+
...localImportKeys,
|
|
201
|
+
]),
|
|
197
202
|
usedBy: [],
|
|
198
203
|
confidence: 'high',
|
|
199
204
|
status: 'inferred',
|
|
@@ -268,6 +273,7 @@ function createBundle(rootPath, projectType, files) {
|
|
|
268
273
|
const compositionRuleKey = (0, utils_1.toRegistryKey)('rule', `ui.composition.${file.relPath.replace(/\.[^.]+$/, '')}`);
|
|
269
274
|
const dependencies = (0, utils_1.unique)([
|
|
270
275
|
file.key,
|
|
276
|
+
...localImportKeys,
|
|
271
277
|
...(hasStyleSurface(file) ? [styleKey] : []),
|
|
272
278
|
...(file.uiElements.length ? [compositionRuleKey] : []),
|
|
273
279
|
]);
|
|
@@ -339,6 +345,7 @@ function createBundle(rootPath, projectType, files) {
|
|
|
339
345
|
const compositionRuleKey = (0, utils_1.toRegistryKey)('rule', `ui.composition.${file.relPath.replace(/\.[^.]+$/, '')}`);
|
|
340
346
|
const dependencies = (0, utils_1.unique)([
|
|
341
347
|
file.key,
|
|
348
|
+
...localImportKeys,
|
|
342
349
|
...(hasStyleSurface(file) ? [styleKey] : []),
|
|
343
350
|
...(file.uiElements.length ? [compositionRuleKey] : []),
|
|
344
351
|
]);
|
|
@@ -699,7 +706,7 @@ function createBundle(rootPath, projectType, files) {
|
|
|
699
706
|
}
|
|
700
707
|
}
|
|
701
708
|
addUiPatternRules(entries, usedKeys, nodes, edges, files, styleResolutionContext);
|
|
702
|
-
addUiCompositionRules(entries, usedKeys, nodes, edges, files, styleResolutionContext);
|
|
709
|
+
addUiCompositionRules(entries, usedKeys, nodes, edges, files, rootPath, styleResolutionContext);
|
|
703
710
|
addGlobalUiContractRules(entries, usedKeys, nodes, edges, files);
|
|
704
711
|
addConnectedPatternRules(entries, usedKeys, nodes, edges, reviewItems, files, styleResolutionContext);
|
|
705
712
|
addRenderEdges(entries, files, edges);
|
|
@@ -739,6 +746,20 @@ function createComponentStyleContext(files) {
|
|
|
739
746
|
}
|
|
740
747
|
return { byName, byHelper };
|
|
741
748
|
}
|
|
749
|
+
function createLocalImportKeyMap(rootPath, files) {
|
|
750
|
+
const relPaths = new Set(files.map((file) => file.relPath));
|
|
751
|
+
const result = new Map();
|
|
752
|
+
for (const file of files) {
|
|
753
|
+
const localImportKeys = file.imports
|
|
754
|
+
.filter(utils_1.isRelativeImport)
|
|
755
|
+
.map((importValue) => (0, utils_1.resolveImportPath)(file.relPath, importValue, relPaths, rootPath))
|
|
756
|
+
.filter((targetRelPath) => Boolean(targetRelPath))
|
|
757
|
+
.filter((targetRelPath) => targetRelPath !== file.relPath)
|
|
758
|
+
.map((targetRelPath) => (0, utils_1.toRegistryKey)('file', targetRelPath.replace(/\.[^.]+$/, '')));
|
|
759
|
+
result.set(file.relPath, (0, utils_1.unique)(localImportKeys));
|
|
760
|
+
}
|
|
761
|
+
return result;
|
|
762
|
+
}
|
|
742
763
|
function enrichUiElementsWithComponentStyles(files, context) {
|
|
743
764
|
for (const file of files) {
|
|
744
765
|
file.uiElements = file.uiElements.map((element) => enrichUiElementWithComponentStyles(element, context));
|
|
@@ -3310,7 +3331,8 @@ function addUiPatternRules(entries, usedKeys, nodes, edges, files, styleContext)
|
|
|
3310
3331
|
}
|
|
3311
3332
|
}
|
|
3312
3333
|
}
|
|
3313
|
-
function addUiCompositionRules(entries, usedKeys, nodes, edges, files, styleContext) {
|
|
3334
|
+
function addUiCompositionRules(entries, usedKeys, nodes, edges, files, rootPath, styleContext) {
|
|
3335
|
+
const localImportKeysByPath = createLocalImportKeyMap(rootPath, files);
|
|
3314
3336
|
for (const file of files) {
|
|
3315
3337
|
if ((0, extractors_1.isTestFile)(file.relPath)) {
|
|
3316
3338
|
continue;
|
|
@@ -3322,8 +3344,10 @@ function addUiCompositionRules(entries, usedKeys, nodes, edges, files, styleCont
|
|
|
3322
3344
|
const styleKey = (0, utils_1.toRegistryKey)('style', file.relPath.replace(/\.[^.]+$/, ''));
|
|
3323
3345
|
const componentKeys = file.components.map((component) => (0, utils_1.toRegistryKey)('component', component));
|
|
3324
3346
|
const routeKeys = file.routes.map((route) => (0, utils_1.toRegistryKey)('route', route));
|
|
3347
|
+
const localImportKeys = localImportKeysByPath.get(file.relPath) ?? [];
|
|
3325
3348
|
const dependencies = (0, utils_1.unique)([
|
|
3326
3349
|
file.key,
|
|
3350
|
+
...localImportKeys,
|
|
3327
3351
|
...(hasStyleSurface(file) ? [styleKey] : []),
|
|
3328
3352
|
...componentKeys,
|
|
3329
3353
|
...routeKeys,
|