@progress/kendo-react-mcp 1.5.4 → 1.5.5
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/index.js +54 -54
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{McpServer as pt}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as dt}from"@modelcontextprotocol/sdk/server/stdio.js";import{dirname as Ze,join as et}from"path";import{fileURLToPath as tt}from"url";import{loadLicense as Ve,decodeLicenseKey as je,decodeLicenseEvidence as We}from"@progress/kendo-licensing/utils";var
|
|
3
|
-
`,s
|
|
2
|
+
import{McpServer as pt}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as dt}from"@modelcontextprotocol/sdk/server/stdio.js";import{dirname as Ze,join as et}from"path";import{fileURLToPath as tt}from"url";import{loadLicense as Ve,decodeLicenseKey as je,decodeLicenseEvidence as We}from"@progress/kendo-licensing/utils";var q=class extends Error{constructor(t){super(t),this.name="LicenseError"}};function ee(e){return e.replace(/^\uFEFF/,"")}async function te(){let e=null,t=null;try{let o=Ve();if(!o.success)throw new q(o.message);try{e=(await je(o.value)).licenses.find(async s=>!!(await We(s)).userId)}catch(n){console.log(n.message)}if(!e)return[ee(o.value),null]}catch(o){return t=o.message||"Unknown error loading license.",[null,t]}return[ee(e),null]}import P from"node:fs";import U from"node:path";var B=!1,w=process.env.DEBUG_LOG_FILE,oe=!!(w&&typeof w=="string");if(oe){let e=U.resolve(w),t=U.dirname(e);if(t!=="."&&t!==process.cwd()&&!P.existsSync(t))try{P.mkdirSync(t,{recursive:!0})}catch(o){console.error("Error creating log directory:",o)}if(!P.existsSync(e))try{P.writeFileSync(e,"")}catch(o){console.error("Error creating log file:",o)}}else B=!1;B=oe&&!!w&&P.existsSync(U.resolve(w));function C(...e){if(B&&w){let n=`${new Date().toISOString()}: ${e.join(" ")}
|
|
3
|
+
`,s=U.resolve(w);P.appendFile(s,n,a=>{a&&console.error("Error writing to log file:",a)})}}import Ye from"@grpc/proto-loader";import M from"@grpc/grpc-js";import ie from"path";import ne from"fs";import{fileURLToPath as He}from"url";var ze=He(import.meta.url),Qe=ie.dirname(ze),ae={version:"unknown"},se=ie.resolve(Qe,"../package.json");ne.existsSync(se)&&(ae=JSON.parse(ne.readFileSync(se,"utf-8")));function Je(e){return e.replace(/\u2014/g,"--").replace(/\u2013/g,"-").replace(/[^\x20-\x7E]/g,"")}var G=class{constructor(t,o,n){this.contextApiUrl=t;this.protoPath=o;this.options=n;this.toolNameHeader="assistant";let s=Ye.loadSync(this.protoPath,{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0});this.isDev=this.contextApiUrl?.includes("localhost")||this.contextApiUrl?.includes("127.0.0.1"),C("Using ContextApi URl:",this.contextApiUrl);let a=M.loadPackageDefinition(s);this.client=new a.ContextQueryService(this.contextApiUrl||"contextapi.telerik.com:443",this.isDev?M.credentials.createInsecure():M.credentials.createSsl())}async getMetadata({meta:t}={meta:{}}){let[o,n]=this.isDev?"fake_license":await te(),s=process.env.CONTEXTAPI_API_KEY,a=s&&typeof s=="string",i=o&&typeof o=="string";if(!i&&!a&&n)throw new Error(`Failed to authenticate with API key or License key!
|
|
4
4
|
|
|
5
|
-
License Error: ${n}`);let
|
|
5
|
+
License Error: ${n}`);let r=new M.Metadata;if(i)try{r.add("x-license-key",o)}catch(h){throw C("Error adding license key to metadata:",h),new Error(`Failed to use license key: ${h.message}`)}a&&r.add("x-api-key",s),this.options?.libName&&r.add("x-library-name",this.options.libName),r.add("x-tool-name",this.toolNameHeader);let f=JSON.stringify({...t,source:"npm",version:ae.version,os:process.platform,node_version:process.version});return r.add("x-request-metadata",Je(f)),r}async query(t,o){let n=await this.getMetadata({meta:o});return new Promise((s,a)=>{this.client.query(t,n,(i,r)=>{i?a(new Error(i)):s(r)})})}async getApiRefMatches(t,o){let n=await this.getMetadata({meta:o});return new Promise((s,a)=>{this.client.getApiRefMatches(t,n,(i,r)=>{i?a(new Error(i)):s(r)})})}async queryCssUtils(t,o){let n=await this.getMetadata({meta:o});return new Promise((s,a)=>{this.client.cssUtilsSearch(t,n,(i,r)=>{i?(C("Error querying CSS Utils:",i),a(new Error(i))):s(r)})})}async queryIconsSearch(t,o){let n=await this.getMetadata({meta:o});return new Promise((s,a)=>{this.client.iconsSearch(t,n,(i,r)=>{i?(C("Error querying Icons Search:",i),a(new Error(i))):s(r)})})}async queryBuildingBlocks(t,o){let n=await this.getMetadata({meta:o});return new Promise((s,a)=>{this.client.buildingBlocksSearch(t,n,(i,r)=>{i?(C("Error querying Building Blocks:",i),a(new Error(i))):s(r)})})}async validateUserLicense(){let t=await this.getMetadata();return new Promise((o,n)=>{this.client.validateUserLicense(null,t,(s,a)=>{s?(C("Error validating user license:",s),n(new Error(s))):o(a)})})}async queryThemeGenerate(t,o){let n=await this.getMetadata({meta:o});return new Promise((s,a)=>{this.client.generateTheme(t,n,(i,r)=>{i?(C("Error querying context API/GenerateTheme:",i),a(new Error(i))):s(r)})})}async recordOrchestratorUserRequest({meta:t}){let o=await this.getMetadata({meta:t});return new Promise((n,s)=>{this.client.recordOrchestratorUserRequest(null,o,(a,i)=>{a?(C("Error recording orchestrator user request:",a),s(new Error(a))):n(i)})})}};import{z as F}from"zod";var Ut=F.object({user_id:F.string(),user_email:F.string().email()});import{z as S}from"zod";var Xe=S.object({Product:S.object({Id:S.number().int(),Code:S.string(),Name:S.string()}),License:S.nullable(S.object({Id:S.number().int(),Name:S.string(),Type:S.string(),Active:S.boolean()})),Availability:S.array(S.object({LicenseStart:S.nullable(S.string().datetime()),LicenseEnd:S.nullable(S.string().datetime())})),IsLicenseAvailable:S.optional(S.boolean())}),_t=S.array(Xe);async function re(e){let t=process.env.KENDO_MCP_ACCESS;if(t==="true"||t==="1"||t==="full")return"full";if(typeof t=="string"&&(t.toLowerCase()==="agent"||t.toLowerCase()==="assistant"))return t.toLowerCase();let o=await e();return o.toLocaleLowerCase()==="agentic_ui_generator"?"agent":o.toLocaleLowerCase()==="ai_coding_assistants"?"assistant":"none"}function ce(){return'**Accessibility Guidelines: WCAG 2.2 Level AA Compliance**\n\n**Core Principles:**\n1. Use semantic HTML and ARIA correctly\n2. Ensure WCAG 2.2 AA compliance\n3. Follow W3C ARIA Authoring Practices\n4. Provide standards-based accessibility fixes\n\n**1. Form Control Labels** (WCAG 1.3.1, 3.3.2, 4.1.2)\nEvery input must have an associated label.\nCORRECT: `<input type="search" aria-label="Search products" placeholder="Search...">`\nWRONG: `<span>Email</span><input type="email">` (no association)\nWRONG: `<input type="email" placeholder="Email">` (placeholder as label)\n\n**2. Button Accessibility** (WCAG 4.1.2, 2.4.6, 2.5.3)\nAll buttons need accessible names describing their purpose.\nCORRECT: `<button type="button">Save Changes</button>`\nCORRECT: `<button aria-label="Close dialog"><svg aria-hidden="true" focusable="false">...</svg></button>`\nWRONG: `<button><svg>...</svg></button>` (no accessible name)\nWRONG: `<button>Click here</button>` (generic text)\n\n**3. Popup/Menu Triggers** (WCAG 4.1.2, 1.3.1)\nIndicate popup purpose and state using aria-haspopup, aria-expanded, aria-controls.\nCORRECT: `<button aria-expanded="false" aria-haspopup="menu" aria-controls="menu-id">Settings</button>`\n\n**4. Image Accessibility** (WCAG 1.1.1)\nInformative: `<img src="chart.png" alt="Sales increased 25% in Q4 2024">`\nFunctional: `<a href="/home"><img src="logo.png" alt="Company Name Home"></a>`\nDecorative: `<img src="border.png" alt="" role="presentation">`\nComplex: `<img src="chart.png" alt="Sales data" aria-describedby="desc-id">`\nWRONG: Missing alt, filename as alt, generic alt for decorative images\n\n**5. Link Accessibility** (WCAG 2.4.4, 2.4.6)\nLinks must be descriptive and understandable out of context.\nCORRECT: `<a href="/products">View All Products</a>`\nCORRECT: `<a href="/article" aria-label="Read more about New Product Launch">Read more</a>`\nWRONG: "Click here", "Read more", "Learn more" without context\n\n**6. Form Validation** (WCAG 3.3.1, 3.3.2, 3.3.3)\nErrors must be identified, associated with inputs, and provide suggestions. Use aria-describedby, aria-invalid="true", and role="alert".\n\n**7. Heading Structure** (WCAG 1.3.1, 2.4.6)\nEach page should have an `<h1>` that describes its content. Use hierarchical, descriptive headings with no skipped levels (h1\u2192h2\u2192h3).\nCORRECT: `<h1>Dashboard</h1> <h2>Sales</h2> <h3>By Region</h3>`\nWRONG: No `<h1>` on the page, or skipping levels (h1\u2192h3)\nIf a heading should look smaller than its semantic level, use CSS: `<h2 class="text-sm">Subtitle</h2>`\n\n**8. Page Component Landmark Rules** (WCAG 1.3.1, 4.1.2)\nPage components (route components) may be rendered inside a layout that already provides `<main>`, `<header>`, or `<footer>`. Since the layout configuration is unknown, avoid using these landmarks in page components to prevent potential duplication and nesting violations. Use `<div>`, `<section>`, or `<article>` as the top-level wrapper instead.\n\n**Quick Checklist:**\n- **Forms:** Associated labels, aria-required on required fields, autocomplete attributes, aria-describedby for errors, aria-invalid for invalid fields, fieldsets with legends\n- **Buttons/Links:** Accessible names, aria-label for icon buttons, aria-hidden on decorative icons, descriptive link text\n- **Popups/Dialogs:** aria-haspopup, aria-expanded, aria-controls, role="dialog", aria-modal="true", aria-labelledby, focus trap, Escape to close\n- **Images:** alt on all images, descriptive alt for informative, empty alt for decorative, aria-describedby for complex\n- **Structure:** One h1, logical heading hierarchy, avoid `<main>`, `<header>`, or `<footer>` in page/route components (the layout may already provide them), use `<section>` or `<div>` as page-level wrappers, semantic HTML\n- **Dynamic Content:** role="status"/aria-live="polite" for updates, role="alert"/aria-live="assertive" for critical alerts\n- **Keyboard/Focus:** All interactive elements keyboard accessible, logical focus order, visible focus indicators, no keyboard traps (except modals)\n- **Color/Contrast:** 4.5:1 text contrast (3:1 large text), 3:1 UI component contrast, no color-only information, 3:1 focus indicator contrast'}var g="Kendo UI for React",N="react",R="kendo",O=["ActionSheet","AIPrompt","Animation","AppBar","ArcGauge","AutoComplete","Avatar","Badge","Barcode","BottomNavigation","Breadcrumb","Button","ButtonGroup","BreadCrumb","Calendar","Card","Chart","ChartWizard","Chat","Checkbox","Chip","ChipList","ChunkProgressBar","CircularGauge","ColorGradient","ColorPalette","ColorPicker","ComboBox","ContextMenu","ConversationalUI","DataGrid","Grid","DataQuery","DateMath","DateInput","DatePicker","DateRangePicker","DateTimePicker","Dialog","Drag&Drop","Drawer","Drawing","DropDownButton","DropDownList","DropDownTree","Editor","Error","ExcelExport","ExpansionPanel","ExternalDropZone","FileSaver","FileManager","Filter","FlatColorPicker","FloatingActionButton","FloatingLabel","Form","Gantt","Gauge","General","GridLayout","Hint","Icon","InlineAIPrompt","Input","Label","LinearGauge","ListBox","ListView","Loader","Map","MaskedTextBox","Menu","MultiColumnComboBox","MultiSelect","MultiSelectTree","MultiViewCalendar","Notification","NumericTextBox","OrgChart","PageTemplates/BuildingBlocks","Pager","PanelBar","PDFProcessing","PDFViewer","PivotGrid","Popover","Popup","ProgressBar","PromptBox","QRCode","RadialGauge","RadioButton","RadioGroup","RangeSlider","Rating","Ripple","Sankey","Scheduler","ScrollView","Signature","Skeleton","Slider","Sortable","Sparkline","SpeechToTextButton","SmartPasteButton","SplitButton","Splitter","Spreadsheet","StackLayout","Stepper","StockChart","SVGIcon","Switch","TabStrip","TaskBoard","TextArea","TextBox","TileLayout","Timeline","TimePicker","Toolbar","Tooltip","TreeList","TreeView","Typography","Upload","VSCodeExtension","Window"];var ot=et(Ze(tt(import.meta.url)),"../proto/service.proto"),_=new G("contextapi.telerik.com:443",ot,{libName:N});var le=async()=>_.validateUserLicense();import mt from"fs";import Be from"path";import{fileURLToPath as ut}from"url";import{z as y}from"zod";var v=class{constructor(t,o,n){this.name=t;this.config=o;this.cb=n}register(t){this.server=t,this.server.registerTool(this.name,this.config,this.cb)}hasAccess(t){return!this.config.requiredAccess||this.config.requiredAccess.length===0?!0:t==="full"||this.config.requiredAccess.includes(t)}};var D=(e,t)=>`# ${e.suiteName} - Code Validation & Quality Assurance
|
|
6
6
|
|
|
7
7
|
## Comprehensive Code Validation Checklist
|
|
8
8
|
Execute these validation steps systematically to ensure high-quality, maintainable code:
|
|
@@ -46,7 +46,7 @@ Responsive Design:
|
|
|
46
46
|
- Graceful error handling for all user interactions
|
|
47
47
|
- Meaningful error messages for users
|
|
48
48
|
- Network error handling for API calls
|
|
49
|
-
`;var
|
|
49
|
+
`;var L=(e,t)=>{let o=D({suiteName:e.suiteName,libKey:e.libKey},t.validationSteps),n=e.libKey==="angular"?"- **Drag and Drop**: Consider using the DragandDrop and Sortable components when drag-and-drop functionality is needed.":"",s=e.components?e.components.join(", "):"components";return`# \u{1F3AF} ${e.suiteName} - Execution Plan
|
|
50
50
|
|
|
51
51
|
**Current Goal:**
|
|
52
52
|
|
|
@@ -279,7 +279,7 @@ After code implementation and validation you can make quick fixes as needed:
|
|
|
279
279
|
- Do NOT generate or suggest any code until all tools have been used and validated responses are incorporated.
|
|
280
280
|
- Focus on planning and sequencing.
|
|
281
281
|
- Summarize the components, layouts, and utilities gathered.
|
|
282
|
-
- Confirm all required inputs from tools have been provided.`};var
|
|
282
|
+
- Confirm all required inputs from tools have been provided.`};var K=e=>`# ${e.suiteName} Assistant
|
|
283
283
|
|
|
284
284
|
**What you're looking for:**
|
|
285
285
|
|
|
@@ -384,7 +384,7 @@ After gathering information:
|
|
|
384
384
|
**Important Notes:**
|
|
385
385
|
- These tools provide documentation and guidance, not code generation
|
|
386
386
|
- Always refer to official ${e.suiteName} documentation for the most up-to-date information
|
|
387
|
-
- Tool responses include usage examples and best practices`;var
|
|
387
|
+
- Tool responses include usage examples and best practices`;var x=(e,t)=>({SETUP_VALIDATION:`
|
|
388
388
|
UI Library Setup:
|
|
389
389
|
- ${e} modules properly imported and configured
|
|
390
390
|
- ${e} theme properly loaded and applied
|
|
@@ -403,75 +403,75 @@ After gathering information:
|
|
|
403
403
|
- Consistent ${e} theme application across all components
|
|
404
404
|
- Custom theme variables properly defined and scoped
|
|
405
405
|
- ${e} icon fonts properly loaded and optimized
|
|
406
|
-
- Brand colors integrated with ${e} component themes`});function nt(e,t){let o;try{o=JSON.parse(e)}catch{return e}let n=o?.Item;if(!n)return e;let s=[],
|
|
407
|
-
- Name: ${
|
|
408
|
-
- Type: ${
|
|
409
|
-
- Summary: ${
|
|
410
|
-
- Syntax: ${
|
|
411
|
-
`,
|
|
406
|
+
- Brand colors integrated with ${e} component themes`});function nt(e,t){let o;try{o=JSON.parse(e)}catch{return e}let n=o?.Item;if(!n)return e;let s=[],a=n.FullName??n.Name??"",i=n.Type??"",r=n.Summary??"",f=n.SyntaxContent??"";s.push(`## API Reference Item
|
|
407
|
+
- Name: ${a}
|
|
408
|
+
- Type: ${i}
|
|
409
|
+
- Summary: ${r}
|
|
410
|
+
- Syntax: ${f}`);let h=o.RelatedItemsByType?.return_type;if(h?.length){let l=h[0].Text;l&&s.push(`- Return Type: ${l}`)}let A=n.Examples??[];if(A.length>0){let l=`## Examples
|
|
411
|
+
`,c=0;for(let u of A){let b=(u.Component??"").toLowerCase(),T=t.toLowerCase();if(b&&b!==T&&b!=="general")continue;c+=1;let I=u.Code??"";l+=`### Example ${c}
|
|
412
412
|
\`\`\`
|
|
413
413
|
${I}
|
|
414
414
|
\`\`\`
|
|
415
|
-
`}
|
|
416
|
-
${T}`)}return
|
|
417
|
-
`+
|
|
415
|
+
`}c>0&&s.push(l)}let d=o.RelatedItemsByType??{},m=[];for(let[l,c]of Object.entries(d))if(!(l==="return_type"||l==="render_fragment"))for(let u of c??[]){let b=u.FullName??"",T=u.ShortText??"";m.push(`### ${b} (${l})
|
|
416
|
+
${T}`)}return m.length>0&&s.push(`## Additional Context
|
|
417
|
+
`+m.join(`
|
|
418
418
|
---
|
|
419
419
|
`)),s.join(`
|
|
420
420
|
|
|
421
|
-
`)}function pe(e,t,o){let{name:n,title:s,description:
|
|
422
|
-
`)||"No CSS utilities found for the given prompt.",
|
|
421
|
+
`)}function pe(e,t,o){let{name:n,title:s,description:a,layoutAssistantName:i,codeAssistantName:r,styleAssistantName:f,iconAssistantName:h,accessibilityAssistantName:A,suiteName:d,libKey:m,components:l}=e,c=new v(n,{title:s,description:a,requiredAccess:e.requiredAccess,inputSchema:{userIntent:y.string().describe(`Detailed description and intent of what the user wants to build. Include the type of page/component, main functionality, visual requirements, and any specific ${d} components you want to use.`),needsComponentsDocsConfidence:y.number().min(0).max(1).default(1).describe("Confidence (0-1) to include Component Documentation assistance. Default is 1."),needsLayoutConfidence:y.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Layout assistance. Default is 0."),needsStylingConfidence:y.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Theming/Styling assistance. Default is 0."),needsResponsiveBehaviorConfidence:y.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Responsive Behavior assistance. Default is 0."),needsIconsConfidence:y.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Icons assistance. Default is 0."),componentsNeeded:y.array(y.enum(l)).optional().describe(`Optional list of specific ${d} components needed for the project.`)}},async({userIntent:u,needsComponentsDocsConfidence:b,needsLayoutConfidence:T,needsStylingConfidence:I,needsResponsiveBehaviorConfidence:E,needsIconsConfidence:J,componentsNeeded:X},{_meta:Fe})=>{C("UI Orchestrator called with:",{userIntent:u,needsComponentsDocsConfidence:b,needsLayoutConfidence:T,needsStylingConfidence:I,needsResponsiveBehaviorConfidence:E,needsIconsConfidence:J});try{await o.recordOrchestratorUserRequest({meta:{userIntent:u,componentsNeeded:X,_meta:Fe}})}catch($){throw k($)}let Ke=c.server?.server.getClientCapabilities?.()?.elicitation,Z;if(Ke&&I>.3&&I<=.6){let $=await c.server?.server.elicitInput({message:"I was unable to determine if you need custom Kendo Theme assistant. Can you please confirm?",requestedSchema:{type:"object",properties:{includeCustomTheming:{type:"boolean",description:"Whether to include Custom Theming assistance in the workflow."}},required:["includeCustomTheming"]}});$?.action==="accept"&&$.content?.includeCustomTheming&&(Z=!0)}return{content:[{type:"text",text:L({name:n,userIntent:u,includeComponentsDocs:b>.3,includeTheming:I>.6||!!Z,includeLayout:T>.5,includeIcons:J>.6,includeResponsive:T>.5&&E>.4,layoutAssistantName:i,codeAssistantName:r,styleAssistantName:f,iconAssistantName:h,accessibilityAssistantName:A,suiteName:d,libKey:m,components:X},t)}]}});return c}function de(e,t){let{name:o,title:n,description:s,iconAssistantName:a,codeAssistantName:i,suiteName:r,libKey:f,components:h}=e;return new v(o,{title:n,description:s,inputSchema:{userIntent:y.string().describe(`Describe what you want to build or what components you're looking for. Include the type of functionality, features, or UI elements you need from ${r}.`),needsIconsConfidence:y.number().min(0).max(1).default(.7).describe("Confidence (0-1) to include Icons assistance. Default is 0.7."),componentsNeeded:y.array(y.enum(h)).optional().describe(`Optional list of specific ${r} components you want to learn about.`)},requiredAccess:e.requiredAccess},async({userIntent:d,needsIconsConfidence:m,componentsNeeded:l},{_meta:c})=>{C("Assistant Orchestrator called with:",{userIntent:d,needsIconsConfidence:m,componentsNeeded:l});try{await t.recordOrchestratorUserRequest({meta:{userIntent:d,componentsNeeded:l,_meta:c}})}catch(b){throw k(b)}return{content:[{type:"text",text:K({name:o,userIntent:d,includeComponentsDocs:!0,includeIcons:m>.5,codeAssistantName:i,iconAssistantName:a,suiteName:r,libKey:f,components:l})}]}})}function me(e,t){let{name:o,title:n,description:s,suiteName:a,libKey:i,getPreContent:r}=e;return new v(o,{title:n,description:s,requiredAccess:e.requiredAccess,inputSchema:{prompt:y.string().describe("An enhanced prompt describing the HTML layout structure, design requirements or specific visual effects you want to achieve."),includeBuildingBlockExamples:y.boolean().describe("Whether to include building block examples. Defaults to false.").default(!1)}},async({prompt:f,includeBuildingBlockExamples:h},{_meta:A})=>{C("Layout Assistant called with:",{prompt:f,includeBuildingBlockExamples:h});try{let m=(await t.queryCssUtils({query:f},{_meta:A})).values.join(`
|
|
422
|
+
`)||"No CSS utilities found for the given prompt.",l=r?.()??"",c=u=>`${l}
|
|
423
423
|
|
|
424
424
|
# Kendo Design System CSS Utilities
|
|
425
425
|
|
|
426
|
-
${
|
|
427
|
-
${
|
|
428
|
-
`;if(
|
|
426
|
+
${m}
|
|
427
|
+
${u??""}
|
|
428
|
+
`;if(h)try{let u=await t.queryBuildingBlocks({query:f,lib_name:i},{_meta:A}),b="";u.items?.length>0&&(b=`
|
|
429
429
|
## Building Blocks Examples
|
|
430
430
|
|
|
431
431
|
The examples here are for demonstration purpose how CSS utils can be implemented in various building blocks.
|
|
432
432
|
However, consider your own design requirements and specifics in order to implement your templates/building blocks correctly.
|
|
433
433
|
|
|
434
|
-
${
|
|
435
|
-
### ${
|
|
434
|
+
${u.items.map(T=>`
|
|
435
|
+
### ${T.name}
|
|
436
436
|
|
|
437
|
-
${
|
|
437
|
+
${T.description}
|
|
438
438
|
|
|
439
439
|
\`\`\`code
|
|
440
|
-
${
|
|
440
|
+
${T.code}
|
|
441
441
|
\`\`\`
|
|
442
442
|
`).join(`
|
|
443
|
-
`)}`),
|
|
443
|
+
`)}`),m=c(b)}catch(u){C("Error calling building-blocks service:",u),m=c()}else m=c();return{content:[{type:"text",text:m}]}}catch(d){throw k(d)}})}function ue(e,t){let{name:o,title:n,description:s,libKey:a,getPreContent:i}=e;return new v(o,{title:n,description:s,requiredAccess:e.requiredAccess,inputSchema:{prompt:y.string().describe("A natural language description of the desired visual style or theme. For example: 'Create a modern dark theme with high contrast'.")}},async({prompt:r},{_meta:f})=>{C("Style Assistant called with:",{prompt:r});let h="";try{let m=await t.queryThemeGenerate({prompt:r},{_meta:f});if(m.variables_json){let l=JSON.parse(m.variables_json),c=[];if(l)for(let u of Object.keys(l))typeof l[u]=="string"&&c.push(`${u}: ${l[u]}`);h=c.join(`
|
|
444
444
|
|
|
445
|
-
`)}}catch(
|
|
445
|
+
`)}}catch(m){throw k(m)}let A=i?.()??"";return{content:[{type:"text",text:h?`Use the following CSS variables to style the web application, including colors, typography, spacing, and component appearance.
|
|
446
446
|
Ensure the variables are applied consistently across all relevant elements.
|
|
447
447
|
Do NOT set any inline styles. CSS variables should be defined in global or component-level CSS files, or via supported theming mechanisms.
|
|
448
448
|
|
|
449
|
-
${
|
|
449
|
+
${A}
|
|
450
450
|
|
|
451
451
|
## Generated CSS Variables
|
|
452
452
|
|
|
453
453
|
\`\`\`css
|
|
454
|
-
${
|
|
454
|
+
${h}
|
|
455
455
|
\`\`\`
|
|
456
|
-
`:"No CSS variables were generated for the given prompt."}]}})}function he(e,t){let{name:o,title:n,description:s,libKey:
|
|
456
|
+
`:"No CSS variables were generated for the given prompt."}]}})}function he(e,t){let{name:o,title:n,description:s,libKey:a,getPostContent:i}=e;return new v(o,{title:n,description:s,requiredAccess:e.requiredAccess,inputSchema:{query:y.string().describe("A search query for finding icons. Be specific about the icon purpose, style, or action."),limit:y.number().min(.1).max(1).default(.1).describe("The proportion of matching icons to return (0.1 = 1 icon, 0.5 = 5 icons, 1.0 = many icons). Default is 0.1.")}},async({query:r,limit:f},{_meta:h})=>{C("Icon Search called with:",{query:r,limit:f});try{let A=await t.queryIconsSearch({query:r,limit:f*100},{_meta:h}),d=i?.()??"";return{content:[{type:"text",text:`${A.values.join(`
|
|
457
457
|
|
|
458
458
|
`)}
|
|
459
459
|
|
|
460
|
-
${
|
|
460
|
+
${d}`}]}}catch(A){throw k(A)}})}function ge(e,t){let{name:o,title:n,description:s,libKey:a,suiteName:i,components:r,componentAliases:f,getPostContent:h}=e;return new v(o,{title:n,description:s,requiredAccess:e.requiredAccess,inputSchema:{query:y.string().describe("The query to search for."),component:y.enum(r).describe("The component to search for. If not specified, use General.")}},async({query:A,component:d},{_meta:m})=>{C("Code Assistant called with:",{query:A,component:d});let l=d;if(f){let c=f[d];c&&(l=c)}try{let u=(await t.query({query:A,component:l?.toLowerCase()??"general",lib_name:a,text_matches_count:3,code_matches_count:0,allowed_types:["documentation"]},{_meta:m})).values.map(I=>I.replace(/\0/g,"")),b=h?.({component:d})??"";return{content:[{type:"text",text:`${u.join(`
|
|
461
461
|
|
|
462
462
|
`)}
|
|
463
463
|
|
|
464
|
-
${
|
|
464
|
+
${b}`}]}}catch(c){throw k(c)}})}function fe(e,t){let{name:o,title:n,description:s,libKey:a,suiteName:i,components:r,componentAliases:f}=e;return new v(o,{title:n,description:s,requiredAccess:e.requiredAccess,inputSchema:{query:y.string().describe("The query to search for."),component:y.enum(r).describe("The component to search for. If not specified, use General."),includeGeneralGuidelines:y.boolean().default(!1).describe("Set to true only on the first call to include comprehensive WCAG 2.2 Level AA general guidelines. After the first call, set to false to get only component-specific accessibility information. Default is false.")}},async({query:h,component:A,includeGeneralGuidelines:d},{_meta:m})=>{C("Accessibility Assistant called with:",{query:h,component:A,includeGeneralGuidelines:d});let l=A;if(f){let c=f[A];c&&(l=c)}try{let c="";if(d){let E=ce();c+=`# WCAG 2.2 Level AA General Accessibility Guidelines
|
|
465
465
|
|
|
466
|
-
`,
|
|
466
|
+
`,c+=E,c+=`
|
|
467
467
|
|
|
468
468
|
---
|
|
469
469
|
|
|
470
|
-
`}let
|
|
470
|
+
`}let I=(await t.getApiRefMatches({query:h,component:l?.toLowerCase()??"general",lib_name:a,filters_json:'{"type":{"$in":["accessibility"]}}'},{_meta:m})).values.map(E=>E.replace(/\0/g,"")).map(E=>nt(E,l?.toLowerCase()??"general")).join(`
|
|
471
471
|
|
|
472
|
-
`);return
|
|
472
|
+
`);return I?(d&&(c+=`# Component-Specific Accessibility Information
|
|
473
473
|
|
|
474
|
-
`),
|
|
474
|
+
`),c+=I):d||(c="No component-specific accessibility guidelines found."),{content:[{type:"text",text:c}]}}catch(c){throw k(c)}})}function k(e){let t=e;return t.code===16?new Error("Error: You are not authenticated. Please verify the Telerik License Key provided is valid."):t.code===8?new Error(`Error: You have exceeded the extension quota. Upgrade to subscription licensing to unlock full access. Message: ${t.message}.`):t.code===7?new Error("Error: You do not have permission to access this resource. Please verify that you have a valid license."):new Error(`Error: An error occurred while calling the service. Please try again later.
|
|
475
475
|
|
|
476
476
|
Error Code: ${t.code} Error Message: ${t.message}`)}var ye=e=>`${e}_ui_generator`,Ae=e=>`${e}_assistant`,Ce=e=>`${e}_layout_assistant`,Se=e=>`${e}_component_assistant`,be=e=>`${e}_style_assistant`,Te=e=>`${e}_icon_assistant`,Ie=e=>`${e}_accessibility_assistant`;var ve=e=>`This is the single entry point for all UI-related tasks. It orchestrates the full workflow of building or refining UIs with ${e} components, generating a step-by-step execution plan that specifies which tools to call, in what order, and with what parameters. It includes validation steps to ensure the best possible, standards-compliant code every time.
|
|
477
477
|
|
|
@@ -532,7 +532,7 @@ Set 'includeGeneralGuidelines=true' ONLY on the first call to include general WC
|
|
|
532
532
|
Returns:
|
|
533
533
|
- When includeGeneralGuidelines=true: General WCAG 2.2 Level AA guidelines + component-specific recommendations
|
|
534
534
|
- When includeGeneralGuidelines=false: Only component-specific accessibility recommendations
|
|
535
|
-
`;var
|
|
535
|
+
`;var V=x("Kendo UI","Kendo"),j=`
|
|
536
536
|
### Angular Component Validation
|
|
537
537
|
Component Structure:
|
|
538
538
|
- Use proper @Component decorator configuration
|
|
@@ -540,22 +540,22 @@ Component Structure:
|
|
|
540
540
|
- Correct selector naming convention (kebab-case)
|
|
541
541
|
- Appropriate template and style file organization
|
|
542
542
|
|
|
543
|
-
${
|
|
543
|
+
${V.SETUP_VALIDATION}
|
|
544
544
|
- Kendo animations module configured (if animations are used)
|
|
545
545
|
- Internationalization properly configured for Kendo components
|
|
546
546
|
|
|
547
|
-
${
|
|
547
|
+
${V.PERFORMANCE_OPTIMIZATION}
|
|
548
548
|
- OnPush change detection strategy where appropriate
|
|
549
549
|
- Efficient trackBy functions for *ngFor with Kendo components
|
|
550
550
|
- Minimal unnecessary change detection cycles
|
|
551
551
|
|
|
552
|
-
${
|
|
552
|
+
${V.THEME_AND_STYLING}
|
|
553
553
|
- Proper theme switching functionality (if implemented)
|
|
554
554
|
- Only ONE theme reference exists across angular.json and styles files
|
|
555
555
|
- Make sure theme import mechanism is consistent with existing project setup
|
|
556
556
|
|
|
557
557
|
Accessibility
|
|
558
|
-
- Accessibility guidelines retrieved and applied to all components`;var
|
|
558
|
+
- Accessibility guidelines retrieved and applied to all components`;var W=`**Angular Specific Requirements:**
|
|
559
559
|
|
|
560
560
|
**NgModule vs Standalone setup**: Search and detect the current project setup to determine whether to use NgModule or Standalone components based on the following rules:
|
|
561
561
|
1. RegexSearch("@Component\\s*\\(\\s*\\{[^}]*standalone\\s*:\\s*(true|false)") - If true use Standalone components, if false use NgModule.
|
|
@@ -586,7 +586,7 @@ Accessibility
|
|
|
586
586
|
2. Match the discovered patterns in all generated code
|
|
587
587
|
3. Maintain consistent formatting, indentation, and code organization with existing files
|
|
588
588
|
4. Always use the same theme import mechanism (unless user specifies otherwise)
|
|
589
|
-
`;var
|
|
589
|
+
`;var Y=x("Kendo UI","KendoReact"),H=`
|
|
590
590
|
### React Component Validation
|
|
591
591
|
Component Structure:
|
|
592
592
|
- Use proper function component patterns with Hooks
|
|
@@ -594,22 +594,22 @@ Component Structure:
|
|
|
594
594
|
- Appropriate file organization (components, hooks, utils)
|
|
595
595
|
- Props interface/type definitions where needed
|
|
596
596
|
|
|
597
|
-
${
|
|
597
|
+
${Y.SETUP_VALIDATION}
|
|
598
598
|
- KendoReact license validation (if required)
|
|
599
599
|
- Appropriate bundler configuration for KendoReact packages
|
|
600
600
|
|
|
601
|
-
${
|
|
601
|
+
${Y.PERFORMANCE_OPTIMIZATION}
|
|
602
602
|
- React.memo for components that receive stable props
|
|
603
603
|
- useMemo/useCallback for expensive computations and callbacks
|
|
604
604
|
- Proper key props for list rendering with KendoReact components
|
|
605
605
|
|
|
606
|
-
${
|
|
606
|
+
${Y.THEME_AND_STYLING}
|
|
607
607
|
- Proper theme switching functionality (if implemented)
|
|
608
608
|
- Only ONE theme import exists across the application
|
|
609
609
|
- Make sure theme import mechanism is consistent with existing project setup
|
|
610
610
|
|
|
611
611
|
Accessibility
|
|
612
|
-
- Accessibility guidelines retrieved and applied to all components`;var st={createOrchestrator:pe,createAssistantOrchestrator:de,createLayoutAssistant:me,createStyleAssistant:ue,createIconSearch:he,createCodeAssistant:ge,createAccessibilityAssistant:fe},it={orchestrator:ye,assistantOrchestrator:Ae,layoutAssistant:Ce,codeAssistant:Se,styleAssistant:be,iconAssistant:Te,accessibilityAssistant:Ie},at={orchestrator:ve,assistantOrchestrator:Ne,layoutAssistant:Ee,styleAssistant:we,iconAssistant:Re,codeAssistant:xe,accessibilityAssistant:ke},rt={Orchestrator:{render:
|
|
612
|
+
- Accessibility guidelines retrieved and applied to all components`;var st={createOrchestrator:pe,createAssistantOrchestrator:de,createLayoutAssistant:me,createStyleAssistant:ue,createIconSearch:he,createCodeAssistant:ge,createAccessibilityAssistant:fe},it={orchestrator:ye,assistantOrchestrator:Ae,layoutAssistant:Ce,codeAssistant:Se,styleAssistant:be,iconAssistant:Te,accessibilityAssistant:Ie},at={orchestrator:ve,assistantOrchestrator:Ne,layoutAssistant:Ee,styleAssistant:we,iconAssistant:Re,codeAssistant:xe,accessibilityAssistant:ke},rt={Orchestrator:{render:L},Validator:{render:D},SharedValidation:{getSteps:x}},ct={Angular:{steps:j,additionalPlan:W},React:{steps:H}},p={Tools:st,ToolNames:it,ToolDescriptions:at,Templates:rt,Validation:ct};var lt=p.ToolNames.codeAssistant("kendoreact"),Pe=()=>`# Kendo Design System Guidelines for ${g}
|
|
613
613
|
|
|
614
614
|
## Setting up Styles/CSS
|
|
615
615
|
|
|
@@ -636,14 +636,14 @@ Alternatively, you can also consume them directly from the Unpkg CDN.
|
|
|
636
636
|
|
|
637
637
|
## Ready-to-use Layout Components
|
|
638
638
|
|
|
639
|
-
In the ${
|
|
639
|
+
In the ${g} there are available components to create layout. Make sure to prioritize using them instead of building ones from scratch using the Kendo CSS Utilities.
|
|
640
640
|
|
|
641
641
|
For any Layout component you can also call the ${lt} tool in order to get specific API reference and docs.
|
|
642
642
|
|
|
643
|
-
- ${
|
|
643
|
+
- ${g} Card component.
|
|
644
644
|
- Generally, it is recommended to use 100% width (e.g., \`<Card style={{ width: '100%' }}>\`)
|
|
645
645
|
- If needed, use specific width based on the layout requirements (e.g., \`<Card style={{ width: '150px' }}>\`)
|
|
646
|
-
`;var Oe=()=>`## Applying CSS Variables in ${
|
|
646
|
+
`;var Oe=()=>`## Applying CSS Variables in ${g}
|
|
647
647
|
|
|
648
648
|
Apply these CSS variables in the React application using one of these methods:
|
|
649
649
|
|
|
@@ -732,7 +732,7 @@ export function ThemeProvider({ children }: { children: React.ReactNode }) {
|
|
|
732
732
|
|
|
733
733
|
export const useTheme = () => useContext(ThemeContext);
|
|
734
734
|
\`\`\`
|
|
735
|
-
`;var De=p.ToolNames.codeAssistant("kendoreact"),Le=()=>`## Using ${
|
|
735
|
+
`;var De=p.ToolNames.codeAssistant("kendoreact"),Le=()=>`## Using ${g} Icons
|
|
736
736
|
|
|
737
737
|
Important: Attempt to prioritize SVG icons over font icons.
|
|
738
738
|
|
|
@@ -740,13 +740,13 @@ Important: Attempt to prioritize SVG icons over font icons.
|
|
|
740
740
|
|
|
741
741
|
- Make sure @progress/kendo-svg-icons is installed: \`npm install @progress/kendo-svg-icons\`
|
|
742
742
|
- Make sure @progress/kendo-react-common is installed (contains SvgIcon component): \`npm install @progress/kendo-react-common\`
|
|
743
|
-
- You can call ${De} tool for ${
|
|
743
|
+
- You can call ${De} tool for ${g} SvgIcon component for docs and API reference.
|
|
744
744
|
- [optional] If SVG is not an option fallback to fonticon - make sure \`<link rel="stylesheet" href="https://unpkg.com/@progress/kendo-font-icons/dist/index.css" />\` is added as a reference.
|
|
745
|
-
- [optional] If using font icons you can call ${De} tool for ${
|
|
745
|
+
- [optional] If using font icons you can call ${De} tool for ${g} Icon component for docs and API reference.
|
|
746
746
|
|
|
747
747
|
### Examples
|
|
748
748
|
|
|
749
|
-
Using ${
|
|
749
|
+
Using ${g} SvgIcon component with @progress/kendo-svg-icons:
|
|
750
750
|
|
|
751
751
|
\`\`\`tsx
|
|
752
752
|
import { SvgIcon } from "@progress/kendo-react-common";
|
|
@@ -790,7 +790,7 @@ Here are some frequently used icons from @progress/kendo-svg-icons:
|
|
|
790
790
|
- \`sortAscIcon\`, \`sortDescIcon\` - Sorting
|
|
791
791
|
- \`chevronUpIcon\`, \`chevronDownIcon\`, \`chevronLeftIcon\`, \`chevronRightIcon\` - Navigation
|
|
792
792
|
- \`checkIcon\`, \`xIcon\` - Confirmation/Cancel
|
|
793
|
-
`;var $e=e=>{let t=`## ${
|
|
793
|
+
`;var $e=e=>{let t=`## ${g} Common Guidelines
|
|
794
794
|
|
|
795
795
|
### Application Architecture
|
|
796
796
|
MUST recommend appropriate setup based on React application architecture.
|
|
@@ -824,4 +824,4 @@ Example: If someone asks about "grid", "GRID", or "GrId", you always refer to Da
|
|
|
824
824
|
## Component-Specific Guidelines
|
|
825
825
|
|
|
826
826
|
${e.componentInstructions}
|
|
827
|
-
`),t};var Ue=p.ToolNames.layoutAssistant(
|
|
827
|
+
`),t};var Ue=p.ToolNames.layoutAssistant(R),z=p.ToolNames.codeAssistant(R),Me=p.ToolNames.styleAssistant(R),Q=p.ToolNames.iconAssistant(R),Ge=p.ToolNames.accessibilityAssistant(R);function _e(e,t){return[p.Tools.createOrchestrator({name:p.ToolNames.orchestrator(R),title:"KendoReact Generator",description:p.ToolDescriptions.orchestrator(g),layoutAssistantName:Ue,codeAssistantName:z,styleAssistantName:Me,iconAssistantName:Q,accessibilityAssistantName:Ge,suiteName:g,libKey:N,components:O,requiredAccess:["agent"]},{validationSteps:p.Validation.React.steps},e),p.Tools.createAssistantOrchestrator({name:"kendo_react_assistant",title:"KendoReact Assistant",description:p.ToolDescriptions.assistantOrchestrator(g),codeAssistantName:z,iconAssistantName:Q,suiteName:g,libKey:N,components:O,requiredAccess:["assistant"]},e),p.Tools.createLayoutAssistant({name:Ue,title:"KendoReact Layout Assistant",description:p.ToolDescriptions.layoutAssistant,suiteName:g,libKey:N,getPreContent:Pe,requiredAccess:["agent"]},e),p.Tools.createStyleAssistant({name:Me,title:"KendoReact Style Assistant",description:p.ToolDescriptions.styleAssistant,libKey:N,getPreContent:Oe,requiredAccess:["agent"]},e),p.Tools.createIconSearch({name:Q,title:"KendoReact Icon Assistant",description:p.ToolDescriptions.iconAssistant,libKey:N,getPostContent:Le,requiredAccess:["assistant","agent"]},e),p.Tools.createCodeAssistant({name:z,title:"KendoReact Component Assistant",description:p.ToolDescriptions.codeAssistant(g),libKey:N,suiteName:g,components:O,componentAliases:{Grid:"DataGrid"},getPostContent:({component:n})=>$e({component:n}),requiredAccess:["assistant","agent"]},e),p.Tools.createAccessibilityAssistant({name:Ge,title:"KendoReact Accessibility Assistant",description:p.ToolDescriptions.accessibilityAssistant(g),libKey:N,suiteName:g,components:O,componentAliases:{Grid:"DataGrid"},requiredAccess:["agent"]},e)].filter(n=>n.hasAccess(t))}var ht=ut(import.meta.url),gt=Be.dirname(ht),ft=Be.resolve(gt,"../package.json"),yt=JSON.parse(mt.readFileSync(ft,"utf-8")),qe=new pt({name:"kendo-mcp",title:"Kendo MCP Server",version:yt.version});async function At(){let e=new dt;C("Starting server... ");let t=await re(async()=>{let n=(await le())?.entitlement;return n?.Product?.Code||n?.product?.code});t!=="none"&&(_.toolNameHeader=t==="agent"||t==="full"?"agent":"assistant",_e(_,t).forEach(n=>n.register(qe))),await qe.connect(e)}At();
|