canvas-ui-sdk 4.0.1 → 4.0.2
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 +41 -3
- package/mcp/dist/index.js +20 -13
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -64,7 +64,47 @@ See `styles/tokens.reference.css` for the full list of available CSS variables.
|
|
|
64
64
|
|
|
65
65
|
## MCP Server
|
|
66
66
|
|
|
67
|
-
Connect the MCP server so your AI editor can discover all components, templates, and design tokens.
|
|
67
|
+
Connect the MCP server so your AI editor can discover all components, templates, and design tokens.
|
|
68
|
+
|
|
69
|
+
### Claude Code
|
|
70
|
+
|
|
71
|
+
Add a `.mcp.json` to your project root:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"mcpServers": {
|
|
76
|
+
"canvas-ui-sdk": {
|
|
77
|
+
"command": "npx",
|
|
78
|
+
"args": ["canvas-ui-mcp"]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Or via CLI: `claude mcp add canvas-ui-sdk npx canvas-ui-mcp`
|
|
85
|
+
|
|
86
|
+
### Cursor
|
|
87
|
+
|
|
88
|
+
Add a `.cursor/mcp.json` to your project root:
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"mcpServers": {
|
|
93
|
+
"canvas-ui-sdk": {
|
|
94
|
+
"command": "npx",
|
|
95
|
+
"args": ["canvas-ui-mcp"]
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Windsurf
|
|
102
|
+
|
|
103
|
+
Add an MCP server in Windsurf settings (Cascade > MCP) with command `npx` and arg `canvas-ui-mcp`.
|
|
104
|
+
|
|
105
|
+
### Alternative (direct node invocation)
|
|
106
|
+
|
|
107
|
+
If `npx` doesn't work in your environment:
|
|
68
108
|
|
|
69
109
|
```json
|
|
70
110
|
{
|
|
@@ -77,8 +117,6 @@ Connect the MCP server so your AI editor can discover all components, templates,
|
|
|
77
117
|
}
|
|
78
118
|
```
|
|
79
119
|
|
|
80
|
-
Or with the Claude Code CLI: `claude mcp add canvas-ui-sdk node node_modules/canvas-ui-sdk/mcp/dist/index.js`
|
|
81
|
-
|
|
82
120
|
## AI Instructions
|
|
83
121
|
|
|
84
122
|
Copy the SDK instructions file into your project so your AI editor knows how to use the CLI, design tokens, and component patterns:
|
package/mcp/dist/index.js
CHANGED
|
@@ -18274,13 +18274,13 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
18274
18274
|
}, true) ?? parseAnyDef(refs)
|
|
18275
18275
|
}), {}) : void 0;
|
|
18276
18276
|
const name = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
18277
|
-
const
|
|
18277
|
+
const main2 = parseDef(schema._def, name === void 0 ? refs : {
|
|
18278
18278
|
...refs,
|
|
18279
18279
|
currentPath: [...refs.basePath, refs.definitionPath, name]
|
|
18280
18280
|
}, false) ?? parseAnyDef(refs);
|
|
18281
18281
|
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
18282
18282
|
if (title !== void 0) {
|
|
18283
|
-
|
|
18283
|
+
main2.title = title;
|
|
18284
18284
|
}
|
|
18285
18285
|
if (refs.flags.hasReferencedOpenAiAnyType) {
|
|
18286
18286
|
if (!definitions) {
|
|
@@ -18301,9 +18301,9 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
18301
18301
|
}
|
|
18302
18302
|
}
|
|
18303
18303
|
const combined = name === void 0 ? definitions ? {
|
|
18304
|
-
...
|
|
18304
|
+
...main2,
|
|
18305
18305
|
[refs.definitionPath]: definitions
|
|
18306
|
-
} :
|
|
18306
|
+
} : main2 : {
|
|
18307
18307
|
$ref: [
|
|
18308
18308
|
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
18309
18309
|
refs.definitionPath,
|
|
@@ -18311,7 +18311,7 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
18311
18311
|
].join("/"),
|
|
18312
18312
|
[refs.definitionPath]: {
|
|
18313
18313
|
...definitions,
|
|
18314
|
-
[name]:
|
|
18314
|
+
[name]: main2
|
|
18315
18315
|
}
|
|
18316
18316
|
};
|
|
18317
18317
|
if (refs.target === "jsonSchema7") {
|
|
@@ -18543,11 +18543,11 @@ var Protocol = class {
|
|
|
18543
18543
|
*
|
|
18544
18544
|
* The Protocol object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.
|
|
18545
18545
|
*/
|
|
18546
|
-
async connect(
|
|
18546
|
+
async connect(transport) {
|
|
18547
18547
|
if (this._transport) {
|
|
18548
18548
|
throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");
|
|
18549
18549
|
}
|
|
18550
|
-
this._transport =
|
|
18550
|
+
this._transport = transport;
|
|
18551
18551
|
const _onclose = this.transport?.onclose;
|
|
18552
18552
|
this._transport.onclose = () => {
|
|
18553
18553
|
_onclose?.();
|
|
@@ -19990,8 +19990,8 @@ var McpServer = class {
|
|
|
19990
19990
|
*
|
|
19991
19991
|
* The `server` object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.
|
|
19992
19992
|
*/
|
|
19993
|
-
async connect(
|
|
19994
|
-
return await this.server.connect(
|
|
19993
|
+
async connect(transport) {
|
|
19994
|
+
return await this.server.connect(transport);
|
|
19995
19995
|
}
|
|
19996
19996
|
/**
|
|
19997
19997
|
* Closes the connection.
|
|
@@ -20744,7 +20744,7 @@ var EMPTY_COMPLETION_RESULT = {
|
|
|
20744
20744
|
};
|
|
20745
20745
|
|
|
20746
20746
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
20747
|
-
import
|
|
20747
|
+
import process2 from "process";
|
|
20748
20748
|
|
|
20749
20749
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
20750
20750
|
var ReadBuffer = class {
|
|
@@ -20776,7 +20776,7 @@ function serializeMessage(message) {
|
|
|
20776
20776
|
|
|
20777
20777
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
20778
20778
|
var StdioServerTransport = class {
|
|
20779
|
-
constructor(_stdin =
|
|
20779
|
+
constructor(_stdin = process2.stdin, _stdout = process2.stdout) {
|
|
20780
20780
|
this._stdin = _stdin;
|
|
20781
20781
|
this._stdout = _stdout;
|
|
20782
20782
|
this._readBuffer = new ReadBuffer();
|
|
@@ -23309,5 +23309,12 @@ ${resultSections.join("\n---\n\n")}`
|
|
|
23309
23309
|
};
|
|
23310
23310
|
}
|
|
23311
23311
|
);
|
|
23312
|
-
|
|
23313
|
-
|
|
23312
|
+
async function main() {
|
|
23313
|
+
const transport = new StdioServerTransport();
|
|
23314
|
+
await server.connect(transport);
|
|
23315
|
+
}
|
|
23316
|
+
main().catch((error2) => {
|
|
23317
|
+
process.stderr.write(`canvas-ui-sdk MCP server failed to start: ${error2}
|
|
23318
|
+
`);
|
|
23319
|
+
process.exit(1);
|
|
23320
|
+
});
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "canvas-ui-sdk",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A comprehensive UI component library with design tokens for building beautiful interfaces",
|
|
6
6
|
"bin": {
|
|
7
|
-
"canvas-ui": "./dist/cli/index.js"
|
|
7
|
+
"canvas-ui": "./dist/cli/index.js",
|
|
8
|
+
"canvas-ui-mcp": "./mcp/dist/index.js"
|
|
8
9
|
},
|
|
9
10
|
"main": "./dist/index.js",
|
|
10
11
|
"module": "./dist/index.js",
|