@progress/kendo-react-mcp 1.5.1 → 1.5.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/index.js +3 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import{McpServer as lt}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 _=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 _(o.message);try{e=(await je(o.value)).licenses.find(async i=>!!(await We(i)).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 k from"node:fs";import U from"node:path";var q=!1,N=process.env.DEBUG_LOG_FILE,oe=!!(N&&typeof N=="string");if(oe){let e=U.resolve(N),t=U.dirname(e);if(t!=="."&&t!==process.cwd()&&!k.existsSync(t))try{k.mkdirSync(t,{recursive:!0})}catch(o){console.error("Error creating log directory:",o)}if(!k.existsSync(e))try{k.writeFileSync(e,"")}catch(o){console.error("Error creating log file:",o)}}else q=!1;q=oe&&!!N&&k.existsSync(U.resolve(N));function g(...e){if(q&&N){let n=`${new Date().toISOString()}: ${e.join(" ")}
|
|
3
3
|
`,i=U.resolve(N);k.appendFile(i,n,s=>{s&&console.error("Error writing to log file:",s)})}}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 i=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"),g("Using ContextApi URl:",this.contextApiUrl);let s=M.loadPackageDefinition(i);this.client=new s.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(),i=process.env.CONTEXTAPI_API_KEY,s=i&&typeof i=="string",c=o&&typeof o=="string";if(!c&&!s&&n)throw new Error(`Failed to authenticate with API key or License key!
|
|
4
4
|
|
|
5
|
-
License Error: ${n}`);let d=new M.Metadata;if(c)try{d.add("x-license-key",o)}catch(h){throw g("Error adding license key to metadata:",h),new Error(`Failed to use license key: ${h.message}`)}s&&d.add("x-api-key",i),this.options?.libName&&d.add("x-library-name",this.options.libName),d.add("x-tool-name",this.toolNameHeader);let m=JSON.stringify({...t,source:"npm",version:ae.version,os:process.platform,node_version:process.version});return d.add("x-request-metadata",Je(m)),d}async query(t){let o=await this.getMetadata();return new Promise((n,i)=>{this.client.query(t,o,(s,c)=>{s?i(new Error(s)):n(c)})})}async queryCssUtils(t){let o=await this.getMetadata();return new Promise((n,i)=>{this.client.cssUtilsSearch(t,o,(s,c)=>{s?(g("Error querying CSS Utils:",s),i(new Error(s))):n(c)})})}async queryIconsSearch(t){let o=await this.getMetadata();return new Promise((n,i)=>{this.client.iconsSearch(t,o,(s,c)=>{s?(g("Error querying Icons Search:",s),i(new Error(s))):n(c)})})}async queryBuildingBlocks(t){let o=await this.getMetadata();return new Promise((n,i)=>{this.client.buildingBlocksSearch(t,o,(s,c)=>{s?(g("Error querying Building Blocks:",s),i(new Error(s))):n(c)})})}async validateUserLicense(){let t=await this.getMetadata();return new Promise((o,n)=>{this.client.validateUserLicense(null,t,(i,s)=>{i?(g("Error validating user license:",i),n(new Error(i))):o(s)})})}async queryThemeGenerate(t){let o=await this.getMetadata();return new Promise((n,i)=>{this.client.generateTheme(t,o,(s,c)=>{s?(g("Error querying context API/GenerateTheme:",s),i(new Error(s))):n(c)})})}async recordOrchestratorUserRequest({meta:t}){let o=await this.getMetadata({meta:t});return new Promise((n,i)=>{this.client.recordOrchestratorUserRequest(null,o,(s,c)=>{s?(g("Error recording orchestrator user request:",s),i(new Error(s))):n(c)})})}};import{z as B}from"zod";var Ut=B.object({user_id:B.string(),user_email:B.string().email()});import{z as f}from"zod";var Xe=f.object({Product:f.object({Id:f.number().int(),Code:f.string(),Name:f.string()}),License:f.nullable(f.object({Id:f.number().int(),Name:f.string(),Type:f.string(),Active:f.boolean()})),Availability:f.array(f.object({LicenseStart:f.nullable(f.string().datetime()),LicenseEnd:f.nullable(f.string().datetime())})),IsLicenseAvailable:f.optional(f.boolean())}),$t=f.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)\nEvery page MUST have exactly one `<h1>`. 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 Landmarks and Regions** (WCAG 1.3.1, 2.4.1)\nEvery page MUST have exactly one `<main>` element. ALL visible content MUST be inside landmark regions.\n\nCORRECT:\n```html\n<body>\n <header>\n <nav aria-label="Main navigation">...</nav>\n </header>\n <main>\n <!-- Primary page content -->\n </main>\n <footer>...</footer>\n</body>\n```\n\n- Exactly ONE `<main>` per page \u2014 never zero, never more than one.\n- `<header>`, `<nav>`, `<footer>` are their own landmarks \u2014 place them OUTSIDE `<main>`, not inside it.\n- Never leave content as direct children of `<body>` outside a landmark \u2014 wrap in `<header>`, `<nav>`, `<main>`, `<aside>`, or `<footer>`.\n- Multiple `<nav>` or `<aside>` elements must have distinct `aria-label` values.\nWRONG: `<div class="sidebar">` / `<div class="content">` without landmark wrappers.\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, exactly one `<main>` landmark, all content inside landmarks (header, nav, main, aside, footer), skip links, 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 p="Kendo UI for React",v="react",E="kendo",x=["ActionSheet","AIPrompt","Animation","AppBar","ArcGauge","AutoComplete","Avatar","Badge","Barcode","BottomNavigation","Breadcrumb","Button","ButtonGroup","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","
|
|
5
|
+
License Error: ${n}`);let d=new M.Metadata;if(c)try{d.add("x-license-key",o)}catch(h){throw g("Error adding license key to metadata:",h),new Error(`Failed to use license key: ${h.message}`)}s&&d.add("x-api-key",i),this.options?.libName&&d.add("x-library-name",this.options.libName),d.add("x-tool-name",this.toolNameHeader);let m=JSON.stringify({...t,source:"npm",version:ae.version,os:process.platform,node_version:process.version});return d.add("x-request-metadata",Je(m)),d}async query(t){let o=await this.getMetadata();return new Promise((n,i)=>{this.client.query(t,o,(s,c)=>{s?i(new Error(s)):n(c)})})}async queryCssUtils(t){let o=await this.getMetadata();return new Promise((n,i)=>{this.client.cssUtilsSearch(t,o,(s,c)=>{s?(g("Error querying CSS Utils:",s),i(new Error(s))):n(c)})})}async queryIconsSearch(t){let o=await this.getMetadata();return new Promise((n,i)=>{this.client.iconsSearch(t,o,(s,c)=>{s?(g("Error querying Icons Search:",s),i(new Error(s))):n(c)})})}async queryBuildingBlocks(t){let o=await this.getMetadata();return new Promise((n,i)=>{this.client.buildingBlocksSearch(t,o,(s,c)=>{s?(g("Error querying Building Blocks:",s),i(new Error(s))):n(c)})})}async validateUserLicense(){let t=await this.getMetadata();return new Promise((o,n)=>{this.client.validateUserLicense(null,t,(i,s)=>{i?(g("Error validating user license:",i),n(new Error(i))):o(s)})})}async queryThemeGenerate(t){let o=await this.getMetadata();return new Promise((n,i)=>{this.client.generateTheme(t,o,(s,c)=>{s?(g("Error querying context API/GenerateTheme:",s),i(new Error(s))):n(c)})})}async recordOrchestratorUserRequest({meta:t}){let o=await this.getMetadata({meta:t});return new Promise((n,i)=>{this.client.recordOrchestratorUserRequest(null,o,(s,c)=>{s?(g("Error recording orchestrator user request:",s),i(new Error(s))):n(c)})})}};import{z as B}from"zod";var Ut=B.object({user_id:B.string(),user_email:B.string().email()});import{z as f}from"zod";var Xe=f.object({Product:f.object({Id:f.number().int(),Code:f.string(),Name:f.string()}),License:f.nullable(f.object({Id:f.number().int(),Name:f.string(),Type:f.string(),Active:f.boolean()})),Availability:f.array(f.object({LicenseStart:f.nullable(f.string().datetime()),LicenseEnd:f.nullable(f.string().datetime())})),IsLicenseAvailable:f.optional(f.boolean())}),$t=f.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)\nEvery page MUST have exactly one `<h1>`. 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 Landmarks and Regions** (WCAG 1.3.1, 2.4.1)\nEvery page MUST have exactly one `<main>` element. ALL visible content MUST be inside landmark regions.\n\nCORRECT:\n```html\n<body>\n <header>\n <nav aria-label="Main navigation">...</nav>\n </header>\n <main>\n <!-- Primary page content -->\n </main>\n <footer>...</footer>\n</body>\n```\n\n- Exactly ONE `<main>` per page \u2014 never zero, never more than one.\n- `<header>`, `<nav>`, `<footer>` are their own landmarks \u2014 place them OUTSIDE `<main>`, not inside it.\n- Never leave content as direct children of `<body>` outside a landmark \u2014 wrap in `<header>`, `<nav>`, `<main>`, `<aside>`, or `<footer>`.\n- Multiple `<nav>` or `<aside>` elements must have distinct `aria-label` values.\nWRONG: `<div class="sidebar">` / `<div class="content">` without landmark wrappers.\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, exactly one `<main>` landmark, all content inside landmarks (header, nav, main, aside, footer), skip links, 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 p="Kendo UI for React",v="react",E="kendo",x=["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","Form","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:v});var le=async()=>$.validateUserLicense();import pt from"fs";import Be from"path";import{fileURLToPath as mt}from"url";import{z as u}from"zod";var b=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 P=(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:
|
|
@@ -751,10 +751,11 @@ Using Font Icons:
|
|
|
751
751
|
\`\`\`tsx
|
|
752
752
|
// First, add the CSS link to your HTML or import in your styles
|
|
753
753
|
// <link rel="stylesheet" href="https://unpkg.com/@progress/kendo-font-icons/dist/index.css" />
|
|
754
|
+
import { Icon } from "@progress/kendo-react-common";
|
|
754
755
|
|
|
755
756
|
function App() {
|
|
756
757
|
return (
|
|
757
|
-
<
|
|
758
|
+
<Icon name="paperclip" />
|
|
758
759
|
);
|
|
759
760
|
}
|
|
760
761
|
|