@volue/wave-mcp 0.1.0-next.4 → 0.1.0-next.6

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 CHANGED
@@ -4,16 +4,16 @@
4
4
 
5
5
  ## Available Tools
6
6
 
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
- | list_icons | List all available icons in the Wave icon library |
16
- | get_icon | Get SVG code and usage information for a specific icon |
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
+ | `list_icons` | List all available icons in the Wave icon library |
16
+ | `get_icon` | Get SVG code and usage information for a specific icon |
17
17
 
18
18
  ## Setup
19
19
 
@@ -40,7 +40,17 @@ Use the button above or manually add to your `.vscode/mcp.json`:
40
40
 
41
41
  ### Claude Code
42
42
 
43
- Add to your Claude Code MCP servers configuration:
43
+ Use the CLI:
44
+
45
+ ```bash
46
+ # 1. Navigate to your project
47
+ cd your-awesome-project
48
+
49
+ # 2. Add Wave MCP server
50
+ claude mcp add wave -- npx -y @volue/wave-mcp@latest
51
+ ```
52
+
53
+ Or manually add to your Claude Code MCP servers configuration:
44
54
 
45
55
  ```json
46
56
  {
@@ -0,0 +1,71 @@
1
+ var k=Object.defineProperty;var r=(e,t)=>k(e,"name",{value:t,configurable:!0});import{a as u,f as p,u as f,g as m}from"./server-Bn99IvSq.js";import N from"@volue/design-colors/generic";import*as W from"@volue/design-icons";import I from"remark-parse";import A from"unified";import{z as g}from"zod";const j=A().use(I),$={Components:"component","UX patterns":"pattern"};function F(e,t){const o=j.parse(e);let n=null;return o.children.reduce((a,i)=>{if(u(i,"heading")&&i.depth===2)return n=B(i),a;if(!n||!u(i,"list"))return a;const s=n,c=i.children.map(l=>P(l,s,t)).filter(l=>l!==null);return a.concat(c)},[])}r(F,"parseLlmsIndex");function B(e){const[t]=e.children;if(!t||!u(t,"text"))return null;const o=t.value.trim();if(!(o in $))return null;const n=$[o];return{title:o,type:n}}r(B,"extractSectionContext");function P(e,t,o){const[n]=e.children;if(!n||!u(n,"paragraph")||n.children.length!==2)return null;const[a,i]=n.children;if(!u(a,"link")||!u(i,"text")||a.children.length!==1)return null;const s=a.children[0];if(!u(s,"text"))return null;const c=s.value.trim(),l=a.url.replace(/^\//,""),L=new URL(l,`${o}/`).toString(),R=O(l),D=M(t.title,l,t.type),U=z(i.value);return{name:c,slug:R,category:D,section:t.title,type:t.type,url:L,description:U??void 0}}r(P,"listItemToResource");function O(e){return e.replace(/\.md$/,"").split("/").pop()??""}r(O,"deriveSlug");function M(e,t,o){const n=t.replace(/\.md$/,"").split("/");if(o==="component"||o==="pattern"){const a=n.length>=3?n[n.length-2]:null;return a?`${e} / ${V(a)}`:e}return e}r(M,"deriveCategory");function V(e){return e.split("-").filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}r(V,"formatSegment");function z(e){if(!e)return null;const t=e.replace(/^\s*:\s*/,"").trim();return t.toLowerCase()==="no description available"?null:t}r(z,"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",H=`${h}/llms.txt`,X=1e3*60*15,G=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()}r(y,"createUrl");let v=null,E=0;async function q(){if(v!==null&&Date.now()<E)return v;const e=await J();return v=e,E=Date.now()+G,e}r(q,"listCachedResources");let d=null;async function J(){return d||(d=Y().finally(()=>{d=null})),d}r(J,"idempotentLoadResourcesFromLlms");async function Y(){const e=await p(H,void 0,"fetch llms.txt");return F(e,h)}r(Y,"loadResourcesFromLlms");async function K(e){return p(e.url,void 0,`fetch ${e.name} documentation`)}r(K,"fetchComponent");function Q(e){return p(e.url,void 0,`fetch ${e.name} pattern`)}r(Q,"fetchPattern");async function Z(){return p(y("get-started/developing"),void 0,"fetch developing guide")}r(Z,"fetchDevelopingGuide");async function ee(){return p(y("tokens/colors"),void 0,"fetch color usage guidelines")}r(ee,"fetchColorUsageGuidelines");function x(){return Object.entries(W).map(([e,t])=>({name:e,svg:t}))}r(x,"listIcons");function te(){const e=x();return f(e.map(t=>t.name))}r(te,"getIconNames");function ne(e,t){const o=t.trim().toLowerCase();return e.find(n=>n.name.toLowerCase()===o)}r(ne,"findIconByName");async function C(e){return(await q()).filter(o=>o.type===e)}r(C,"listResourcesByType");function T(e,t){const o=t.trim().toLowerCase();return e.find(n=>n.name.toLowerCase()===o)}r(T,"findResourceByName");function w(){return C("component")}r(w,"listComponents");async function oe(){const e=await w();return f(e.map(t=>t.name))}r(oe,"getComponentNames");function S(){return C("pattern")}r(S,"listPatterns");async function re(){const e=await S();return f(e.map(t=>t.name))}r(re,"getPatternNames");function b(e){return e.reduce((t,o)=>(t[o.category]||(t[o.category]=[]),t[o.category].push(o),t),{})}r(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 ee();return{content:[{type:"text",text:JSON.stringify(N)},{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: ${m(n)}`}]}}})}},ie={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 oe()}}catch(e){throw new Error(`Failed to initialize component tool: ${m(e)}`)}},exec(e,{ctx:t,name:o,description:n}){e.tool(o,n,{name:g.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:a})=>{try{const i=await w(),s=T(i,a);if(!s)throw new Error("Component not found");const c=await K(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 \`${a}\`: ${m(i)}`}]}}})}},se={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:g.enum(te()).describe("The icon name to retrieve. This can be derived from calling the `list_icon` tool.")},async({name:n})=>{try{const a=x(),i=ne(a,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(a){return{isError:!0,content:[{type:"text",text:`Failed to retrieve icon \`${n}\`: ${m(a)}`}]}}})}},ce={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 re()}}catch(e){throw new Error(`Failed to initialize pattern tool: ${m(e)}`)}},exec(e,{ctx:t,name:o,description:n}){e.tool(o,n,{name:g.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:a})=>{try{const i=await S(),s=T(i,a);if(!s)throw new Error("Pattern not found");const c=await Q(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 \`${a}\`: ${m(i)}`}]}}})}},le={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.
39
+
40
+ 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:
41
+
42
+ - https://github.com/Volue/wave-vite-example (Vite template)
43
+ - https://github.com/Volue/wave-nextjs-app-router-example (Next.js App Router template)
44
+
45
+ ---
46
+
47
+ ${await Z()}
48
+ `}]}}catch(n){return{isError:!0,content:[{type:"text",text:`Failed to retrieve getting started documentation: ${m(n)}`}]}}})}},me={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 w(),a=b(n);return{content:[{type:"text",text:`The following components are available in the Wave Design System:
49
+
50
+ ${Object.entries(a).map(([s,c])=>`## ${s}
51
+ ${c.map(l=>`- ${l.name}`).join(`
52
+ `)}`).join(`
53
+
54
+ `)}
55
+
56
+ Use the \`get_component\` tool to get more information about a specific component.
57
+
58
+ Use these components from the @volue/wave-react package.`}]}}catch(n){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the component index: ${m(n)}`}]}}})}},ue={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:
59
+
60
+ ${x().map(i=>`- ${i.name}`).join(`
61
+ `)}
62
+
63
+ 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: ${m(n)}`}]}}})}},pe={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 S(),a=b(n);return{content:[{type:"text",text:`The following UX patterns are available in the Wave Design System:
64
+
65
+ ${Object.entries(a).map(([s,c])=>`## ${s}
66
+ ${c.map(l=>`- ${l.name}`).join(`
67
+ `)}`).join(`
68
+
69
+ `)}
70
+
71
+ 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: ${m(n)}`}]}}})}},de=[le,me,ie,pe,ce,ae,ue,se],_=new Set;async function fe(e){await Promise.all(de.map(async t=>{if(_.has(t.name))return;const o=await t.ctx?.();_.add(t.name),t.exec(e,{name:t.name,description:t.description,ctx:o})}))}r(fe,"initializeTools");export{fe 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-OHiiWrEh.js";import{s as g}from"./server-OHiiWrEh.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};
2
+ var e=Object.defineProperty;var t=(o,r)=>e(o,"name",{value:r,configurable:!0});import{i}from"./server-Bn99IvSq.js";import{s as g}from"./server-Bn99IvSq.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};
@@ -1 +1 @@
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.4",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};
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.6",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};
@@ -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-OHiiWrEh.js";import{i as y}from"../index-MOeVmAI0.js";import"node:fs";import"node:url";import"@modelcontextprotocol/sdk/server/mcp.js";import"node:module";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 MCPc 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};
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-Bn99IvSq.js";import{i as y}from"../index-DBfwM3Oy.js";import"node:fs";import"node:url";import"@modelcontextprotocol/sdk/server/mcp.js";import"@volue/design-colors/generic";import"@volue/design-icons";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};
@@ -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-OHiiWrEh.js";import{i as a}from"../index-MOeVmAI0.js";import"node:fs";import"node:url";import"@modelcontextprotocol/sdk/server/mcp.js";import"node:module";import"remark-parse";import"unified";import"zod";async function n(){await a(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(n,"main"),n().catch(o=>{console.error("\u274C Failed to start server:",o),process.exit(1)});
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-Bn99IvSq.js";import{i as a}from"../index-DBfwM3Oy.js";import"node:fs";import"node:url";import"@modelcontextprotocol/sdk/server/mcp.js";import"@volue/design-colors/generic";import"@volue/design-icons";import"remark-parse";import"unified";import"zod";async function p(){await a(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(p,"main"),p().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-next.4",
3
+ "version": "0.1.0-next.6",
4
4
  "description": "An MCP server that connects AI tools to the Wave Design System",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -51,12 +51,12 @@
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.17.5",
54
+ "@modelcontextprotocol/sdk": "1.19.1",
55
55
  "@types/cors": "2.8.19",
56
56
  "@types/express": "5.0.3",
57
57
  "@types/express-serve-static-core": "5.0.7",
58
- "@volue/design-colors": "^3.0.10-next.2",
59
- "@volue/design-icons": "^1.9.4-next.2",
58
+ "@volue/design-colors": "^3.0.10-next.4",
59
+ "@volue/design-icons": "^1.9.4-next.4",
60
60
  "cors": "2.8.5",
61
61
  "express": "5.1.0",
62
62
  "remark-parse": "8.0.3",
@@ -65,15 +65,15 @@
65
65
  "zod": "3.25.76"
66
66
  },
67
67
  "devDependencies": {
68
- "@types/mdast": "3.0.3",
69
- "@types/node": "22.18.1",
68
+ "@types/mdast": "3.0.15",
69
+ "@types/node": "22.18.8",
70
70
  "@volue/eslint-config": "1.3.11",
71
- "eslint": "9.32.0",
71
+ "eslint": "9.36.0",
72
72
  "npm-run-all2": "8.0.4",
73
- "pkgroll": "2.15.3",
73
+ "pkgroll": "2.17.0",
74
74
  "premove": "4.0.0",
75
75
  "prettier": "3.6.2",
76
- "tsx": "4.20.5",
77
- "typescript": "5.9.2"
76
+ "tsx": "4.20.6",
77
+ "typescript": "5.9.3"
78
78
  }
79
79
  }
@@ -1,71 +0,0 @@
1
- var N=Object.defineProperty;var r=(e,t)=>N(e,"name",{value:t,configurable:!0});import{a as u,f as p,u as f,g as m}from"./server-OHiiWrEh.js";import{createRequire as W}from"node:module";import I from"remark-parse";import A from"unified";import{z as g}from"zod";const j=A().use(I),$={Components:"component","UX patterns":"pattern"};function F(e,t){const o=j.parse(e);let n=null;return o.children.reduce((a,i)=>{if(u(i,"heading")&&i.depth===2)return n=B(i),a;if(!n||!u(i,"list"))return a;const s=n,c=i.children.map(l=>P(l,s,t)).filter(l=>l!==null);return a.concat(c)},[])}r(F,"parseLlmsIndex");function B(e){const[t]=e.children;if(!t||!u(t,"text"))return null;const o=t.value.trim();if(!(o in $))return null;const n=$[o];return{title:o,type:n}}r(B,"extractSectionContext");function P(e,t,o){const[n]=e.children;if(!n||!u(n,"paragraph")||n.children.length!==2)return null;const[a,i]=n.children;if(!u(a,"link")||!u(i,"text")||a.children.length!==1)return null;const s=a.children[0];if(!u(s,"text"))return null;const c=s.value.trim(),l=a.url.replace(/^\//,""),L=new URL(l,`${o}/`).toString(),D=O(l),U=M(t.title,l,t.type),k=z(i.value);return{name:c,slug:D,category:U,section:t.title,type:t.type,url:L,description:k??void 0}}r(P,"listItemToResource");function O(e){return e.replace(/\.md$/,"").split("/").pop()??""}r(O,"deriveSlug");function M(e,t,o){const n=t.replace(/\.md$/,"").split("/");if(o==="component"||o==="pattern"){const a=n.length>=3?n[n.length-2]:null;return a?`${e} / ${V(a)}`:e}return e}r(M,"deriveCategory");function V(e){return e.split("-").filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}r(V,"formatSegment");function z(e){if(!e)return null;const t=e.replace(/^\s*:\s*/,"").trim();return t.toLowerCase()==="no description available"?null:t}r(z,"normalizeDescription");const E=W(import.meta.url),H=E("@volue/design-colors/generic"),X=E("@volue/design-icons"),h=process.env.USE_STABLE_DOCS==="true"||process.env.USE_STABLE_DOCS==="1"?"https://wave.volue.com":"https://wave-design-system.vercel.app",G=`${h}/llms.txt`,q=1e3*60*15,J=process.env.WAVE_RESOURCES_CACHE_TIME?Number.parseInt(process.env.WAVE_RESOURCES_CACHE_TIME,10):q;function y(e){const t=new URL(e,h);return t.pathname.endsWith(".md")||(t.pathname+=".md"),t.toString()}r(y,"createUrl");let v=null,C=0;async function Y(){if(v!==null&&Date.now()<C)return v;const e=await K();return v=e,C=Date.now()+J,e}r(Y,"listCachedResources");let d=null;async function K(){return d||(d=Q().finally(()=>{d=null})),d}r(K,"idempotentLoadResourcesFromLlms");async function Q(){const e=await p(G,void 0,"fetch llms.txt");return F(e,h)}r(Q,"loadResourcesFromLlms");async function Z(e){return p(e.url,void 0,`fetch ${e.name} documentation`)}r(Z,"fetchComponent");function ee(e){return p(e.url,void 0,`fetch ${e.name} pattern`)}r(ee,"fetchPattern");async function te(){return p(y("get-started/developing"),void 0,"fetch developing guide")}r(te,"fetchDevelopingGuide");async function ne(){return p(y("tokens/colors"),void 0,"fetch color usage guidelines")}r(ne,"fetchColorUsageGuidelines");function x(){return Object.entries(X).map(([e,t])=>({name:e,svg:t}))}r(x,"listIcons");function oe(){const e=x();return f(e.map(t=>t.name))}r(oe,"getIconNames");function re(e,t){const o=t.trim().toLowerCase();return e.find(n=>n.name.toLowerCase()===o)}r(re,"findIconByName");async function T(e){return(await Y()).filter(o=>o.type===e)}r(T,"listResourcesByType");function b(e,t){const o=t.trim().toLowerCase();return e.find(n=>n.name.toLowerCase()===o)}r(b,"findResourceByName");function w(){return T("component")}r(w,"listComponents");async function ae(){const e=await w();return f(e.map(t=>t.name))}r(ae,"getComponentNames");function S(){return T("pattern")}r(S,"listPatterns");async function ie(){const e=await S();return f(e.map(t=>t.name))}r(ie,"getPatternNames");function _(e){return e.reduce((t,o)=>(t[o.category]||(t[o.category]=[]),t[o.category].push(o),t),{})}r(_,"groupResourcesByCategory");const se={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(H)},{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: ${m(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 ae()}}catch(e){throw new Error(`Failed to initialize component tool: ${m(e)}`)}},exec(e,{ctx:t,name:o,description:n}){e.tool(o,n,{name:g.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:a})=>{try{const i=await w(),s=b(i,a);if(!s)throw new Error("Component not found");const c=await Z(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 \`${a}\`: ${m(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:g.enum(oe()).describe("The icon name to retrieve. This can be derived from calling the `list_icon` tool.")},async({name:n})=>{try{const a=x(),i=re(a,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(a){return{isError:!0,content:[{type:"text",text:`Failed to retrieve icon \`${n}\`: ${m(a)}`}]}}})}},me={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: ${m(e)}`)}},exec(e,{ctx:t,name:o,description:n}){e.tool(o,n,{name:g.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:a})=>{try{const i=await S(),s=b(i,a);if(!s)throw new Error("Pattern not found");const c=await ee(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 \`${a}\`: ${m(i)}`}]}}})}},ue={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.
39
-
40
- 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:
41
-
42
- - https://github.com/Volue/wave-vite-example (Vite template)
43
- - https://github.com/Volue/wave-nextjs-app-router-example (Next.js App Router template)
44
-
45
- ---
46
-
47
- ${await te()}
48
- `}]}}catch(n){return{isError:!0,content:[{type:"text",text:`Failed to retrieve getting started documentation: ${m(n)}`}]}}})}},pe={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 w(),a=_(n);return{content:[{type:"text",text:`The following components are available in the Wave Design System:
49
-
50
- ${Object.entries(a).map(([s,c])=>`## ${s}
51
- ${c.map(l=>`- ${l.name}`).join(`
52
- `)}`).join(`
53
-
54
- `)}
55
-
56
- Use the \`get_component\` tool to get more information about a specific component.
57
-
58
- Use these components from the @volue/wave-react package.`}]}}catch(n){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the component index: ${m(n)}`}]}}})}},de={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:
59
-
60
- ${x().map(i=>`- ${i.name}`).join(`
61
- `)}
62
-
63
- 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: ${m(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 S(),a=_(n);return{content:[{type:"text",text:`The following UX patterns are available in the Wave Design System:
64
-
65
- ${Object.entries(a).map(([s,c])=>`## ${s}
66
- ${c.map(l=>`- ${l.name}`).join(`
67
- `)}`).join(`
68
-
69
- `)}
70
-
71
- 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: ${m(n)}`}]}}})}},ge=[ue,pe,ce,fe,me,se,de,le],R=new Set;async function he(e){await Promise.all(ge.map(async t=>{if(R.has(t.name))return;const o=await t.ctx?.();R.add(t.name),t.exec(e,{name:t.name,description:t.description,ctx:o})}))}r(he,"initializeTools");export{he as i};