@volue/wave-mcp 0.2.0-next.0 → 0.2.0-next.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/dist/app.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import * as hono_types from 'hono/types';
2
+ import { Hono } from 'hono';
3
+
4
+ declare const app: Hono<hono_types.BlankEnv, hono_types.BlankSchema, "/">;
5
+
6
+ export { app as default };
package/dist/app.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{WebStandardStreamableHTTPServerTransport as m}from"@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";import{ErrorCode as s}from"@modelcontextprotocol/sdk/types.js";import{Hono as l}from"hono";import{cors as d}from"hono/cors";import{c as v,p as a}from"./server-HupGZA-D.js";import{p as n,i as h}from"./index-DL4W1Dsp.js";import"@modelcontextprotocol/sdk/server/mcp.js";import"@modelcontextprotocol/sdk/validation/cfworker";import"@volue/design-colors/generic";import"@volue/design-icons";import"@volue/design-media-queries";import"remark-parse";import"unified";import"zod";import"@volue/design-colors/flat";const r=new l,S=n(process.env.CORS_ORIGIN)??"*";r.use("*",d({origin:S}));const i=n(process.env.ALLOWED_HOSTS),p=n(process.env.ALLOWED_ORIGINS);r.post("/mcp",async e=>{try{const o=v();await h(o);const t=new m({sessionIdGenerator:void 0,enableJsonResponse:!0,enableDnsRebindingProtection:!!(i||p),allowedHosts:i,allowedOrigins:p});await o.connect(t);const c=await t.handleRequest(e.req.raw);return await o.close(),c}catch(o){return console.error("Error handling MCP request:",o),e.json({jsonrpc:"2.0",error:{code:s.InternalError,message:"Internal server error"},id:null},500)}}),r.on(["GET","DELETE"],"/mcp",e=>e.json({jsonrpc:"2.0",error:{code:s.ConnectionClosed,message:"Method not allowed"},id:null},405)),r.get("/",e=>e.json({name:"Wave MCP Server",version:a.version,description:a.description,endpoints:{"/":"Server information (this response)","/mcp":"Streamable HTTP endpoint for MCP connection","/health":"Health check endpoint"}})),r.get("/health",e=>e.json({status:"healthy",timestamp:new Date().toISOString()}));export{r as default};
@@ -1,14 +1,14 @@
1
- var U=Object.defineProperty;var a=(e,t)=>U(e,"name",{value:t,configurable:!0});import{b as p,f as g,u as v,g as l}from"./server-BUA33fNW.js";import A from"@volue/design-colors/generic";import*as D from"@volue/design-icons";import*as N from"@volue/design-media-queries";import F from"remark-parse";import j from"unified";import{z as x}from"zod";import{core as O,background as H,foreground as V,border as G,rgb as X,data as q}from"@volue/design-colors/flat";function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},m.apply(null,arguments)}a(m,"_extends");const J="0 1px 2.5px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.08)), 0 3px 9px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.048))",Q="0 0.4px 2.2px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.022)), 0 1.4px 5px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.04)), 0 5px 14px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.06))",Y="0 0.3px 2px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.015)), 0 1.5px 8px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.024)), 0 4px 16px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.04)), 0 8px 24px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.07))",K="0 0.7px 2px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.015)), 0 1.6px 8px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.024)), 0 3.3px 16px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.034)), 0 5px 26px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.06)), 0 12px 42px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.08))";var Z=Object.freeze({__proto__:null,elevationL:K,elevationM:Y,elevationS:Q,elevationXs:J}),f={base:{2:"0.125rem",4:"0.25rem",6:"0.375rem",8:"0.5rem",12:"0.75rem",14:"0.875rem",16:"1rem",20:"1.25rem",24:"1.5rem",28:"1.75rem",32:"2rem",36:"2.25rem",40:"2.5rem",44:"2.75rem",48:"3rem",64:"4rem",72:"4.5rem",80:"5rem",96:"6rem",112:"7rem",128:"8rem"},borderRadius:{xs:"0.25rem",s:"0.375rem",m:"0.5rem",l:"0.75rem",xl:"1rem",full:"100vh"},spacing:{xs:"0.25rem",s:"0.5rem",m:"1rem",l:"1.5rem",xl:"2rem",xxl:"3rem",xxxl:"4.5rem"}},h={font:{family:{base:"'IBM Plex Sans', 'IBM Plex Sans Fallback: -apple-system', 'IBM Plex Sans Fallback: Segoe UI', 'IBM Plex Sans Fallback: Roboto', 'IBM Plex Sans Fallback: Arial', 'IBM Plex Sans Fallback: Noto Sans', -apple-system, 'Segoe UI', Roboto, Arial, 'Noto Sans', sans-serif",display:"'IBM Plex Sans', 'IBM Plex Sans Fallback: -apple-system', 'IBM Plex Sans Fallback: Segoe UI', 'IBM Plex Sans Fallback: Roboto', 'IBM Plex Sans Fallback: Arial', 'IBM Plex Sans Fallback: Noto Sans', -apple-system, 'Segoe UI', Roboto, Arial, 'Noto Sans', sans-serif",mono:"ui-monospace, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace"},weight:{normal:"400",semibold:"600"}},size:{font:{base:"16px",eta:"12px",zeta:"14px",epsilon:"16px",delta:"19px",gamma:"21px",beta:"28px",alpha:"38px",giga:"51px"},letterSpacing:{tighter:"-0.05em",tight:"-0.025em",normal:"normal",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeight:{none:"1",body:"1.5",base:"1.5rem",small:"1.25rem",xSmall:"1.125rem",zeta:"1.714286",epsilon:"1.5",delta:"1.263158",gamma:"1.52381",beta:"1.714286",alpha:"1.263158",giga:"1.411765"}}};function ee(e){return e.charAt(0).toUpperCase()+e.slice(1)}a(ee,"capitalizeFirstLetter");var B=Object.keys(f.spacing).reduce(function(e,t){var n;return m({},e,(n={},n["spacing"+ee(t)]=f.spacing[t],n))},{}),I={colors:m({},O,H,V,G,X,q),space:B,zIndices:{auto:"auto",0:"0",1:"100",2:"200",3:"300",4:"400",5:"500",9:"900"},fonts:h.font.family,fontWeights:h.font.weight,fontSizes:h.size.font,lineHeights:h.size.lineHeight,letterSpacings:h.size.letterSpacing,sizes:m({},f.base,{measureNarrow:"30ch",measureMedium:"60ch",measureWide:"90ch",containerNarrow:"32rem",containerMedium:"48rem",containerWide:"74rem"}),radii:m({},f.borderRadius,B),shadows:m({},Z,{lift:"0 10px 20px -5px rgba(0, 0, 0, 0.15)"})};const te=j().use(F),R={Components:"component","UX patterns":"pattern"};function ne(e,t){const n=te.parse(e),o=new URL(`${t}/`);let r=null;return n.children.reduce((s,i)=>{if(p(i,"heading")&&i.depth===2)return r=oe(i),s;if(!r||!p(i,"list"))return s;const c=r,d=i.children.map(u=>re(u,c,o)).filter(u=>u!==null);return s.concat(d)},[])}a(ne,"parseLlmsIndex");function oe(e){const[t]=e.children;if(!t||!p(t,"text"))return null;const n=t.value.trim();if(!(n in R))return null;const o=R[n];return{title:n,type:o}}a(oe,"extractSectionContext");function re(e,t,n){const[o]=e.children;if(!o||!p(o,"paragraph")||o.children.length!==2)return null;const[r,s]=o.children;if(!p(r,"link")||!p(s,"text")||r.children.length!==1)return null;const i=r.children[0];if(!p(i,"text"))return null;const c=i.value.trim(),d=new URL(r.url,n);if(d.origin!==n.origin)return console.warn(`Skipping llms.txt entry "${c}": ${r.url} is outside ${n.origin}`),null;const u=d.toString(),C=d.pathname.replace(/^\//,""),P=ae(C),W=se(t.title,C,t.type),z=ce(s.value);return{name:c,slug:P,category:W,section:t.title,type:t.type,url:u,description:z??void 0}}a(re,"listItemToResource");function ae(e){return e.replace(/\.md$/,"").split("/").pop()??""}a(ae,"deriveSlug");function se(e,t,n){const o=t.replace(/\.md$/,"").split("/");if(n==="component"||n==="pattern"){const r=o.length>=3?o[o.length-2]:null;return r?`${e} / ${ie(r)}`:e}return e}a(se,"deriveCategory");function ie(e){return e.split("-").filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}a(ie,"formatSegment");function ce(e){if(!e)return null;const t=e.replace(/^\s*:\s*/,"").trim();return t.toLowerCase()==="no description available"?null:t}a(ce,"normalizeDescription");const b=process.env.USE_STABLE_DOCS==="true"||process.env.USE_STABLE_DOCS==="1"?"https://wave.volue.com":"https://next.wave-design-system.pages.dev",le=`${b}/llms.txt`,de=1e3*60*15,pe=process.env.WAVE_RESOURCES_CACHE_TIME?Number.parseInt(process.env.WAVE_RESOURCES_CACHE_TIME,10):de;function S(e){const t=new URL(e,b);return t.pathname.endsWith(".md")||(t.pathname+=".md"),t.toString()}a(S,"createUrl");let w=null,E=0;async function me(){if(w!==null&&Date.now()<E)return w;const e=await ue();return w=e,E=Date.now()+pe,e}a(me,"listCachedResources");let y=null;async function ue(){return y||(y=ge().finally(()=>{y=null})),y}a(ue,"idempotentLoadResourcesFromLlms");async function ge(){const e=await g(le,void 0,"fetch llms.txt");return ne(e,b)}a(ge,"loadResourcesFromLlms");async function he(e){return g(e.url,void 0,`fetch ${e.name} documentation`)}a(he,"fetchComponent");function fe(e){return g(e.url,void 0,`fetch ${e.name} pattern`)}a(fe,"fetchPattern");async function ye(){return g(S("get-started/developing"),void 0,"fetch developing guide")}a(ye,"fetchDevelopingGuide");async function ve(){return g(S("tokens/colors"),void 0,"fetch color usage guidelines")}a(ve,"fetchColorUsageGuidelines");function k(){return Object.entries(D).map(([e,t])=>({name:e,svg:t}))}a(k,"listIcons");function xe(){const e=k();return v(e.map(t=>t.name))}a(xe,"getIconNames");function be(e,t){const n=t.trim().toLowerCase();return e.find(o=>o.name.toLowerCase()===n)}a(be,"findIconByName");async function M(e){return(await me()).filter(n=>n.type===e)}a(M,"listResourcesByType");function L(e,t){const n=t.trim().toLowerCase();return e.find(o=>o.name.toLowerCase()===n)}a(L,"findResourceByName");function T(){return M("component")}a(T,"listComponents");async function Se(){const e=await T();return v(e.map(t=>t.name))}a(Se,"getComponentNames");function $(){return M("pattern")}a($,"listPatterns");async function we(){const e=await $();return v(e.map(t=>t.name))}a(we,"getPatternNames");function _(e){return e.reduce((t,n)=>(t[n.category]||(t[n.category]=[]),t[n.category].push(n),t),{})}a(_,"groupResourcesByCategory");const ke={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:n}){e.registerTool(t,{description:n},async()=>{try{const o=await ve();return{content:[{type:"text",text:JSON.stringify(A)},{type:"text",text:`Here are the Wave Design System color usage guidelines:
1
+ var A=Object.defineProperty;var i=(e,t)=>A(e,"name",{value:t,configurable:!0});import N from"@volue/design-colors/generic";import*as D from"@volue/design-icons";import*as F from"@volue/design-media-queries";import j from"remark-parse";import O from"unified";import{z as y}from"zod";import{core as H,background as V,foreground as G,border as X,rgb as q,data as J}from"@volue/design-colors/flat";const $=1e4;async function C(e,t,n){const o=n??`fetch ${e}`,r=AbortSignal.timeout($);try{const a=await fetch(e,{signal:r,...t});if(!a.ok)throw new Error(`Failed to ${o}: ${a.status} ${a.statusText}`);return await a.text()}catch(a){throw r.aborted?new Error(`Failed to ${o}: timed out after ${$}ms`):a}}i(C,"fetchMarkdown");function B(e,t){const n=new Map,o=new Map;return async r=>{const a=n.get(r);if(a&&Date.now()<a.expiresAt)return a.value;let s=o.get(r);return s||(s=t(r).then(c=>(n.set(r,{value:c,expiresAt:Date.now()+e}),c)).finally(()=>o.delete(r)),o.set(r,s)),s}}i(B,"createTtlCache");function d(e,t){return e.type===t}i(d,"isNodeType");function v(e){return Array.from(new Set(e))}i(v,"uniq");function p(e){return e instanceof Error?e.message:"Unknown error"}i(p,"getErrorMessage");function Q(e){const t=e?.split(",").map(n=>n.trim()).filter(Boolean);return t?.length?t:void 0}i(Q,"parseCsvEnv");function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},m.apply(null,arguments)}i(m,"_extends");const Y="0 1px 2.5px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.08)), 0 3px 9px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.048))",K="0 0.4px 2.2px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.022)), 0 1.4px 5px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.04)), 0 5px 14px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.06))",Z="0 0.3px 2px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.015)), 0 1.5px 8px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.024)), 0 4px 16px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.04)), 0 8px 24px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.07))",ee="0 0.7px 2px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.015)), 0 1.6px 8px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.024)), 0 3.3px 16px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.034)), 0 5px 26px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.06)), 0 12px 42px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.08))";var te=Object.freeze({__proto__:null,elevationL:ee,elevationM:Z,elevationS:K,elevationXs:Y}),h={base:{2:"0.125rem",4:"0.25rem",6:"0.375rem",8:"0.5rem",12:"0.75rem",14:"0.875rem",16:"1rem",20:"1.25rem",24:"1.5rem",28:"1.75rem",32:"2rem",36:"2.25rem",40:"2.5rem",44:"2.75rem",48:"3rem",64:"4rem",72:"4.5rem",80:"5rem",96:"6rem",112:"7rem",128:"8rem"},borderRadius:{xs:"0.25rem",s:"0.375rem",m:"0.5rem",l:"0.75rem",xl:"1rem",full:"100vh"},spacing:{xs:"0.25rem",s:"0.5rem",m:"1rem",l:"1.5rem",xl:"2rem",xxl:"3rem",xxxl:"4.5rem"}},u={font:{family:{base:"'IBM Plex Sans', 'IBM Plex Sans Fallback: -apple-system', 'IBM Plex Sans Fallback: Segoe UI', 'IBM Plex Sans Fallback: Roboto', 'IBM Plex Sans Fallback: Arial', 'IBM Plex Sans Fallback: Noto Sans', -apple-system, 'Segoe UI', Roboto, Arial, 'Noto Sans', sans-serif",display:"'IBM Plex Sans', 'IBM Plex Sans Fallback: -apple-system', 'IBM Plex Sans Fallback: Segoe UI', 'IBM Plex Sans Fallback: Roboto', 'IBM Plex Sans Fallback: Arial', 'IBM Plex Sans Fallback: Noto Sans', -apple-system, 'Segoe UI', Roboto, Arial, 'Noto Sans', sans-serif",mono:"ui-monospace, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace"},weight:{normal:"400",semibold:"600"}},size:{font:{base:"16px",eta:"12px",zeta:"14px",epsilon:"16px",delta:"19px",gamma:"21px",beta:"28px",alpha:"38px",giga:"51px"},letterSpacing:{tighter:"-0.05em",tight:"-0.025em",normal:"normal",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeight:{none:"1",body:"1.5",base:"1.5rem",small:"1.25rem",xSmall:"1.125rem",zeta:"1.714286",epsilon:"1.5",delta:"1.263158",gamma:"1.52381",beta:"1.714286",alpha:"1.263158",giga:"1.411765"}}};function ne(e){return e.charAt(0).toUpperCase()+e.slice(1)}i(ne,"capitalizeFirstLetter");var I=Object.keys(h.spacing).reduce(function(e,t){var n;return m({},e,(n={},n["spacing"+ne(t)]=h.spacing[t],n))},{}),E={colors:m({},H,V,G,X,q,J),space:I,zIndices:{auto:"auto",0:"0",1:"100",2:"200",3:"300",4:"400",5:"500",9:"900"},fonts:u.font.family,fontWeights:u.font.weight,fontSizes:u.size.font,lineHeights:u.size.lineHeight,letterSpacings:u.size.letterSpacing,sizes:m({},h.base,{measureNarrow:"30ch",measureMedium:"60ch",measureWide:"90ch",containerNarrow:"32rem",containerMedium:"48rem",containerWide:"74rem"}),radii:m({},h.borderRadius,I),shadows:m({},te,{lift:"0 10px 20px -5px rgba(0, 0, 0, 0.15)"})};const oe=O().use(j),R={Components:"component","UX patterns":"pattern"};function re(e,t){const n=oe.parse(e),o=new URL(`${t}/`);let r=null;return n.children.reduce((a,s)=>{if(d(s,"heading")&&s.depth===2)return r=ae(s),a;if(!r||!d(s,"list"))return a;const c=r,l=s.children.map(g=>se(g,c,o)).filter(g=>g!==null);return a.concat(l)},[])}i(re,"parseLlmsIndex");function ae(e){const[t]=e.children;if(!t||!d(t,"text"))return null;const n=t.value.trim();if(!(n in R))return null;const o=R[n];return{title:n,type:o}}i(ae,"extractSectionContext");function se(e,t,n){const[o]=e.children;if(!o||!d(o,"paragraph")||o.children.length!==2)return null;const[r,a]=o.children;if(!d(r,"link")||!d(a,"text")||r.children.length!==1)return null;const s=r.children[0];if(!d(s,"text"))return null;const c=s.value.trim(),l=new URL(r.url,n);if(l.origin!==n.origin)return console.warn(`Skipping llms.txt entry "${c}": ${r.url} is outside ${n.origin}`),null;const g=l.toString(),T=l.pathname.replace(/^\//,""),P=ie(T),W=ce(t.title,T,t.type),z=pe(a.value);return{name:c,slug:P,category:W,section:t.title,type:t.type,url:g,description:z??void 0}}i(se,"listItemToResource");function ie(e){return e.replace(/\.md$/,"").split("/").pop()??""}i(ie,"deriveSlug");function ce(e,t,n){const o=t.replace(/\.md$/,"").split("/");if(n==="component"||n==="pattern"){const r=o.length>=3?o[o.length-2]:null;return r?`${e} / ${le(r)}`:e}return e}i(ce,"deriveCategory");function le(e){return e.split("-").filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}i(le,"formatSegment");function pe(e){if(!e)return null;const t=e.replace(/^\s*:\s*/,"").trim();return t.toLowerCase()==="no description available"?null:t}i(pe,"normalizeDescription");const x=process.env.USE_STABLE_DOCS==="true"||process.env.USE_STABLE_DOCS==="1"?"https://wave.volue.com":"https://next.wave-design-system.pages.dev",de=`${x}/llms.txt`,me=1e3*60*15,M=process.env.WAVE_RESOURCES_CACHE_TIME?Number.parseInt(process.env.WAVE_RESOURCES_CACHE_TIME,10):me;function b(e){const t=new URL(e,x);return t.pathname.endsWith(".md")||(t.pathname+=".md"),t.toString()}i(b,"createUrl");const ge=B(M,async e=>{const t=await C(e,void 0,"fetch llms.txt");return re(t,x)}),f=B(M,e=>C(e));function ue(e){return f(e.url)}i(ue,"fetchComponent");function he(e){return f(e.url)}i(he,"fetchPattern");function fe(){return f(b("get-started/developing"))}i(fe,"fetchDevelopingGuide");function ye(){return f(b("tokens/colors"))}i(ye,"fetchColorUsageGuidelines");function S(){return Object.entries(D).map(([e,t])=>({name:e,svg:t}))}i(S,"listIcons");function ve(){const e=S();return v(e.map(t=>t.name))}i(ve,"getIconNames");function xe(e,t){const n=t.trim().toLowerCase();return e.find(o=>o.name.toLowerCase()===n)}i(xe,"findIconByName");async function _(e){return(await ge(de)).filter(n=>n.type===e)}i(_,"listResourcesByType");function U(e,t){const n=t.trim().toLowerCase();return e.find(o=>o.name.toLowerCase()===n)}i(U,"findResourceByName");function w(){return _("component")}i(w,"listComponents");async function be(){const e=await w();return v(e.map(t=>t.name))}i(be,"getComponentNames");function k(){return _("pattern")}i(k,"listPatterns");async function Se(){const e=await k();return v(e.map(t=>t.name))}i(Se,"getPatternNames");function L(e){return e.reduce((t,n)=>(t[n.category]||(t[n.category]=[]),t[n.category].push(n),t),{})}i(L,"groupResourcesByCategory");const we={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:n}){e.registerTool(t,{description:n},async()=>{try{const o=await ye();return{content:[{type:"text",text:JSON.stringify(N)},{type:"text",text:`Here are the Wave Design System color usage guidelines:
2
2
 
3
3
  ${o}
4
4
 
5
5
  ---
6
- Source: ${S("tokens/colors")}`}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve color usage guidelines: ${l(o)}`}]}}})}},Te={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{const e=await Se();if(e.length===0)throw new Error("llms.txt index contains no components");return{componentNames:e}}catch(e){throw new Error(`Failed to initialize component tool: ${l(e)}`)}},exec(e,{ctx:t,name:n,description:o}){e.registerTool(n,{description:o,inputSchema:{name:x.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 s=await T(),i=L(s,r);if(!i)throw new Error("Component not found");const c=await he(i);return c?{content:[{type:"text",text:`Here is the documentation for the \`${i.name}\` component from the Wave Design System:
6
+ Source: ${b("tokens/colors")}`}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve color usage guidelines: ${p(o)}`}]}}})}},ke={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{const e=await be();if(e.length===0)throw new Error("llms.txt index contains no components");return{componentNames:e}}catch(e){throw new Error(`Failed to initialize component tool: ${p(e)}`)}},exec(e,{ctx:t,name:n,description:o}){e.registerTool(n,{description:o,inputSchema:{name:y.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 a=await w(),s=U(a,r);if(!s)throw new Error("Component not found");const c=await ue(s);return c?{content:[{type:"text",text:`Here is the documentation for the \`${s.name}\` component from the Wave Design System:
7
7
 
8
8
  ${c}
9
9
 
10
10
  ---
11
- Source: ${i.url}`}]}:{content:[{type:"text",text:`No documentation content found for the \`${i.name}\` component.`}]}}catch(s){return{isError:!0,content:[{type:"text",text:`Failed to retrieve documentation for \`${r}\`: ${l(s)}`}]}}})}},$e={name:"get_icon",description:"Retrieve a specific icon information by name from Wave Design System.",exec(e,{name:t,description:n}){e.registerTool(t,{description:n,inputSchema:{name:x.enum(xe()).describe("The icon name to retrieve. This can be derived from calling the `list_icon` tool.")}},async({name:o})=>{try{const r=k(),s=be(r,o);if(!s)throw new Error("Icon not found.");const i=`<SvgIcon iconName="${s.name}" />`,c=`<div class="svgIcon svgIcon--stroked">
11
+ Source: ${s.url}`}]}:{content:[{type:"text",text:`No documentation content found for the \`${s.name}\` component.`}]}}catch(a){return{isError:!0,content:[{type:"text",text:`Failed to retrieve documentation for \`${r}\`: ${p(a)}`}]}}})}},Te={name:"get_icon",description:"Retrieve a specific icon information by name from Wave Design System.",ctx(){return{iconNames:ve()}},exec(e,{ctx:t,name:n,description:o}){e.registerTool(n,{description:o,inputSchema:{name:y.enum(t.iconNames).describe("The icon name to retrieve. This can be derived from calling the `list_icon` tool.")}},async({name:r})=>{try{const a=S(),s=xe(a,r);if(!s)throw new Error("Icon not found.");const c=`<SvgIcon iconName="${s.name}" />`,l=`<div class="svgIcon svgIcon--stroked">
12
12
  <svg focusable="false" aria-hidden="true">
13
13
  <use xlink:href="#svg--${s.name}"></use>
14
14
  </svg>
@@ -17,25 +17,25 @@ Source: ${i.url}`}]}:{content:[{type:"text",text:`No documentation content found
17
17
  ## React component:
18
18
 
19
19
  \`\`\`tsx
20
- ${i}
20
+ ${c}
21
21
  \`\`\`
22
22
 
23
23
  ## HTML markup:
24
24
 
25
25
  \`\`\`html
26
- ${c}
26
+ ${l}
27
27
  \`\`\`
28
28
 
29
29
  ## Raw SVG code:
30
30
 
31
31
  \`\`\`svg
32
32
  ${s.svg}
33
- \`\`\``}]}}catch(r){return{isError:!0,content:[{type:"text",text:`Failed to retrieve icon \`${o}\`: ${l(r)}`}]}}})}},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{const e=await we();if(e.length===0)throw new Error("llms.txt index contains no patterns");return{patternNames:e}}catch(e){throw new Error(`Failed to initialize pattern tool: ${l(e)}`)}},exec(e,{ctx:t,name:n,description:o}){e.registerTool(n,{description:o,inputSchema:{name:x.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 s=await $(),i=L(s,r);if(!i)throw new Error("Pattern not found");const c=await fe(i);return{content:[{type:"text",text:`Here are the guidelines for the \`${i.name}\` UX pattern from the Wave Design System:
33
+ \`\`\``}]}}catch(a){return{isError:!0,content:[{type:"text",text:`Failed to retrieve icon \`${r}\`: ${p(a)}`}]}}})}},$e={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{const e=await Se();if(e.length===0)throw new Error("llms.txt index contains no patterns");return{patternNames:e}}catch(e){throw new Error(`Failed to initialize pattern tool: ${p(e)}`)}},exec(e,{ctx:t,name:n,description:o}){e.registerTool(n,{description:o,inputSchema:{name:y.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 a=await k(),s=U(a,r);if(!s)throw new Error("Pattern not found");const c=await he(s);return{content:[{type:"text",text:`Here are the guidelines for the \`${s.name}\` UX pattern from the Wave Design System:
34
34
 
35
35
  ${c}
36
36
 
37
37
  ---
38
- Source: ${i.url}`}]}}catch(s){return{isError:!0,content:[{type:"text",text:`Failed to retrieve documentation for \`${r}\`: ${l(s)}`}]}}})}},Be={name:"get_styling_guidelines",description:"Retrieve guidelines for styling Wave Design System components and creating custom styled components.",exec(e,{name:t,description:n}){e.registerTool(t,{description:n},async()=>({content:[{type:"text",text:`Wave Design System components can be styled using standard React approaches (className, style prop), 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.
38
+ Source: ${s.url}`}]}}catch(a){return{isError:!0,content:[{type:"text",text:`Failed to retrieve documentation for \`${r}\`: ${p(a)}`}]}}})}},Ce={name:"get_styling_guidelines",description:"Retrieve guidelines for styling Wave Design System components and creating custom styled components.",exec(e,{name:t,description:n}){e.registerTool(t,{description:n},async()=>({content:[{type:"text",text:`Wave Design System components can be styled using standard React approaches (className, style prop), 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
39
 
40
40
  ## Styling APIs
41
41
 
@@ -117,7 +117,7 @@ Wave provides a comprehensive set of design tokens for colors, spacing, typograp
117
117
 
118
118
  Wave provides media query tokens for responsive design. Use these tokens to create breakpoint-based styles:
119
119
 
120
- ${Object.entries(N).map(([r,s])=>`- \`@${r}\`: ${s}`).join(`
120
+ ${Object.entries(F).map(([r,a])=>`- \`@${r}\`: ${a}`).join(`
121
121
  `)}
122
122
 
123
123
  ### Responsive styling examples
@@ -190,11 +190,11 @@ const Button = styled('button', {
190
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
191
  2. **Choose the right API**: Use \`css\` prop for one-off styles, \`styled()\` for reusable components
192
192
  3. **Semantic breakpoints**: Use Wave's semantic media query tokens rather than arbitrary pixel values
193
- `}]}))}},Ie={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"]},Re={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:n}){e.registerTool(t,{description:n},async()=>{const o=Object.entries(Ie).map(([r,s])=>`| ${r} | ${s.join(", ")} |`).join(`
193
+ `}]}))}},Be={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"]},Ie={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:n}){e.registerTool(t,{description:n},async()=>{const o=Object.entries(Be).map(([r,a])=>`| ${r} | ${a.join(", ")} |`).join(`
194
194
  `);return{content:[{type:"text",text:`Below is a list of design tokens available from Wave Design System.
195
- There are ${Object.keys(I).length} token types available:
195
+ There are ${Object.keys(E).length} token types available:
196
196
 
197
- ${JSON.stringify(I)}`},{type:"text",text:`## Token Type to CSS Property Mapping
197
+ ${JSON.stringify(E)}`},{type:"text",text:`## Token Type to CSS Property Mapping
198
198
 
199
199
  Token types are automatically mapped to CSS Properties:
200
200
 
@@ -265,28 +265,28 @@ It's **important** that if the project is using a tool like Vite or Next.js, one
265
265
 
266
266
  ---
267
267
 
268
- ${await ye()}
269
- `}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve getting started documentation: ${l(o)}`}]}}})}},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:n}){e.registerTool(t,{description:n},async()=>{try{const o=await T(),r=_(o);return{content:[{type:"text",text:`The following components are available in the Wave Design System:
268
+ ${await fe()}
269
+ `}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve getting started documentation: ${p(o)}`}]}}})}},Re={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:n}){e.registerTool(t,{description:n},async()=>{try{const o=await w(),r=L(o);return{content:[{type:"text",text:`The following components are available in the Wave Design System:
270
270
 
271
- ${Object.entries(r).map(([i,c])=>`## ${i}
272
- ${c.map(d=>`- ${d.name}`).join(`
271
+ ${Object.entries(r).map(([s,c])=>`## ${s}
272
+ ${c.map(l=>`- ${l.name}`).join(`
273
273
  `)}`).join(`
274
274
 
275
275
  `)}
276
276
 
277
277
  Use the \`get_component\` tool to get more information about a specific component.
278
278
 
279
- Use these components from the \`@volue/wave-react\` package.`}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the component index: ${l(o)}`}]}}})}},Le={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:n}){e.registerTool(t,{description:n},async()=>{try{return{content:[{type:"text",text:`The following icons are available in the Wave Design System:
279
+ Use these components from the \`@volue/wave-react\` package.`}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the component index: ${p(o)}`}]}}})}},Me={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:n}){e.registerTool(t,{description:n},async()=>{try{return{content:[{type:"text",text:`The following icons are available in the Wave Design System:
280
280
 
281
- ${k().map(s=>`- ${s.name}`).join(`
281
+ ${S().map(a=>`- ${a.name}`).join(`
282
282
  `)}
283
283
 
284
- Use the \`get_icon\` tool to retrieve the SVG markup and usage guidelines for a specific icon.`}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the icon data: ${l(o)}`}]}}})}},_e={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:n}){e.registerTool(t,{description:n},async()=>{try{const o=await $(),r=_(o);return{content:[{type:"text",text:`The following UX patterns are available in the Wave Design System:
284
+ Use the \`get_icon\` tool to retrieve the SVG markup and usage guidelines for a specific icon.`}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the icon data: ${p(o)}`}]}}})}},_e={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:n}){e.registerTool(t,{description:n},async()=>{try{const o=await k(),r=L(o);return{content:[{type:"text",text:`The following UX patterns are available in the Wave Design System:
285
285
 
286
- ${Object.entries(r).map(([i,c])=>`## ${i}
287
- ${c.map(d=>`- ${d.name}`).join(`
286
+ ${Object.entries(r).map(([s,c])=>`## ${s}
287
+ ${c.map(l=>`- ${l.name}`).join(`
288
288
  `)}`).join(`
289
289
 
290
290
  `)}
291
291
 
292
- Use the \`get_pattern\` tool to access detailed guidance for a specific pattern.`}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the pattern index: ${l(o)}`}]}}})}},Pe=[Ee,Me,Te,_e,Ce,ke,Le,$e,Re,Be];async function We(e){await Promise.all(Pe.map(async t=>{let n;try{n=await t.ctx?.()}catch(o){console.error(`Skipping tool "${t.name}":`,o);return}t.exec(e,{name:t.name,description:t.description,ctx:n})}))}a(We,"initializeTools");export{We as i};
292
+ Use the \`get_pattern\` tool to access detailed guidance for a specific pattern.`}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the pattern index: ${p(o)}`}]}}})}},Ue=[Ee,Re,ke,_e,$e,we,Me,Te,Ie,Ce];async function Le(e){await Promise.all(Ue.map(async t=>{let n;try{n=await t.ctx?.()}catch(o){console.error(`Skipping tool "${t.name}":`,o);return}t.exec(e,{name:t.name,description:t.description,ctx:n})}))}i(Le,"initializeTools");export{Le as i,Q as p};
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- var a=Object.defineProperty;var o=(t,r)=>a(t,"name",{value:r,configurable:!0});import{i}from"./server-BUA33fNW.js";import{c as g}from"./server-BUA33fNW.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(e){console.error("Error running transport:",e),process.exit(1)}}o(s,"run"),s()}export{g as createServer};
2
+ var a=Object.defineProperty;var s=(o,r)=>a(o,"name",{value:r,configurable:!0});import{i}from"./isEntryFile-gJoj6hFD.js";import{c as g}from"./server-HupGZA-D.js";import"node:fs";import"node:url";import"@modelcontextprotocol/sdk/server/mcp.js";import"@modelcontextprotocol/sdk/validation/cfworker";if(i(import.meta.url)){const r=process.argv.slice(2)[0]||"stdio";async function e(){try{switch(r){case"stdio":await import("./transports/stdio.js");break;case"http":{const{startServer:t}=await import("./transports/http.js");t();break}default:console.error(`Unknown transport: ${r}`),console.error("Available transports: stdio, http"),process.exit(1)}}catch(t){console.error("Error running transport:",t),process.exit(1)}}s(e,"run"),e()}export{g as createServer};
@@ -0,0 +1 @@
1
+ var o=Object.defineProperty;var e=(r,t)=>o(r,"name",{value:t,configurable:!0});import{realpathSync as s}from"node:fs";import{pathToFileURL as i}from"node:url";function n(r){if(!process.argv[1])return!1;const t=s(process.argv[1]),a=i(t);return r===a.href}e(n,"isEntryFile");export{n as i};
@@ -0,0 +1 @@
1
+ var t=Object.defineProperty;var e=(o,n)=>t(o,"name",{value:n,configurable:!0});import{McpServer as a}from"@modelcontextprotocol/sdk/server/mcp.js";import{CfWorkerJsonSchemaValidator as s}from"@modelcontextprotocol/sdk/validation/cfworker";var i="0.2.0-next.2",c="An MCP server that connects AI tools to the Wave Design System",r={version:i,description:c};function v(){return new a({name:"Wave Design System",version:r.version},{capabilities:{tools:{}},jsonSchemaValidator:new s})}e(v,"createServer");export{v as c,r as p};
@@ -1,5 +1,3 @@
1
- import * as express_serve_static_core from 'express-serve-static-core';
1
+ declare function startServer(): void;
2
2
 
3
- declare const app: express_serve_static_core.Express;
4
-
5
- export { app as default };
3
+ export { startServer };
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- var g=Object.defineProperty;var n=(o,e)=>g(o,"name",{value:e,configurable:!0});import{StreamableHTTPServerTransport as h}from"@modelcontextprotocol/sdk/server/streamableHttp.js";import S from"cors";import p from"express";import{p as i,c as f,a as w,i as O}from"../server-BUA33fNW.js";import{i as T}from"../index-YvazYQ9b.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"remark-parse";import"unified";import"zod";import"@volue/design-colors/flat";const r=p(),P=i(process.env.CORS_ORIGIN)??"*";r.use(S({origin:P})),r.use(p.json());const l=i(process.env.ALLOWED_HOSTS),m=i(process.env.ALLOWED_ORIGINS);r.post("/mcp",async(o,e)=>{try{const s=f();await T(s);const t=new h({sessionIdGenerator:void 0,enableDnsRebindingProtection:!!(l||m),allowedHosts:l,allowedOrigins:m});e.on("close",()=>{t.close(),s.close()}),await s.connect(t),await t.handleRequest(o,e,o.body)}catch(s){console.error("Error handling MCP request:",s),e.headersSent||e.status(500).json({jsonrpc:"2.0",error:{code:-32603,message:"Internal server error"},id:null})}});const v=n((o,e)=>{e.status(405).json({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed"},id:null})},"methodNotAllowed");r.get("/mcp",v),r.delete("/mcp",v),r.get("/",(o,e)=>{e.json({name:"Wave MCP Server",version:w.version,description:"MCP server for Wave Design System",endpoints:{"/":"Server information (this response)","/mcp":"Streamable HTTP endpoint for MCP connection","/health":"Health check endpoint"}})}),r.get("/health",(o,e)=>{e.json({status:"healthy",timestamp:new Date().toISOString(),uptime:process.uptime()})});const a=process.env.HOST??"localhost",c=process.env.PORT?Number(process.env.PORT):3e3;let u=null;(process.argv.includes("--auto-run")||O(import.meta.url))&&(u=r.listen(c,a,o=>{o&&(console.error("\u274C Failed to start server:",o),process.exit(1)),console.log(`\u{1F680} Wave MCP Server running on http://${a}:${c}`),console.log(`\u{1F517} Connect via http://${a}:${c}/mcp`)}));const d=n(async()=>{const o=u;o&&await new Promise(e=>o.close(()=>e())),console.log("\u{1F44B} Server shut down gracefully"),process.exit(0)},"cleanup");process.on("SIGTERM",d),process.on("SIGINT",d);export{r as default};
2
+ var m=Object.defineProperty;var e=(o,r)=>m(o,"name",{value:r,configurable:!0});import{serve as n}from"@hono/node-server";import c from"../app.js";import{i as l}from"../isEntryFile-gJoj6hFD.js";import"@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";import"@modelcontextprotocol/sdk/types.js";import"hono";import"hono/cors";import"../server-HupGZA-D.js";import"@modelcontextprotocol/sdk/server/mcp.js";import"@modelcontextprotocol/sdk/validation/cfworker";import"../index-DL4W1Dsp.js";import"@volue/design-colors/generic";import"@volue/design-icons";import"@volue/design-media-queries";import"remark-parse";import"unified";import"zod";import"@volue/design-colors/flat";import"node:fs";import"node:url";function i(){const o=process.env.HOST??"localhost",r=process.env.PORT?Number(process.env.PORT):3e3,p=n({fetch:c.fetch,hostname:o,port:r},()=>{console.log(`\u{1F680} Wave MCP Server running on http://${o}:${r}`),console.log(`\u{1F517} Connect via http://${o}:${r}/mcp`)});p.on("error",t=>{console.error("\u274C Failed to start server:",t),process.exit(1)});const s=e(async()=>{await new Promise(t=>p.close(()=>t())),console.log("\u{1F44B} Server shut down gracefully"),process.exit(0)},"cleanup");process.on("SIGTERM",s),process.on("SIGINT",s)}e(i,"startServer"),l(import.meta.url)&&i();export{i as startServer};
@@ -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{StdioServerTransport as s}from"@modelcontextprotocol/sdk/server/stdio.js";import{c as p}from"../server-BUA33fNW.js";import{i as a}from"../index-YvazYQ9b.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"remark-parse";import"unified";import"zod";import"@volue/design-colors/flat";async function c(){const o=p();await a(o);const r=new s;await o.connect(r);const i=t(async()=>{await r.close(),process.exit(0)},"cleanup");process.on("SIGTERM",i),process.on("SIGINT",i)}t(c,"main"),c().catch(o=>{console.error("\u274C Failed to start server:",o),process.exit(1)});
2
+ var e=Object.defineProperty;var t=(o,r)=>e(o,"name",{value:r,configurable:!0});import{StdioServerTransport as s}from"@modelcontextprotocol/sdk/server/stdio.js";import{c as a}from"../server-HupGZA-D.js";import{i as c}from"../index-DL4W1Dsp.js";import"@modelcontextprotocol/sdk/server/mcp.js";import"@modelcontextprotocol/sdk/validation/cfworker";import"@volue/design-colors/generic";import"@volue/design-icons";import"@volue/design-media-queries";import"remark-parse";import"unified";import"zod";import"@volue/design-colors/flat";async function p(){const o=a();await c(o);const r=new s;await o.connect(r);const i=t(async()=>{await r.close(),process.exit(0)},"cleanup");process.on("SIGTERM",i),process.on("SIGINT",i)}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.2.0-next.0",
3
+ "version": "0.2.0-next.2",
4
4
  "description": "An MCP server that connects AI tools to the Wave Design System",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -21,6 +21,10 @@
21
21
  "types": "./dist/index.d.ts",
22
22
  "default": "./dist/index.js"
23
23
  },
24
+ "./app": {
25
+ "types": "./dist/app.d.ts",
26
+ "default": "./dist/app.js"
27
+ },
24
28
  "./transports/stdio": {
25
29
  "types": "./dist/transports/stdio.d.ts",
26
30
  "default": "./dist/transports/stdio.js"
@@ -47,35 +51,34 @@
47
51
  "start": "yarn run build && yarn node dist/transports/http.js",
48
52
  "dev": "tsx watch --clear-screen=false src/transports/http.ts",
49
53
  "prepack": "yarn run build",
54
+ "deploy:next": "yarn dlx -q wrangler@4 deploy --env next",
55
+ "deploy:production": "yarn dlx -q wrangler@4 deploy --env production",
50
56
  "inspect": "yarn run build && yarn dlx -q @modelcontextprotocol/inspector --transport=stdio node dist/transports/stdio.js",
51
57
  "inspect:http": "yarn dlx -q @modelcontextprotocol/inspector --transport http --server-url http://localhost:3000/mcp"
52
58
  },
53
59
  "dependencies": {
60
+ "@cfworker/json-schema": "4.1.1",
61
+ "@hono/node-server": "2.1.1",
54
62
  "@modelcontextprotocol/sdk": "1.30.0",
55
- "@types/cors": "2.8.19",
56
- "@types/express": "5.0.6",
57
- "@types/express-serve-static-core": "5.1.3",
58
63
  "@types/mdast": "3.0.15",
59
- "@volue/design-colors": "^3.1.2-next.3",
60
- "@volue/design-icons": "^2.0.2-next.3",
61
- "@volue/design-media-queries": "^1.3.24-next.3",
62
- "cors": "2.8.6",
63
- "express": "5.2.1",
64
+ "@volue/design-colors": "^3.1.2-next.4",
65
+ "@volue/design-icons": "^2.0.2-next.4",
66
+ "@volue/design-media-queries": "^1.3.24-next.4",
67
+ "hono": "4.13.2",
64
68
  "remark-parse": "8.0.3",
65
69
  "unified": "9.2.2",
66
- "xtend": "4.0.2",
67
- "zod": "3.25.76"
70
+ "zod": "4.4.3"
68
71
  },
69
72
  "devDependencies": {
70
73
  "@types/node": "22.20.1",
71
74
  "@volue/eslint-config": "1.3.12",
72
- "@volue/wave-react": "2.0.0-next.10",
75
+ "@volue/wave-react": "2.0.0-next.12",
73
76
  "eslint": "9.39.5",
74
77
  "npm-run-all2": "8.0.4",
75
78
  "pkgroll": "2.27.1",
76
79
  "premove": "4.0.0",
77
80
  "prettier": "3.9.6",
78
- "tsx": "4.23.9",
81
+ "tsx": "4.23.12",
79
82
  "typescript": "5.9.3"
80
83
  }
81
84
  }
@@ -1 +0,0 @@
1
- var f=Object.defineProperty;var e=(r,t)=>f(r,"name",{value:t,configurable:!0});import{realpathSync as u}from"node:fs";import{pathToFileURL as p}from"node:url";import{McpServer as l}from"@modelcontextprotocol/sdk/server/mcp.js";const i=1e4;async function m(r,t,o){const a=o??`fetch ${r}`,s=AbortSignal.timeout(i);try{const n=await fetch(r,{signal:s,...t});if(!n.ok)throw new Error(`Failed to ${a}: ${n.status} ${n.statusText}`);return await n.text()}catch(n){throw s.aborted?new Error(`Failed to ${a}: timed out after ${i}ms`):n}}e(m,"fetchMarkdown");function v(r,t){return r.type===t}e(v,"isNodeType");function h(r){return Array.from(new Set(r))}e(h,"uniq");function g(r){return r instanceof Error?r.message:"Unknown error"}e(g,"getErrorMessage");function w(r){const t=r?.split(",").map(o=>o.trim()).filter(Boolean);return t?.length?t:void 0}e(w,"parseCsvEnv");function y(r){if(!process.argv[1])return!1;const t=u(process.argv[1]),o=p(t);return r===o.href}e(y,"isEntryFile");var E="0.2.0-next.0",c={version:E};function d(){return new l({name:"Wave Design System",version:c.version},{capabilities:{tools:{}}})}e(d,"createServer");export{c as a,v as b,d as c,m as f,g,y as i,w as p,h as u};