@volue/wave-mcp 0.1.0-next.8 → 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/CHANGELOG.md +24 -1
- package/README.md +12 -11
- package/dist/index-BrA3U3r-.js +278 -0
- package/dist/index.js +1 -1
- package/dist/server-BxwRwA9t.js +1 -0
- package/dist/transports/http.js +1 -1
- package/dist/transports/stdio.js +1 -1
- package/package.json +9 -8
- package/dist/index-381M0Zp2.js +0 -121
- package/dist/server-BxXSw3gh.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,4 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
<!--
|
|
5
|
+
<!-- MONOWEAVE:BELOW -->
|
|
6
|
+
|
|
7
|
+
## [0.1.0](https://github.com/Volue/wave/compare/@volue/wave-mcp@0.1.0-next.0...@volue/wave-mcp@0.1.0) "@volue/wave-mcp" (2025-10-16)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* add `get_styling_guidelines` tool ([e6c1189](https://github.com/Volue/wave/commit/e6c11891da2255998b0b8799dbad7a35150b5d3b))
|
|
13
|
+
* add `getTokens` tool ([c6abd19](https://github.com/Volue/wave/commit/c6abd191fca2a0c975cab897802d9237a2e4bc25))
|
|
14
|
+
* add env for switching to stable docs ([86a871e](https://github.com/Volue/wave/commit/86a871e1608480f648e0b72f9ef051773d528dc1))
|
|
15
|
+
* add Wave MCP server ([419aac2](https://github.com/Volue/wave/commit/419aac270175fe2ed1c578208aa3185c132de00d))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* entry file check ([f32d5fc](https://github.com/Volue/wave/commit/f32d5fc04dd1c7f98b486ba85ca3a0e3973110b4))
|
|
21
|
+
* improve get_color_usage tool ([59aa188](https://github.com/Volue/wave/commit/59aa1889e7af046cf24c6dee2aa882ca65fcdd9c))
|
|
22
|
+
* minify build ([861ab64](https://github.com/Volue/wave/commit/861ab6407366d6bf372706423f9bc414f2dbdd43))
|
|
23
|
+
* path format issue ([c877ac0](https://github.com/Volue/wave/commit/c877ac0ba40ca3a80d5d2ba5c0e162644b3dba15))
|
|
24
|
+
* use esm ([11d5586](https://github.com/Volue/wave/commit/11d5586c2516e11874a1a383290d72a9014825a5))
|
|
25
|
+
* use single bin with argument-based routing ([2fc63f1](https://github.com/Volue/wave/commit/2fc63f1669ef09ac13be79a4d5c4c845ac73002b))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
package/README.md
CHANGED
|
@@ -4,17 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
## Available Tools
|
|
6
6
|
|
|
7
|
-
| Tool Name
|
|
8
|
-
|
|
|
9
|
-
| `init`
|
|
10
|
-
| `list_components`
|
|
11
|
-
| `get_component`
|
|
12
|
-
| `list_patterns`
|
|
13
|
-
| `get_pattern`
|
|
14
|
-
| `get_color_usage`
|
|
15
|
-
| `get_tokens`
|
|
16
|
-
| `
|
|
17
|
-
| `
|
|
7
|
+
| Tool Name | Description |
|
|
8
|
+
| ------------------------ | -------------------------------------------------------------------------------- |
|
|
9
|
+
| `init` | Initialize the Wave Design System in your project |
|
|
10
|
+
| `list_components` | List all available components grouped by category |
|
|
11
|
+
| `get_component` | Get comprehensive documentation for a specific component |
|
|
12
|
+
| `list_patterns` | List all UX patterns grouped by category |
|
|
13
|
+
| `get_pattern` | Retrieve detailed guidance for a specific pattern |
|
|
14
|
+
| `get_color_usage` | Get color token usage and guidelines |
|
|
15
|
+
| `get_tokens` | Get design tokens and usage examples |
|
|
16
|
+
| `get_styling_guidelines` | Retrieve guidelines for styling components and creating custom styled components |
|
|
17
|
+
| `list_icons` | List all available icons in the Wave icon library |
|
|
18
|
+
| `get_icon` | Get SVG code and usage information for a specific icon |
|
|
18
19
|
|
|
19
20
|
## Setup
|
|
20
21
|
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
var _=Object.defineProperty;var s=(e,t)=>_(e,"name",{value:t,configurable:!0});import{a as p,f as m,u as g,g as d}from"./server-BxwRwA9t.js";import U from"@volue/design-colors/generic";import*as P from"@volue/design-icons";import*as A from"@volue/design-media-queries";import k from"@volue/wave-react/tokens";import D from"remark-parse";import M from"unified";import{z as f}from"zod";const z=M().use(D),w={Components:"component","UX patterns":"pattern"};function N(e,t){const o=z.parse(e);let n=null;return o.children.reduce((r,i)=>{if(p(i,"heading")&&i.depth===2)return n=j(i),r;if(!n||!p(i,"list"))return r;const a=n,c=i.children.map(l=>F(l,a,t)).filter(l=>l!==null);return r.concat(c)},[])}s(N,"parseLlmsIndex");function j(e){const[t]=e.children;if(!t||!p(t,"text"))return null;const o=t.value.trim();if(!(o in w))return null;const n=w[o];return{title:o,type:n}}s(j,"extractSectionContext");function F(e,t,o){const[n]=e.children;if(!n||!p(n,"paragraph")||n.children.length!==2)return null;const[r,i]=n.children;if(!p(r,"link")||!p(i,"text")||r.children.length!==1)return null;const a=r.children[0];if(!p(a,"text"))return null;const c=a.value.trim(),l=r.url.replace(/^\//,""),R=new URL(l,`${o}/`).toString(),I=O(l),L=G(t.title,l,t.type),W=V(i.value);return{name:c,slug:I,category:L,section:t.title,type:t.type,url:R,description:W??void 0}}s(F,"listItemToResource");function O(e){return e.replace(/\.md$/,"").split("/").pop()??""}s(O,"deriveSlug");function G(e,t,o){const n=t.replace(/\.md$/,"").split("/");if(o==="component"||o==="pattern"){const r=n.length>=3?n[n.length-2]:null;return r?`${e} / ${H(r)}`:e}return e}s(G,"deriveCategory");function H(e){return e.split("-").filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}s(H,"formatSegment");function V(e){if(!e)return null;const t=e.replace(/^\s*:\s*/,"").trim();return t.toLowerCase()==="no description available"?null:t}s(V,"normalizeDescription");const h=process.env.USE_STABLE_DOCS==="true"||process.env.USE_STABLE_DOCS==="1"?"https://wave.volue.com":"https://wave-design-system.vercel.app",q=`${h}/llms.txt`,X=1e3*60*15,Q=process.env.WAVE_RESOURCES_CACHE_TIME?Number.parseInt(process.env.WAVE_RESOURCES_CACHE_TIME,10):X;function y(e){const t=new URL(e,h);return t.pathname.endsWith(".md")||(t.pathname+=".md"),t.toString()}s(y,"createUrl");let v=null,$=0;async function Y(){if(v!==null&&Date.now()<$)return v;const e=await J();return v=e,$=Date.now()+Q,e}s(Y,"listCachedResources");let u=null;async function J(){return u||(u=K().finally(()=>{u=null})),u}s(J,"idempotentLoadResourcesFromLlms");async function K(){const e=await m(q,void 0,"fetch llms.txt");return N(e,h)}s(K,"loadResourcesFromLlms");async function Z(e){return m(e.url,void 0,`fetch ${e.name} documentation`)}s(Z,"fetchComponent");function ee(e){return m(e.url,void 0,`fetch ${e.name} pattern`)}s(ee,"fetchPattern");async function te(){return m(y("get-started/developing"),void 0,"fetch developing guide")}s(te,"fetchDevelopingGuide");async function ne(){return m(y("tokens/colors"),void 0,"fetch color usage guidelines")}s(ne,"fetchColorUsageGuidelines");function b(){return Object.entries(P).map(([e,t])=>({name:e,svg:t}))}s(b,"listIcons");function oe(){const e=b();return g(e.map(t=>t.name))}s(oe,"getIconNames");function re(e,t){const o=t.trim().toLowerCase();return e.find(n=>n.name.toLowerCase()===o)}s(re,"findIconByName");async function T(e){return(await Y()).filter(o=>o.type===e)}s(T,"listResourcesByType");function C(e,t){const o=t.trim().toLowerCase();return e.find(n=>n.name.toLowerCase()===o)}s(C,"findResourceByName");function S(){return T("component")}s(S,"listComponents");async function ie(){const e=await S();return g(e.map(t=>t.name))}s(ie,"getComponentNames");function x(){return T("pattern")}s(x,"listPatterns");async function se(){const e=await x();return g(e.map(t=>t.name))}s(se,"getPatternNames");function B(e){return e.reduce((t,o)=>(t[o.category]||(t[o.category]=[]),t[o.category].push(o),t),{})}s(B,"groupResourcesByCategory");const ae={name:"get_color_usage",description:"Retrieve the Wave Design System color tokens and guidelines for applying color in user interfaces.",exec(e,{name:t,description:o}){e.tool(t,o,async()=>{try{const n=await ne();return{content:[{type:"text",text:JSON.stringify(U)},{type:"text",text:`Here are the Wave Design System color usage guidelines:
|
|
2
|
+
|
|
3
|
+
${n}
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
Source: ${y("tokens/colors")}`}]}}catch(n){return{isError:!0,content:[{type:"text",text:`Failed to retrieve color usage guidelines: ${d(n)}`}]}}})}},ce={name:"get_component",description:"Retrieve comprehensive documentation for a specific Wave Design System component by name. This tool retrieves the import instructions, basic usage and advanced configuration examples, code snippets for common scenarios, available props/properties table and some general guidelines for a given Wave Design System component.",async ctx(){try{return{componentNames:await ie()}}catch(e){throw new Error(`Failed to initialize component tool: ${d(e)}`)}},exec(e,{ctx:t,name:o,description:n}){e.tool(o,n,{name:f.enum(t.componentNames).describe("The name of the component to retrieve documentation for. This can be derived from calling the `get_components` tool.")},async({name:r})=>{try{const i=await S(),a=C(i,r);if(!a)throw new Error("Component not found");const c=await Z(a);return c?{content:[{type:"text",text:`Here is the documentation for the \`${a.name}\` component from the Wave Design System:
|
|
7
|
+
|
|
8
|
+
${c}
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
Source: ${a.url}`}]}:{content:[{type:"text",text:`No documentation content found for the \`${a.name}\` component.`}]}}catch(i){return{isError:!0,content:[{type:"text",text:`Failed to retrieve documentation for \`${r}\`: ${d(i)}`}]}}})}},le={name:"get_icon",description:"Retrieve a specific icon information by name from Wave Design System.",exec(e,{name:t,description:o}){e.tool(t,o,{name:f.enum(oe()).describe("The icon name to retrieve. This can be derived from calling the `list_icon` tool.")},async({name:n})=>{try{const r=b(),i=re(r,n);if(!i)throw new Error("Icon not found.");const a=`<SvgIcon iconName="${i.name}" />`,c=`<div class="svgIcon svgIcon--stroked">
|
|
12
|
+
<svg focusable="false" aria-hidden="true">
|
|
13
|
+
<use xlink:href="#svg--${i.name}"></use>
|
|
14
|
+
</svg>
|
|
15
|
+
</div>`;return{content:[{type:"text",text:`# ${i.name} icon
|
|
16
|
+
|
|
17
|
+
## React component:
|
|
18
|
+
|
|
19
|
+
\`\`\`tsx
|
|
20
|
+
${a}
|
|
21
|
+
\`\`\`
|
|
22
|
+
|
|
23
|
+
## HTML markup:
|
|
24
|
+
|
|
25
|
+
\`\`\`html
|
|
26
|
+
${c}
|
|
27
|
+
\`\`\`
|
|
28
|
+
|
|
29
|
+
## Raw SVG code:
|
|
30
|
+
|
|
31
|
+
\`\`\`svg
|
|
32
|
+
${i.svg}
|
|
33
|
+
\`\`\``}]}}catch(r){return{isError:!0,content:[{type:"text",text:`Failed to retrieve icon \`${n}\`: ${d(r)}`}]}}})}},de={name:"get_pattern",description:"Retrieve documentation for a specific Wave Design System UX pattern by name. This tool provides guidance, examples and components that implement the selected pattern.",async ctx(){try{return{patternNames:await se()}}catch(e){throw new Error(`Failed to initialize pattern tool: ${d(e)}`)}},exec(e,{ctx:t,name:o,description:n}){e.tool(o,n,{name:f.enum(t.patternNames).describe("The name of the UX pattern to retrieve documentation for. This can be derived from calling the `list_patterns` tool.")},async({name:r})=>{try{const i=await x(),a=C(i,r);if(!a)throw new Error("Pattern not found");const c=await ee(a);return{content:[{type:"text",text:`Here are the guidelines for the \`${a.name}\` UX pattern from the Wave Design System:
|
|
34
|
+
|
|
35
|
+
${c}
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
Source: ${a.url}`}]}}catch(i){return{isError:!0,content:[{type:"text",text:`Failed to retrieve documentation for \`${r}\`: ${d(i)}`}]}}})}},pe={name:"get_styling_guidelines",description:"Retrieve guidelines for styling Wave Design System components and creating custom styled components.",exec(e,{name:t,description:o}){e.tool(t,o,async()=>({content:[{type:"text",text:`Wave Design System components can be styled using standard React approaches (className, style attribute), but Wave provides specialized styling APIs for customizing component styles and creating custom styled components. These APIs are powered by Stitches.js, a CSS-in-JS library with near-zero runtime. They are the recommended approach because they integrate seamlessly with Wave's design tokens and provide type-safe styles.
|
|
39
|
+
|
|
40
|
+
## Styling APIs
|
|
41
|
+
|
|
42
|
+
### CSS Prop
|
|
43
|
+
|
|
44
|
+
The \`css\` property is available on all Wave components for styling. It generates CSS class names from the style object, supporting all standard CSS properties and selectors, plus design tokens and responsive breakpoints.
|
|
45
|
+
|
|
46
|
+
Example:
|
|
47
|
+
|
|
48
|
+
\`\`\`tsx
|
|
49
|
+
import { Box } from '@volue/wave-react';
|
|
50
|
+
|
|
51
|
+
<Box
|
|
52
|
+
css={{
|
|
53
|
+
display: 'flex',
|
|
54
|
+
color: '$foregroundInverse',
|
|
55
|
+
backgroundColor: '$backgroundAccentStrong',
|
|
56
|
+
padding: '$spacingM'
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
\`\`\`
|
|
60
|
+
|
|
61
|
+
The \`css\` prop works best for one-off style customizations of specific component instances.
|
|
62
|
+
|
|
63
|
+
### Styled Function
|
|
64
|
+
|
|
65
|
+
Use \`styled()\` to create reusable styled components with semantic names. It supports all \`css\` prop features, variants for conditional styling, and provides better performance than the \`css\` prop.
|
|
66
|
+
|
|
67
|
+
\`\`\`tsx
|
|
68
|
+
import { styled } from '@volue/wave-react';
|
|
69
|
+
|
|
70
|
+
// Create a simple styled component
|
|
71
|
+
const Container = styled('div', {
|
|
72
|
+
padding: '$spacingM',
|
|
73
|
+
backgroundColor: '$backgroundNeutralSubtle',
|
|
74
|
+
borderRadius: '$borderRadiusM'
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Create a styled component with variants
|
|
78
|
+
const SectionTitle = styled('h2', {
|
|
79
|
+
fontWeight: '$semibold',
|
|
80
|
+
color: '$foregroundAccent',
|
|
81
|
+
|
|
82
|
+
variants: {
|
|
83
|
+
size: {
|
|
84
|
+
medium: {
|
|
85
|
+
fontSize: '$gamma',
|
|
86
|
+
},
|
|
87
|
+
large: {
|
|
88
|
+
fontSize: '$beta',
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
// optional defaultVariants
|
|
94
|
+
defaultVariants: {
|
|
95
|
+
size: 'medium'
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Use with a specific variant
|
|
100
|
+
<SectionTitle size="large">Analytics Overview</SectionTitle>
|
|
101
|
+
|
|
102
|
+
// Extend an existing Wave component
|
|
103
|
+
import { AppFrame } from '@volue/wave-react';
|
|
104
|
+
|
|
105
|
+
const StyledAppFrame = styled(AppFrame.Root, {
|
|
106
|
+
backgroundColor: '$backgroundNeutralMinimal'
|
|
107
|
+
});
|
|
108
|
+
\`\`\`
|
|
109
|
+
|
|
110
|
+
## Design Tokens
|
|
111
|
+
|
|
112
|
+
Wave provides a comprehensive set of design tokens for colors, spacing, typography, border radii, shadows, and more. All tokens are available in both \`css\` prop and \`styled()\` function using the \`$tokenName\` syntax (as shown in the examples above).
|
|
113
|
+
|
|
114
|
+
**Use the \`get_tokens\` tool to discover all available design tokens** including their values and usage examples.
|
|
115
|
+
|
|
116
|
+
## Media Query Tokens
|
|
117
|
+
|
|
118
|
+
Wave provides media query tokens for responsive design. Use these tokens to create breakpoint-based styles:
|
|
119
|
+
|
|
120
|
+
${Object.entries(A).map(([r,i])=>`- \`@${r}\`: ${i}`).join(`
|
|
121
|
+
`)}
|
|
122
|
+
|
|
123
|
+
### Responsive Styling Examples
|
|
124
|
+
|
|
125
|
+
**Using media queries with the css prop:**
|
|
126
|
+
|
|
127
|
+
\`\`\`tsx
|
|
128
|
+
import { Box } from '@volue/wave-react';
|
|
129
|
+
|
|
130
|
+
<Box
|
|
131
|
+
css={{
|
|
132
|
+
padding: '$spacingS',
|
|
133
|
+
|
|
134
|
+
'@mqMediumAndUp': {
|
|
135
|
+
padding: '$spacingM'
|
|
136
|
+
},
|
|
137
|
+
'@mqLargeAndUp': {
|
|
138
|
+
padding: '$spacingL'
|
|
139
|
+
}
|
|
140
|
+
}}
|
|
141
|
+
>
|
|
142
|
+
Responsive padding
|
|
143
|
+
</Box>
|
|
144
|
+
\`\`\`
|
|
145
|
+
|
|
146
|
+
**Using media queries with styled function:**
|
|
147
|
+
|
|
148
|
+
\`\`\`tsx
|
|
149
|
+
import { styled } from '@volue/wave-react';
|
|
150
|
+
|
|
151
|
+
const ResponsiveContainer = styled('div', {
|
|
152
|
+
display: 'flex',
|
|
153
|
+
flexDirection: 'column',
|
|
154
|
+
gap: '$spacingS',
|
|
155
|
+
|
|
156
|
+
'@mqMediumAndUp': {
|
|
157
|
+
flexDirection: 'row',
|
|
158
|
+
gap: '$spacingM'
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
\`\`\`
|
|
162
|
+
|
|
163
|
+
**Responsive variants:**
|
|
164
|
+
|
|
165
|
+
\`\`\`tsx
|
|
166
|
+
import { styled } from '@volue/wave-react';
|
|
167
|
+
|
|
168
|
+
const Button = styled('button', {
|
|
169
|
+
variants: {
|
|
170
|
+
size: {
|
|
171
|
+
small: { padding: '$spacingS' },
|
|
172
|
+
large: { padding: '$spacingL' }
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// Apply different variants at different breakpoints
|
|
178
|
+
<Button
|
|
179
|
+
size={{
|
|
180
|
+
'@initial': 'small',
|
|
181
|
+
'@mqLargeAndUp': 'large'
|
|
182
|
+
}}
|
|
183
|
+
>
|
|
184
|
+
Responsive Button
|
|
185
|
+
</Button>
|
|
186
|
+
\`\`\`
|
|
187
|
+
|
|
188
|
+
## Best Practices
|
|
189
|
+
|
|
190
|
+
1. **Use design tokens**: Always prefer design tokens (prefixed with \`$\`) over hardcoded values for consistency. Use the \`get_tokens\` tool to discover available tokens.
|
|
191
|
+
2. **Choose the right API**: Use \`css\` prop for one-off styles, \`styled()\` for reusable components
|
|
192
|
+
3. **Semantic breakpoints**: Use Wave's semantic media query tokens rather than arbitrary pixel values
|
|
193
|
+
`}]}))}},me={colors:["background","backgroundColor","backgroundImage","border","borderBlock","borderBlockEnd","borderBlockStart","borderBottom","borderBottomColor","borderColor","borderInline","borderInlineEnd","borderInlineStart","borderLeft","borderLeftColor","borderRight","borderRightColor","borderTop","borderTopColor","caretColor","color","columnRuleColor","fill","outlineColor","stroke","textDecorationColor"],fonts:["fontFamily"],fontSizes:["fontSize"],fontWeights:["fontWeight"],lineHeights:["lineHeight"],letterSpacings:["letterSpacing"],radii:["borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],sizes:["blockSize","minBlockSize","maxBlockSize","inlineSize","minInlineSize","maxInlineSize","width","minWidth","maxWidth","height","minHeight","maxHeight","flexBasis","gridTemplateColumns","gridTemplateRows"],space:["gap","gridGap","columnGap","gridColumnGap","rowGap","gridRowGap","inset","insetBlock","insetBlockEnd","insetBlockStart","insetInline","insetInlineEnd","insetInlineStart","margin","marginTop","marginRight","marginBottom","marginLeft","marginBlock","marginBlockEnd","marginBlockStart","marginInline","marginInlineEnd","marginInlineStart","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingBlock","paddingBlockEnd","paddingBlockStart","paddingInline","paddingInlineEnd","paddingInlineStart","top","right","bottom","left","scrollMargin","scrollMarginTop","scrollMarginRight","scrollMarginBottom","scrollMarginLeft","scrollMarginX","scrollMarginY","scrollMarginBlock","scrollMarginBlockEnd","scrollMarginBlockStart","scrollMarginInline","scrollMarginInlineEnd","scrollMarginInlineStart","scrollPadding","scrollPaddingTop","scrollPaddingRight","scrollPaddingBottom","scrollPaddingLeft","scrollPaddingX","scrollPaddingY","scrollPaddingBlock","scrollPaddingBlockEnd","scrollPaddingBlockStart","scrollPaddingInline","scrollPaddingInlineEnd","scrollPaddingInlineStart"],zIndices:["zIndex"],shadows:["boxShadow","textShadow"],transitions:["transition"],borderWidths:["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth"],borderStyles:["borderStyle","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle"]},ue={name:"get_tokens",description:"Retrieve the Wave Design System design tokens (colors, fonts, spacing, font styles, etc.) exposed by the `@volue/wave-react` package. Includes token type mappings to CSS properties and usage examples.",exec(e,{name:t,description:o}){e.tool(t,o,async()=>{const n=Object.entries(me).map(([r,i])=>`| ${r} | ${i.join(", ")} |`).join(`
|
|
194
|
+
`);return{content:[{type:"text",text:`Below is a list of design tokens available from Wave Design System.
|
|
195
|
+
There are ${Object.keys(k).length} token types available:
|
|
196
|
+
|
|
197
|
+
${JSON.stringify(k)}`},{type:"text",text:`## Token Type to CSS Property Mapping
|
|
198
|
+
|
|
199
|
+
Token types are automatically mapped to CSS Properties:
|
|
200
|
+
|
|
201
|
+
| Token | Properties |
|
|
202
|
+
|-------|------------|
|
|
203
|
+
${n}
|
|
204
|
+
|
|
205
|
+
## Using tokens
|
|
206
|
+
|
|
207
|
+
Tokens can be used to style components.
|
|
208
|
+
|
|
209
|
+
\`\`\`tsx
|
|
210
|
+
import { styled } from '@volue/wave-react';
|
|
211
|
+
|
|
212
|
+
const Button = styled('button', {
|
|
213
|
+
backgroundColor: '$backgroundAccentStrong'
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
() => <Button>Button</Button>;
|
|
217
|
+
\`\`\`
|
|
218
|
+
|
|
219
|
+
Tokens also work inside the \`css\` prop.
|
|
220
|
+
|
|
221
|
+
\`\`\`tsx
|
|
222
|
+
const Button = styled('button', {});
|
|
223
|
+
|
|
224
|
+
() => (
|
|
225
|
+
<Button
|
|
226
|
+
css={{
|
|
227
|
+
backgroundColor: '$backgroundAccentStrong'
|
|
228
|
+
}}
|
|
229
|
+
>
|
|
230
|
+
Button
|
|
231
|
+
</Button>
|
|
232
|
+
);
|
|
233
|
+
\`\`\`
|
|
234
|
+
|
|
235
|
+
You can pick a token from any of available token types by prefixing them with the type name, in case they aren't automatically mapped.
|
|
236
|
+
|
|
237
|
+
\`\`\`tsx
|
|
238
|
+
const Button = styled('button', {
|
|
239
|
+
// use a token from the sizes scale
|
|
240
|
+
marginTop: '$sizes$6'
|
|
241
|
+
});
|
|
242
|
+
\`\`\`
|
|
243
|
+
|
|
244
|
+
For more comprehensive styling guidelines including responsive design, variants, and best practices, call the \`get_styling_guidelines\` tool.
|
|
245
|
+
`}]}})}},ge={name:"init",description:"Get guide on how to setup or create a project that includes Wave Design System.",exec(e,{name:t,description:o}){e.tool(t,o,async()=>{try{return{content:[{type:"text",text:`The getting started documentation for developing with Wave Design System is included below.
|
|
246
|
+
|
|
247
|
+
It's **important** that if the project is using a tool like Vite or Next.js, one of the pre-configured starter templates should be used instead of manual configuration:
|
|
248
|
+
|
|
249
|
+
- https://github.com/Volue/wave-vite-example (Vite template)
|
|
250
|
+
- https://github.com/Volue/wave-nextjs-app-router-example (Next.js App Router template)
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
${await te()}
|
|
255
|
+
`}]}}catch(n){return{isError:!0,content:[{type:"text",text:`Failed to retrieve getting started documentation: ${d(n)}`}]}}})}},fe={name:"list_components",description:"List all components available from the Wave Design System. This tool retrieves the names of all available Wave Design System components grouped by category.",exec(e,{name:t,description:o}){e.tool(t,o,async()=>{try{const n=await S(),r=B(n);return{content:[{type:"text",text:`The following components are available in the Wave Design System:
|
|
256
|
+
|
|
257
|
+
${Object.entries(r).map(([a,c])=>`## ${a}
|
|
258
|
+
${c.map(l=>`- ${l.name}`).join(`
|
|
259
|
+
`)}`).join(`
|
|
260
|
+
|
|
261
|
+
`)}
|
|
262
|
+
|
|
263
|
+
Use the \`get_component\` tool to get more information about a specific component.
|
|
264
|
+
|
|
265
|
+
Use these components from the @volue/wave-react package.`}]}}catch(n){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the component index: ${d(n)}`}]}}})}},he={name:"list_icons",description:"List all icons available from the Wave Design System. Icons are sourced directly from the `@volue/design-icons` package.",exec(e,{name:t,description:o}){e.tool(t,o,async()=>{try{return{content:[{type:"text",text:`The following icons are available in the Wave Design System:
|
|
266
|
+
|
|
267
|
+
${b().map(i=>`- ${i.name}`).join(`
|
|
268
|
+
`)}
|
|
269
|
+
|
|
270
|
+
Use the \`get_icon\` tool to retrieve the SVG markup and usage guidelines for a specific icon.`}]}}catch(n){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the icon data: ${d(n)}`}]}}})}},ye={name:"list_patterns",description:"List all UX patterns available from the Wave Design System. This tool retrieves the names of all available Wave Design System patterns grouped by category.",exec(e,{name:t,description:o}){e.tool(t,o,async()=>{try{const n=await x(),r=B(n);return{content:[{type:"text",text:`The following UX patterns are available in the Wave Design System:
|
|
271
|
+
|
|
272
|
+
${Object.entries(r).map(([a,c])=>`## ${a}
|
|
273
|
+
${c.map(l=>`- ${l.name}`).join(`
|
|
274
|
+
`)}`).join(`
|
|
275
|
+
|
|
276
|
+
`)}
|
|
277
|
+
|
|
278
|
+
Use the \`get_pattern\` tool to access detailed guidance for a specific pattern.`}]}}catch(n){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the pattern index: ${d(n)}`}]}}})}},ve=[ge,fe,ce,ye,de,ae,he,le,ue,pe],E=new Set;async function be(e){await Promise.all(ve.map(async t=>{if(E.has(t.name))return;const o=await t.ctx?.();E.add(t.name),t.exec(e,{name:t.name,description:t.description,ctx:o})}))}s(be,"initializeTools");export{be as i};
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var e=Object.defineProperty;var t=(o,r)=>e(o,"name",{value:r,configurable:!0});import{i}from"./server-
|
|
2
|
+
var e=Object.defineProperty;var t=(o,r)=>e(o,"name",{value:r,configurable:!0});import{i}from"./server-BxwRwA9t.js";import{s as g}from"./server-BxwRwA9t.js";import"node:fs";import"node:url";import"@modelcontextprotocol/sdk/server/mcp.js";if(i(import.meta.url)){const r=process.argv.slice(2)[0]||"stdio";async function s(){try{switch(r){case"stdio":await import("./transports/stdio.js");break;case"http":process.argv.push("--auto-run"),await import("./transports/http.js");break;default:console.error(`Unknown transport: ${r}`),console.error("Available transports: stdio, http"),process.exit(1)}}catch(a){console.error("Error running transport:",a),process.exit(1)}}t(s,"run"),s()}export{g as server};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i=Object.defineProperty;var t=(r,e)=>i(r,"name",{value:e,configurable:!0});import{realpathSync as c}from"node:fs";import{pathToFileURL as f}from"node:url";import{McpServer as p}from"@modelcontextprotocol/sdk/server/mcp.js";async function u(r,e,n){const s=await fetch(r,e);if(!s.ok){const a=n??`fetch ${r}`;throw new Error(`Failed to ${a}: ${s.status} ${s.statusText}`)}return s.text()}t(u,"fetchMarkdown");function m(r,e){return r.type===e}t(m,"isNodeType");function v(r){return Array.from(new Set(r))}t(v,"uniq");function h(r){return r instanceof Error?r.message:"Unknown error"}t(h,"getErrorMessage");function g(r){if(!process.argv[1])return!1;const e=c(process.argv[1]),n=f(e);return r===n.href}t(g,"isEntryFile");var l="0.1.0",o={version:l};const w=new p({name:"Wave Design System",version:o.version,capabilities:{prompts:{},resources:{},tools:{}}});export{m as a,u as f,h as g,g as i,o as p,w as s,v as u};
|
package/dist/transports/http.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var h=Object.defineProperty;var i=(e,s)=>h(e,"name",{value:s,configurable:!0});import{StreamableHTTPServerTransport as f}from"@modelcontextprotocol/sdk/server/streamableHttp.js";import{isInitializeRequest as g}from"@modelcontextprotocol/sdk/types.js";import I from"cors";import l from"express";import{randomUUID as S}from"node:crypto";import{s as m,p as T,i as w}from"../server-
|
|
2
|
+
var h=Object.defineProperty;var i=(e,s)=>h(e,"name",{value:s,configurable:!0});import{StreamableHTTPServerTransport as f}from"@modelcontextprotocol/sdk/server/streamableHttp.js";import{isInitializeRequest as g}from"@modelcontextprotocol/sdk/types.js";import I from"cors";import l from"express";import{randomUUID as S}from"node:crypto";import{s as m,p as T,i as w}from"../server-BxwRwA9t.js";import{i as y}from"../index-BrA3U3r-.js";import"node:fs";import"node:url";import"@modelcontextprotocol/sdk/server/mcp.js";import"@volue/design-colors/generic";import"@volue/design-icons";import"@volue/design-media-queries";import"@volue/wave-react/tokens";import"remark-parse";import"unified";import"zod";const t=l(),P=process.env.CORS_ORIGIN?.split(",")??"*";t.use(I({origin:P,exposedHeaders:["Mcp-Session-Id"],allowedHeaders:["Content-Type","mcp-session-id"]})),t.use(l.json());const r=new Map;t.post("/mcp",async(e,s)=>{const n=e.headers["mcp-session-id"];let o;if(n&&r.has(n))o=r.get(n);else if(!n&&g(e.body))o=new f({sessionIdGenerator:i(()=>S(),"sessionIdGenerator"),onsessioninitialized:i(v=>{r.set(v,o)},"onsessioninitialized")}),o.onclose=()=>{o.sessionId&&r.has(o.sessionId)&&r.delete(o.sessionId)},await y(m),await m.connect(o);else return s.status(400).json({error:{message:"Bad Request: No valid session ID provided"}});await o.handleRequest(e,s,e.body)});const d=i(async(e,s)=>{const n=e.headers["mcp-session-id"];if(!n||!r.has(n))return s.status(404).send("Invalid or missing session ID");await r.get(n).handleRequest(e,s)},"handleSessionRequest");t.get("/mcp",d),t.delete("/mcp",d),t.get("/",(e,s)=>{s.json({name:"Wave MCP Server",version:T.version,description:"MCP server for Wave Design System",endpoints:{"/":"Server information (this response)","/mcp":"Streamable HTTP endpoint for MCP connection","/health":"Health check endpoint"}})}),t.get("/health",(e,s)=>{s.json({status:"healthy",timestamp:new Date().toISOString(),uptime:process.uptime()})});const a=process.env.HOST??"localhost",p=process.env.PORT?Number(process.env.PORT):3e3;let c=null;(process.argv.includes("--auto-run")||w(import.meta.url))&&(c=t.listen(p,a,e=>{e&&(console.error("\u274C Failed to start server:",e),process.exit(1)),console.log(`\u{1F680} Wave MCP Server running on http://${a}:${p}`),console.log(`\u{1F517} Connect via http://${a}:${p}/mcp`)}));const u=i(async()=>{const e=Array.from(r.values()).map(s=>s.close());c&&e.push(new Promise(s=>c.close(()=>s()))),await Promise.allSettled(e),console.log("\u{1F44B} Server shut down gracefully"),process.exit(0)},"cleanup");process.on("SIGTERM",u),process.on("SIGINT",u);export{t as default};
|
package/dist/transports/stdio.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var s=Object.defineProperty;var t=(o,r)=>s(o,"name",{value:r,configurable:!0});import{StdioServerTransport as e}from"@modelcontextprotocol/sdk/server/stdio.js";import{s as i}from"../server-
|
|
2
|
+
var s=Object.defineProperty;var t=(o,r)=>s(o,"name",{value:r,configurable:!0});import{StdioServerTransport as e}from"@modelcontextprotocol/sdk/server/stdio.js";import{s as i}from"../server-BxwRwA9t.js";import{i as p}from"../index-BrA3U3r-.js";import"node:fs";import"node:url";import"@modelcontextprotocol/sdk/server/mcp.js";import"@volue/design-colors/generic";import"@volue/design-icons";import"@volue/design-media-queries";import"@volue/wave-react/tokens";import"remark-parse";import"unified";import"zod";async function a(){await p(i);const o=new e;await i.connect(o);const r=t(async()=>{await o.close(),process.exit(0)},"cleanup");process.on("SIGTERM",r),process.on("SIGINT",r)}t(a,"main"),a().catch(o=>{console.error("\u274C Failed to start server:",o),process.exit(1)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volue/wave-mcp",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "An MCP server that connects AI tools to the Wave Design System",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -51,13 +51,14 @@
|
|
|
51
51
|
"inspect:http": "yarn dlx -q @modelcontextprotocol/inspector --transport http --server-url http://localhost:3000/mcp"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@modelcontextprotocol/sdk": "1.
|
|
54
|
+
"@modelcontextprotocol/sdk": "1.20.0",
|
|
55
55
|
"@types/cors": "2.8.19",
|
|
56
56
|
"@types/express": "5.0.3",
|
|
57
|
-
"@types/express-serve-static-core": "5.0
|
|
58
|
-
"@volue/design-colors": "^3.0.10
|
|
59
|
-
"@volue/design-icons": "^1.9.4
|
|
60
|
-
"@volue/
|
|
57
|
+
"@types/express-serve-static-core": "5.1.0",
|
|
58
|
+
"@volue/design-colors": "^3.0.10",
|
|
59
|
+
"@volue/design-icons": "^1.9.4",
|
|
60
|
+
"@volue/design-media-queries": "^1.3.13",
|
|
61
|
+
"@volue/wave-react": "^1.3.0",
|
|
61
62
|
"cors": "2.8.5",
|
|
62
63
|
"express": "5.1.0",
|
|
63
64
|
"remark-parse": "8.0.3",
|
|
@@ -67,11 +68,11 @@
|
|
|
67
68
|
},
|
|
68
69
|
"devDependencies": {
|
|
69
70
|
"@types/mdast": "3.0.15",
|
|
70
|
-
"@types/node": "22.18.
|
|
71
|
+
"@types/node": "22.18.10",
|
|
71
72
|
"@volue/eslint-config": "1.3.11",
|
|
72
73
|
"eslint": "9.36.0",
|
|
73
74
|
"npm-run-all2": "8.0.4",
|
|
74
|
-
"pkgroll": "2.
|
|
75
|
+
"pkgroll": "2.19.0",
|
|
75
76
|
"premove": "4.0.0",
|
|
76
77
|
"prettier": "3.6.2",
|
|
77
78
|
"tsx": "4.20.6",
|
package/dist/index-381M0Zp2.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
var W=Object.defineProperty;var a=(e,t)=>W(e,"name",{value:t,configurable:!0});import{a as m,f as p,u as g,g as d}from"./server-BxXSw3gh.js";import D from"@volue/design-colors/generic";import*as P from"@volue/design-icons";import k from"@volue/wave-react/tokens";import N from"remark-parse";import U from"unified";import{z as f}from"zod";const M=U().use(N),w={Components:"component","UX patterns":"pattern"};function z(e,t){const o=M.parse(e);let n=null;return o.children.reduce((r,i)=>{if(m(i,"heading")&&i.depth===2)return n=j(i),r;if(!n||!m(i,"list"))return r;const s=n,c=i.children.map(l=>A(l,s,t)).filter(l=>l!==null);return r.concat(c)},[])}a(z,"parseLlmsIndex");function j(e){const[t]=e.children;if(!t||!m(t,"text"))return null;const o=t.value.trim();if(!(o in w))return null;const n=w[o];return{title:o,type:n}}a(j,"extractSectionContext");function A(e,t,o){const[n]=e.children;if(!n||!m(n,"paragraph")||n.children.length!==2)return null;const[r,i]=n.children;if(!m(r,"link")||!m(i,"text")||r.children.length!==1)return null;const s=r.children[0];if(!m(s,"text"))return null;const c=s.value.trim(),l=r.url.replace(/^\//,""),R=new URL(l,`${o}/`).toString(),I=O(l),L=F(t.title,l,t.type),_=G(i.value);return{name:c,slug:I,category:L,section:t.title,type:t.type,url:R,description:_??void 0}}a(A,"listItemToResource");function O(e){return e.replace(/\.md$/,"").split("/").pop()??""}a(O,"deriveSlug");function F(e,t,o){const n=t.replace(/\.md$/,"").split("/");if(o==="component"||o==="pattern"){const r=n.length>=3?n[n.length-2]:null;return r?`${e} / ${H(r)}`:e}return e}a(F,"deriveCategory");function H(e){return e.split("-").filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}a(H,"formatSegment");function G(e){if(!e)return null;const t=e.replace(/^\s*:\s*/,"").trim();return t.toLowerCase()==="no description available"?null:t}a(G,"normalizeDescription");const h=process.env.USE_STABLE_DOCS==="true"||process.env.USE_STABLE_DOCS==="1"?"https://wave.volue.com":"https://wave-design-system.vercel.app",V=`${h}/llms.txt`,X=1e3*60*15,Y=process.env.WAVE_RESOURCES_CACHE_TIME?Number.parseInt(process.env.WAVE_RESOURCES_CACHE_TIME,10):X;function y(e){const t=new URL(e,h);return t.pathname.endsWith(".md")||(t.pathname+=".md"),t.toString()}a(y,"createUrl");let v=null,T=0;async function J(){if(v!==null&&Date.now()<T)return v;const e=await q();return v=e,T=Date.now()+Y,e}a(J,"listCachedResources");let u=null;async function q(){return u||(u=K().finally(()=>{u=null})),u}a(q,"idempotentLoadResourcesFromLlms");async function K(){const e=await p(V,void 0,"fetch llms.txt");return z(e,h)}a(K,"loadResourcesFromLlms");async function Q(e){return p(e.url,void 0,`fetch ${e.name} documentation`)}a(Q,"fetchComponent");function Z(e){return p(e.url,void 0,`fetch ${e.name} pattern`)}a(Z,"fetchPattern");async function ee(){return p(y("get-started/developing"),void 0,"fetch developing guide")}a(ee,"fetchDevelopingGuide");async function te(){return p(y("tokens/colors"),void 0,"fetch color usage guidelines")}a(te,"fetchColorUsageGuidelines");function x(){return Object.entries(P).map(([e,t])=>({name:e,svg:t}))}a(x,"listIcons");function ne(){const e=x();return g(e.map(t=>t.name))}a(ne,"getIconNames");function oe(e,t){const o=t.trim().toLowerCase();return e.find(n=>n.name.toLowerCase()===o)}a(oe,"findIconByName");async function C(e){return(await J()).filter(o=>o.type===e)}a(C,"listResourcesByType");function E(e,t){const o=t.trim().toLowerCase();return e.find(n=>n.name.toLowerCase()===o)}a(E,"findResourceByName");function S(){return C("component")}a(S,"listComponents");async function re(){const e=await S();return g(e.map(t=>t.name))}a(re,"getComponentNames");function b(){return C("pattern")}a(b,"listPatterns");async function ie(){const e=await b();return g(e.map(t=>t.name))}a(ie,"getPatternNames");function $(e){return e.reduce((t,o)=>(t[o.category]||(t[o.category]=[]),t[o.category].push(o),t),{})}a($,"groupResourcesByCategory");const ae={name:"get_color_usage",description:"Retrieve the Wave Design System color tokens and guidelines for applying color in user interfaces.",exec(e,{name:t,description:o}){e.tool(t,o,async()=>{try{const n=await te();return{content:[{type:"text",text:JSON.stringify(D)},{type:"text",text:`Here are the Wave Design System color usage guidelines:
|
|
2
|
-
|
|
3
|
-
${n}
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
Source: ${y("tokens/colors")}`}]}}catch(n){return{isError:!0,content:[{type:"text",text:`Failed to retrieve color usage guidelines: ${d(n)}`}]}}})}},se={name:"get_component",description:"Retrieve comprehensive documentation for a specific Wave Design System component by name. This tool retrieves the import instructions, basic usage and advanced configuration examples, code snippets for common scenarios, available props/properties table and some general guidelines for a given Wave Design System component.",async ctx(){try{return{componentNames:await re()}}catch(e){throw new Error(`Failed to initialize component tool: ${d(e)}`)}},exec(e,{ctx:t,name:o,description:n}){e.tool(o,n,{name:f.enum(t.componentNames).describe("The name of the component to retrieve documentation for. This can be derived from calling the `get_components` tool.")},async({name:r})=>{try{const i=await S(),s=E(i,r);if(!s)throw new Error("Component not found");const c=await Q(s);return c?{content:[{type:"text",text:`Here is the documentation for the \`${s.name}\` component from the Wave Design System:
|
|
7
|
-
|
|
8
|
-
${c}
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
Source: ${s.url}`}]}:{content:[{type:"text",text:`No documentation content found for the \`${s.name}\` component.`}]}}catch(i){return{isError:!0,content:[{type:"text",text:`Failed to retrieve documentation for \`${r}\`: ${d(i)}`}]}}})}},ce={name:"get_icon",description:"Retrieve a specific icon information by name from Wave Design System.",exec(e,{name:t,description:o}){e.tool(t,o,{name:f.enum(ne()).describe("The icon name to retrieve. This can be derived from calling the `list_icon` tool.")},async({name:n})=>{try{const r=x(),i=oe(r,n);if(!i)throw new Error("Icon not found.");const s=`<SvgIcon iconName="${i.name}" />`,c=`<div class="svgIcon svgIcon--stroked">
|
|
12
|
-
<svg focusable="false" aria-hidden="true">
|
|
13
|
-
<use xlink:href="#svg--${i.name}"></use>
|
|
14
|
-
</svg>
|
|
15
|
-
</div>`;return{content:[{type:"text",text:`# ${i.name} icon
|
|
16
|
-
|
|
17
|
-
## React component:
|
|
18
|
-
|
|
19
|
-
\`\`\`tsx
|
|
20
|
-
${s}
|
|
21
|
-
\`\`\`
|
|
22
|
-
|
|
23
|
-
## HTML markup:
|
|
24
|
-
|
|
25
|
-
\`\`\`html
|
|
26
|
-
${c}
|
|
27
|
-
\`\`\`
|
|
28
|
-
|
|
29
|
-
## Raw SVG code:
|
|
30
|
-
|
|
31
|
-
\`\`\`svg
|
|
32
|
-
${i.svg}
|
|
33
|
-
\`\`\``}]}}catch(r){return{isError:!0,content:[{type:"text",text:`Failed to retrieve icon \`${n}\`: ${d(r)}`}]}}})}},le={name:"get_pattern",description:"Retrieve documentation for a specific Wave Design System UX pattern by name. This tool provides guidance, examples and components that implement the selected pattern.",async ctx(){try{return{patternNames:await ie()}}catch(e){throw new Error(`Failed to initialize pattern tool: ${d(e)}`)}},exec(e,{ctx:t,name:o,description:n}){e.tool(o,n,{name:f.enum(t.patternNames).describe("The name of the UX pattern to retrieve documentation for. This can be derived from calling the `list_patterns` tool.")},async({name:r})=>{try{const i=await b(),s=E(i,r);if(!s)throw new Error("Pattern not found");const c=await Z(s);return{content:[{type:"text",text:`Here are the guidelines for the \`${s.name}\` UX pattern from the Wave Design System:
|
|
34
|
-
|
|
35
|
-
${c}
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
Source: ${s.url}`}]}}catch(i){return{isError:!0,content:[{type:"text",text:`Failed to retrieve documentation for \`${r}\`: ${d(i)}`}]}}})}},de={colors:["background","backgroundColor","backgroundImage","border","borderBlock","borderBlockEnd","borderBlockStart","borderBottom","borderBottomColor","borderColor","borderInline","borderInlineEnd","borderInlineStart","borderLeft","borderLeftColor","borderRight","borderRightColor","borderTop","borderTopColor","caretColor","color","columnRuleColor","fill","outlineColor","stroke","textDecorationColor"],fonts:["fontFamily"],fontSizes:["fontSize"],fontWeights:["fontWeight"],lineHeights:["lineHeight"],letterSpacings:["letterSpacing"],radii:["borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],sizes:["blockSize","minBlockSize","maxBlockSize","inlineSize","minInlineSize","maxInlineSize","width","minWidth","maxWidth","height","minHeight","maxHeight","flexBasis","gridTemplateColumns","gridTemplateRows"],space:["gap","gridGap","columnGap","gridColumnGap","rowGap","gridRowGap","inset","insetBlock","insetBlockEnd","insetBlockStart","insetInline","insetInlineEnd","insetInlineStart","margin","marginTop","marginRight","marginBottom","marginLeft","marginBlock","marginBlockEnd","marginBlockStart","marginInline","marginInlineEnd","marginInlineStart","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingBlock","paddingBlockEnd","paddingBlockStart","paddingInline","paddingInlineEnd","paddingInlineStart","top","right","bottom","left","scrollMargin","scrollMarginTop","scrollMarginRight","scrollMarginBottom","scrollMarginLeft","scrollMarginX","scrollMarginY","scrollMarginBlock","scrollMarginBlockEnd","scrollMarginBlockStart","scrollMarginInline","scrollMarginInlineEnd","scrollMarginInlineStart","scrollPadding","scrollPaddingTop","scrollPaddingRight","scrollPaddingBottom","scrollPaddingLeft","scrollPaddingX","scrollPaddingY","scrollPaddingBlock","scrollPaddingBlockEnd","scrollPaddingBlockStart","scrollPaddingInline","scrollPaddingInlineEnd","scrollPaddingInlineStart"],zIndices:["zIndex"],shadows:["boxShadow","textShadow"],transitions:["transition"],borderWidths:["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth"],borderStyles:["borderStyle","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle"]},me={name:"get_tokens",description:"Retrieve the Wave Design System design tokens (colors, fonts, spacing, font styles, etc.) exposed by the `@volue/wave-react` package. Includes token type mappings to CSS properties and usage examples.",exec(e,{name:t,description:o}){e.tool(t,o,async()=>{const n=Object.entries(de).map(([r,i])=>`| ${r} | ${i.join(", ")} |`).join(`
|
|
39
|
-
`);return{content:[{type:"text",text:`Below is a list of design tokens available from Wave Design System.
|
|
40
|
-
There are ${Object.keys(k).length} token types available:
|
|
41
|
-
|
|
42
|
-
${JSON.stringify(k)}`},{type:"text",text:`## Token Type to CSS Property Mapping
|
|
43
|
-
|
|
44
|
-
Token types are automatically mapped to CSS Properties:
|
|
45
|
-
|
|
46
|
-
| Token | Properties |
|
|
47
|
-
|-------|------------|
|
|
48
|
-
${n}
|
|
49
|
-
|
|
50
|
-
## Using tokens
|
|
51
|
-
|
|
52
|
-
Tokens can be used to style components.
|
|
53
|
-
|
|
54
|
-
\`\`\`tsx
|
|
55
|
-
import { styled } from '@volue/wave-react';
|
|
56
|
-
|
|
57
|
-
const Button = styled('button', {
|
|
58
|
-
backgroundColor: '$backgroundAccentStrong'
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
() => <Button>Button</Button>;
|
|
62
|
-
\`\`\`
|
|
63
|
-
|
|
64
|
-
Tokens also work inside the \`css\` prop.
|
|
65
|
-
|
|
66
|
-
\`\`\`tsx
|
|
67
|
-
const Button = styled('button', {});
|
|
68
|
-
|
|
69
|
-
() => (
|
|
70
|
-
<Button
|
|
71
|
-
css={{
|
|
72
|
-
backgroundColor: '$backgroundAccentStrong'
|
|
73
|
-
}}
|
|
74
|
-
>
|
|
75
|
-
Button
|
|
76
|
-
</Button>
|
|
77
|
-
);
|
|
78
|
-
\`\`\`
|
|
79
|
-
|
|
80
|
-
You can pick a token from any of available token types by prefixing them with the type name, in case they aren't automatically mapped.
|
|
81
|
-
|
|
82
|
-
\`\`\`tsx
|
|
83
|
-
const Button = styled('button', {
|
|
84
|
-
// use a token from the sizes scale
|
|
85
|
-
marginTop: '$sizes$6'
|
|
86
|
-
});
|
|
87
|
-
\`\`\`
|
|
88
|
-
`}]}})}},pe={name:"init",description:"Get guide on how to setup or create a project that includes Wave Design System.",exec(e,{name:t,description:o}){e.tool(t,o,async()=>{try{return{content:[{type:"text",text:`The getting started documentation for developing with Wave Design System is included below.
|
|
89
|
-
|
|
90
|
-
It's **important** that if the project is using a tool like Vite or Next.js, one of the pre-configured starter templates should be used instead of manual configuration:
|
|
91
|
-
|
|
92
|
-
- https://github.com/Volue/wave-vite-example (Vite template)
|
|
93
|
-
- https://github.com/Volue/wave-nextjs-app-router-example (Next.js App Router template)
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
${await ee()}
|
|
98
|
-
`}]}}catch(n){return{isError:!0,content:[{type:"text",text:`Failed to retrieve getting started documentation: ${d(n)}`}]}}})}},ue={name:"list_components",description:"List all components available from the Wave Design System. This tool retrieves the names of all available Wave Design System components grouped by category.",exec(e,{name:t,description:o}){e.tool(t,o,async()=>{try{const n=await S(),r=$(n);return{content:[{type:"text",text:`The following components are available in the Wave Design System:
|
|
99
|
-
|
|
100
|
-
${Object.entries(r).map(([s,c])=>`## ${s}
|
|
101
|
-
${c.map(l=>`- ${l.name}`).join(`
|
|
102
|
-
`)}`).join(`
|
|
103
|
-
|
|
104
|
-
`)}
|
|
105
|
-
|
|
106
|
-
Use the \`get_component\` tool to get more information about a specific component.
|
|
107
|
-
|
|
108
|
-
Use these components from the @volue/wave-react package.`}]}}catch(n){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the component index: ${d(n)}`}]}}})}},ge={name:"list_icons",description:"List all icons available from the Wave Design System. Icons are sourced directly from the `@volue/design-icons` package.",exec(e,{name:t,description:o}){e.tool(t,o,async()=>{try{return{content:[{type:"text",text:`The following icons are available in the Wave Design System:
|
|
109
|
-
|
|
110
|
-
${x().map(i=>`- ${i.name}`).join(`
|
|
111
|
-
`)}
|
|
112
|
-
|
|
113
|
-
Use the \`get_icon\` tool to retrieve the SVG markup and usage guidelines for a specific icon.`}]}}catch(n){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the icon data: ${d(n)}`}]}}})}},fe={name:"list_patterns",description:"List all UX patterns available from the Wave Design System. This tool retrieves the names of all available Wave Design System patterns grouped by category.",exec(e,{name:t,description:o}){e.tool(t,o,async()=>{try{const n=await b(),r=$(n);return{content:[{type:"text",text:`The following UX patterns are available in the Wave Design System:
|
|
114
|
-
|
|
115
|
-
${Object.entries(r).map(([s,c])=>`## ${s}
|
|
116
|
-
${c.map(l=>`- ${l.name}`).join(`
|
|
117
|
-
`)}`).join(`
|
|
118
|
-
|
|
119
|
-
`)}
|
|
120
|
-
|
|
121
|
-
Use the \`get_pattern\` tool to access detailed guidance for a specific pattern.`}]}}catch(n){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the pattern index: ${d(n)}`}]}}})}},he=[pe,ue,se,fe,le,ae,ge,ce,me],B=new Set;async function ye(e){await Promise.all(he.map(async t=>{if(B.has(t.name))return;const o=await t.ctx?.();B.add(t.name),t.exec(e,{name:t.name,description:t.description,ctx:o})}))}a(ye,"initializeTools");export{ye as i};
|
package/dist/server-BxXSw3gh.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var i=Object.defineProperty;var t=(e,r)=>i(e,"name",{value:r,configurable:!0});import{realpathSync as c}from"node:fs";import{pathToFileURL as f}from"node:url";import{McpServer as p}from"@modelcontextprotocol/sdk/server/mcp.js";async function u(e,r,n){const s=await fetch(e,r);if(!s.ok){const a=n??`fetch ${e}`;throw new Error(`Failed to ${a}: ${s.status} ${s.statusText}`)}return s.text()}t(u,"fetchMarkdown");function m(e,r){return e.type===r}t(m,"isNodeType");function v(e){return Array.from(new Set(e))}t(v,"uniq");function h(e){return e instanceof Error?e.message:"Unknown error"}t(h,"getErrorMessage");function g(e){if(!process.argv[1])return!1;const r=c(process.argv[1]),n=f(r);return e===n.href}t(g,"isEntryFile");var l="0.1.0-next.8",o={version:l};const w=new p({name:"Wave Design System",version:o.version,capabilities:{prompts:{},resources:{},tools:{}}});export{m as a,u as f,h as g,g as i,o as p,w as s,v as u};
|