@cascivo/mcp 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 urbanisierung
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
13
+ all 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 ADDED
@@ -0,0 +1,59 @@
1
+ <!-- generated by scripts/readme/generate.ts — edit readme.body.md, not this file -->
2
+
3
+ # @cascivo/mcp
4
+
5
+ > MCP server exposing the cascade component registry to AI agents
6
+
7
+ [cascivo.com](https://cascivo.com) · [Docs](https://docs.cascivo.com) · [Storybook](https://storybook.cascivo.com) · [GitHub](https://github.com/urbanisierung/cascivo)
8
+
9
+ ## Usage
10
+
11
+ Add it to your MCP client configuration:
12
+
13
+ ```json
14
+ {
15
+ "mcpServers": {
16
+ "cascivo": {
17
+ "command": "npx",
18
+ "args": ["-y", "@cascivo/mcp"]
19
+ }
20
+ }
21
+ }
22
+ ```
23
+
24
+ The server speaks the MCP stdio transport. By default it reads the `registry.json` bundled with the package; override with the `CASCIVO_REGISTRY_PATH` environment variable to point at a local registry.
25
+
26
+ ## Tools
27
+
28
+ | Tool | Input | Returns |
29
+ | ------------------- | ------------------------------------- | -------------------------------------------------------- |
30
+ | `list_components` | `{ category? }` | All component manifests, optionally filtered by category |
31
+ | `get_component` | `{ name }` | The full manifest for one component |
32
+ | `search_components` | `{ query }` | Components matching name, tags, or description |
33
+ | `add_to_project` | `{ name, outputDir? }` | Runs `cascivo add <name>` as a child process |
34
+ | `create_theme` | `{ primary, neutral, accent, name? }` | A custom theme as CSS (semantic token layer) |
35
+ | `scaffold_page` | `{ description, components? }` | A JSX page layout string |
36
+
37
+ `category` is one of `inputs`, `display`, `overlay`, `navigation`, `feedback`.
38
+
39
+ ## Programmatic use
40
+
41
+ ```ts
42
+ import { createServer } from '@cascivo/mcp'
43
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
44
+
45
+ const server = createServer({ registryPath: './registry.json' })
46
+ await server.connect(new StdioServerTransport())
47
+ ```
48
+
49
+ The pure helpers (`listComponents`, `getComponent`, `searchComponents`, `generateThemeCss`, `scaffoldPage`) are exported too, so the registry can be queried without spinning up the protocol.
50
+
51
+ ## Install
52
+
53
+ ```sh
54
+ pnpm add @cascivo/mcp
55
+ ```
56
+
57
+ ---
58
+
59
+ [cascivo.com](https://cascivo.com) · [Docs](https://docs.cascivo.com) · [Storybook](https://storybook.cascivo.com) · [GitHub](https://github.com/urbanisierung/cascivo) · AI agents: use [`@cascivo/mcp`](https://github.com/urbanisierung/cascivo/tree/main/packages/mcp) and [`registry.json`](https://github.com/urbanisierung/cascivo/blob/main/registry.json) · MIT
@@ -0,0 +1,100 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+
3
+ //#region src/server.d.ts
4
+ type FetchFn = (url: string, init?: RequestInit) => Promise<Response>;
5
+ interface ServerOptions {
6
+ registryPath?: string;
7
+ version?: string;
8
+ /** Injectable fetch function — used for testing multi-registry features. */
9
+ fetchFn?: FetchFn;
10
+ }
11
+ /** Build a configured McpServer exposing the cascade component registry. */
12
+ declare function createServer(options?: ServerOptions): McpServer;
13
+ //#endregion
14
+ //#region src/theme.d.ts
15
+ interface ThemeColors {
16
+ /** Main brand / interactive color (maps to the accent token family). */
17
+ primary: string;
18
+ /** Base gray used to derive surfaces, borders, and text. */
19
+ neutral: string;
20
+ /** Secondary highlight color (info / focus ring). */
21
+ accent: string;
22
+ }
23
+ /**
24
+ * Generate a custom cascade theme as CSS. Maps the three input colors onto the
25
+ * semantic token layer; component tokens inherit automatically.
26
+ */
27
+ declare function generateThemeCss(colors: ThemeColors, name?: string): string;
28
+ //#endregion
29
+ //#region src/scaffold.d.ts
30
+ interface ScaffoldOptions {
31
+ description: string;
32
+ components?: string[];
33
+ }
34
+ /**
35
+ * Generate a JSX page layout string from a natural-language description and an
36
+ * optional list of cascade components to include.
37
+ */
38
+ declare function scaffoldPage(options: ScaffoldOptions): string;
39
+ //#endregion
40
+ //#region src/registry.d.ts
41
+ interface PropManifest {
42
+ name: string;
43
+ type: string;
44
+ required: boolean;
45
+ default?: string;
46
+ description?: string;
47
+ }
48
+ interface ComponentManifest {
49
+ name: string;
50
+ description: string;
51
+ category: string;
52
+ states: string[];
53
+ variants: string[];
54
+ sizes: string[];
55
+ props: PropManifest[];
56
+ tokens: string[];
57
+ accessibility: {
58
+ role: string;
59
+ wcag: string;
60
+ keyboard: string[];
61
+ };
62
+ examples: {
63
+ title: string;
64
+ code: string;
65
+ description?: string;
66
+ }[];
67
+ dependencies: string[];
68
+ tags: string[];
69
+ }
70
+ interface RegistryComponent {
71
+ name: string;
72
+ type?: 'component' | 'layout' | 'block' | 'chart' | 'section';
73
+ description: string;
74
+ category: string;
75
+ version: string;
76
+ files: string[];
77
+ dependencies: string[];
78
+ tags: string[];
79
+ meta: ComponentManifest;
80
+ }
81
+ interface Registry {
82
+ version: string;
83
+ generatedAt: string;
84
+ components: RegistryComponent[];
85
+ }
86
+ declare function loadRegistry(path?: string): Registry;
87
+ /** List component manifests, optionally filtered by category and/or type. */
88
+ declare function listComponents(registry: Registry, category?: string, type?: string): ComponentManifest[];
89
+ /** Find one component manifest by name (matches registry name or meta name). */
90
+ declare function getComponent(registry: Registry, name: string): ComponentManifest | undefined;
91
+ /** Fuzzy search over name, tags, and description. */
92
+ declare function searchComponents(registry: Registry, query: string): ComponentManifest[];
93
+ //#endregion
94
+ //#region src/index.d.ts
95
+ declare const VERSION = "0.0.0";
96
+ /** Start the MCP server over stdio. */
97
+ declare function main(): Promise<void>;
98
+ //#endregion
99
+ export { type ComponentManifest, type Registry, type RegistryComponent, type ScaffoldOptions, type ServerOptions, type ThemeColors, VERSION, createServer, generateThemeCss, getComponent, listComponents, loadRegistry, main, scaffoldPage, searchComponents };
100
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/server.ts","../src/theme.ts","../src/scaffold.ts","../src/registry.ts","../src/index.ts"],"mappings":";;;KAsBK,OAAA,IAAW,GAAA,UAAa,IAAA,GAAO,WAAA,KAAgB,OAAA,CAAQ,QAAA;AAAA,UAE3C,aAAA;EACf,YAAA;EACA,OAAA;;EAEA,OAAA,GAAU,OAAO;AAAA;;iBAeH,YAAA,CAAa,OAAA,GAAS,aAAA,GAAqB,SAAS;;;UC3CnD,WAAA;;EAEf,OAAA;EDoBG;EClBH,OAAA;;EAEA,MAAA;AAAA;;;;;iBAiBc,gBAAA,CAAiB,MAAA,EAAQ,WAAW,EAAE,IAAA;;;UCvBrC,eAAA;EACf,WAAA;EACA,UAAU;AAAA;;;;;iBAgCI,YAAA,CAAa,OAAwB,EAAf,eAAe;;;UC9BpC,YAAA;EACf,IAAA;EACA,IAAA;EACA,QAAA;EACA,OAAA;EACA,WAAA;AAAA;AAAA,UAGe,iBAAA;EACf,IAAA;EACA,WAAA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