@syncfusion/javascript-assistant 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,203 @@
1
+ # SyncfusionJavaScriptAssistant MCP Server
2
+
3
+ ## Overview
4
+
5
+ The SyncfusionJavaScriptAssistant is a specialized [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server designed to enhance development with Syncfusion's Javascript control libraries. It integrates seamlessly with [MCP-compatible clients](https://modelcontextprotocol.io/clients) to provide intelligent assistance for building Javascript applications with Syncfusion<sup style="font-size:70%">&reg;</sup> controls.
6
+
7
+ ### Key Features
8
+
9
+ * Intelligent code generation for Syncfusion<sup style="font-size:70%">&reg;</sup> Javascript controls.
10
+ * Detailed control documentation and usage examples.
11
+ * Troubleshooting assistance for common integration challenges.
12
+
13
+ ## Prerequisites
14
+
15
+ Before using SyncfusionJavaScriptAssistant, ensure you have:
16
+
17
+ * Required [node](https://nodejs.org/en/) version >= 18
18
+ * A [compatible MCP client](https://modelcontextprotocol.io/clients) (VS Code with GitHub Copilot, [Syncfusion<sup style="font-size:70%">&reg;</sup> CodeStudio](https://www.syncfusion.com/code-studio/), etc.)
19
+ * An active Syncfusion<sup style="font-size:70%">&reg;</sup> license (any of the following):
20
+ - [Commercial License](https://www.syncfusion.com/sales/unlimitedlicense)
21
+ - [Free Community License](https://www.syncfusion.com/products/communitylicense)
22
+ - [Free Trial](https://www.syncfusion.com/account/manage-trials/start-trials)
23
+ * An active [API KEY](https://syncfusion.com/account/api-key)
24
+
25
+ ## Unlimited Access
26
+
27
+ Syncfusion<sup style="font-size:70%">&reg;</sup> offers unlimited access to this MCP server. There are no restrictions on:
28
+
29
+ * Number of requests
30
+ * Controls usage
31
+ * Query caps
32
+ * Usage duration
33
+
34
+ This ensures users can fully leverage Syncfusion<sup style="font-size:70%">&reg;</sup> controls to enhance their development experience without limitations.
35
+
36
+ ## Installation
37
+
38
+ Before you can invoke the `SyncfusionJavaScriptAssistant` MCP server, you need to configure your MCP client with these core settings. The **Generic MCP Server Settings** shown below are identical across all clients:
39
+
40
+ ### Generic MCP Server Settings
41
+
42
+ - **npm package name**: `@syncfusion/javascript-assistant`
43
+ - **Type**: stdio (standard input/output transport)
44
+ - **Command**: npx
45
+ - **Arguments**: -y
46
+ - **Server name**: SyncfusionJavaScriptAssistant
47
+
48
+ You need to add your [Syncfusion API key](https://syncfusion.com/account/api-key) as an env parameter in the configuration file:
49
+
50
+ ```json
51
+ "env": {
52
+ "Syncfusion_API_Key": "YOUR_API_KEY"
53
+ }
54
+ ```
55
+
56
+ SyncfusionJavaScriptAssistant can be configured in various MCP clients. Below are setup instructions for popular environment:
57
+
58
+ ### Syncfusion<sup style="font-size:70%">&reg;</sup> Code Studio
59
+
60
+ * In [Code Studio](https://www.syncfusion.com/code-studio/), open MCP Marketplace, find `SyncfusionJavaScriptAssistant`, and click Install.
61
+ * When prompted, enter your [Syncfusion API key](https://syncfusion.com/account/api-key) and click Submit to register.
62
+ * It installs locally on your machine and appears in the Installed list.
63
+ * The server is now ready for use in Code Studio. For more details, refer to the Code Studio [documentation](https://help.syncfusion.com/code-studio/reference/configure-properties/mcp/marketplace).
64
+
65
+ ### VS Code (GitHub Copilot MCP)
66
+
67
+ 1. To configure an MCP server for a specific workspace, you can create a `.vscode/mcp.json` file in your workspace folder.
68
+
69
+ ```json
70
+ {
71
+ "servers": {
72
+ "syncfusion-javascript-assistant": {
73
+ "type": "stdio",
74
+ "command": "npx",
75
+ "args": [
76
+ "-y",
77
+ "@syncfusion/javascript-assistant@latest"
78
+ ],
79
+ "env": {
80
+ "Syncfusion_API_Key": "YOUR_API_KEY"
81
+ }
82
+ }
83
+ }
84
+ }
85
+ ```
86
+
87
+ 2. After updating the configuration in mcp.json, you'll notice a "Start" option at the top of the config. This allows you to easily start the SyncfusionJavaScriptAssistant server directly from the settings interface without additional commands.
88
+
89
+ 3. Confirm that SyncfusionJavaScriptAssistant is being used (this does not happen automatically). Look for a statement in the output, which is similar to:
90
+ * `SyncfusionJavaScriptAssistant is running...` (in VS Code)
91
+
92
+ ### Cursor
93
+
94
+ To configure an MCP server for a specific workspace, you can create a .cursor/mcp.json file in your workspace folder.
95
+
96
+ ```json
97
+ {
98
+ "mcpServers": {
99
+ "syncfusion-javascript-assistant": {
100
+ "type": "stdio",
101
+ "command": "npx",
102
+ "args": [
103
+ "-y",
104
+ "@syncfusion/javascript-assistant@latest"
105
+ ],
106
+ "env": {
107
+ "Syncfusion_API_Key": "YOUR_API_KEY"
108
+ }
109
+ }
110
+ }
111
+ }
112
+ ```
113
+
114
+ ### JetBrains IDEs
115
+
116
+ 1. Go to Settings -> Tools -> AI Assistant -> Model Context Protocol (MCP).
117
+ 2. Click + Add to add a new MCP server configuration.
118
+ 3. In the New MCP Server dialog, switch the dropdown as `As JSON` and add the following config:
119
+
120
+ ```json
121
+ {
122
+ "mcpServers": {
123
+ "syncfusion-javascript-assistant": {
124
+ "command": "npx",
125
+ "args": [
126
+ "-y",
127
+ "@syncfusion/javascript-assistant@latest"
128
+ ],
129
+ "env": {
130
+ "Syncfusion_API_Key": "YOUR_API_KEY"
131
+ }
132
+ }
133
+ }
134
+ }
135
+ ```
136
+
137
+ 4. Click OK and Apply.
138
+
139
+ For additional configuration details, refer to:
140
+ * [VS Code](https://code.visualstudio.com/docs/copilot/chat/mcp-servers#_add-an-mcp-server)
141
+ * [Cursor](https://docs.cursor.com/en/context/mcp#using-mcp-json)
142
+ * [JetBrains](https://www.jetbrains.com/help/ai-assistant/mcp.html#connect-to-an-mcp-server)
143
+ * [Windsurf](https://docs.windsurf.com/windsurf/cascade/mcp#mcp-config-json)
144
+
145
+ ## Usage
146
+
147
+ To activate the SyncfusionJavaScriptAssistant MCP server:
148
+
149
+ 1. Start your prompt with one of the following:
150
+ * 'SyncfusionJavaScriptAssistant'
151
+ * '/syncfusion-javascript-assistant'
152
+ * '/syncfusion-javascript'
153
+ * '@syncfusion-javascript'
154
+ * '@ask_syncfusion_javascript'
155
+ * 'ej2-javascript'
156
+
157
+ In VS Code, you can also use #SyncfusionJavaScriptAssistant to explicitly invoke the MCP server.
158
+
159
+ 2. Grant the SyncfusionJavaScriptAssistant MCP server a permission to run for this session, workspace, or always.
160
+ 3. For best results, start a new chat for each new topic to maintain clean context.
161
+
162
+ ### Mode availability
163
+
164
+ Syncfusion<sup style="font-size:70%">&reg;</sup> MCP Servers provide full access to all AI interaction modes — Ask/Chat, Edit, and Agent — across supported MCP clients.
165
+
166
+ ### Best Practices for Effective Usage
167
+
168
+ 1. `Be specific`: Mention both platform and control (e.g., "How do I create a Syncfusion JavaScript Grid with paging and filtering?").
169
+ 2. `Provide context`: Include details about your use case for more targeted solutions.
170
+ 3. `Use descriptive queries`: Avoid vague questions that lack necessary context.
171
+ 4. `Start fresh for new topics`: Begin a new chat session when switching controls or topics.
172
+
173
+ ### Example Queries
174
+
175
+ Here are some effective ways to use SyncfusionJavaScriptAssistant:
176
+
177
+ * "Create a Syncfusion JavaScript Grid control with paging, sorting and filtering."
178
+ * "How do I implement data binding with Syncfusion JavaScript scheduler?"
179
+ * "Show me how to create a dashboard with multiple Syncfusion controls"
180
+
181
+ ## Troubleshooting
182
+
183
+ If you encounter issues:
184
+
185
+ * Verify your API key is correctly configured.
186
+ * Ensure the MCP server is enabled in your client's tools selection.
187
+ * Check that you're using a compatible MCP client version.
188
+ * Try restarting your development environment.
189
+
190
+ ## Support
191
+
192
+ Product support is available through the following mediums.
193
+
194
+ * [Support ticket](https://support.syncfusion.com/support/tickets/create) - Guaranteed Response in 24 hours | Unlimited tickets | Holiday support
195
+ * [Community forum](https://www.syncfusion.com/forums/essential-js2)
196
+ * [Request feature or report bug](https://www.syncfusion.com/feedback/javascript)
197
+ * Live chat
198
+
199
+ ## License
200
+ This is a commercial product and requires a paid license for possession or use. Syncfusion<sup>®</sup> licensed software, including this control, is subject to the terms and conditions of [Syncfusion's EULA](https://www.syncfusion.com/eula/es/). To acquire a license, you can purchase [here](https://www.syncfusion.com/sales/products) or start a free 30-day trial [here](https://www.syncfusion.com/account/manage-trials/start-trials).
201
+ A free [community license](https://www.syncfusion.com/products/communitylicense) is also available for companies and individuals whose organizations have less than $1 million USD in annual gross revenue and five or fewer developers.
202
+ © Copyright 2025 Syncfusion<sup>®</sup> Inc. All Rights Reserved. The Syncfusion<sup>®</sup> Essential Studio<sup>®</sup> license and copyright applies to this distribution.
203
+ The Syncfusion<sup>®</sup> Essential<sup>®</sup> Studio license and copyright applies to this distribution.
package/dist/index.js ADDED
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { SyncfusionJavaScriptAssistantTool } from "./tools/javascript.js";
5
+ import { toolRegistry } from "./utils/toolRegistry.js";
6
+ // Register tools in the registry
7
+ toolRegistry.register(SyncfusionJavaScriptAssistantTool);
8
+ async function runServer() {
9
+ const server = new McpServer({
10
+ name: "SyncfusionJavaScriptAssistant",
11
+ version: "0.1.0"
12
+ });
13
+ for (const tool of toolRegistry.getAll()) {
14
+ server.tool(tool.name, tool.description, tool.inputSchema, tool.handler);
15
+ }
16
+ const transport = new StdioServerTransport();
17
+ // Set up the transport to listen for incoming messages
18
+ const shutdown = async (signal) => {
19
+ console.info(`Received ${signal}. Shutting down server...`);
20
+ try {
21
+ await transport.close();
22
+ console.info('Server shut down successfully.');
23
+ process.exit(0);
24
+ }
25
+ catch (error) {
26
+ console.error(error, 'Error during server shutdown.');
27
+ process.exit(1);
28
+ }
29
+ };
30
+ // Handle shutdown signals and errors
31
+ process.on('SIGINT', () => shutdown('SIGINT'));
32
+ process.on('SIGTERM', () => shutdown('SIGTERM'));
33
+ process.on('uncaughtException', (error) => {
34
+ console.error('Uncaught exception:', error);
35
+ process.exit(1);
36
+ });
37
+ process.on('unhandledRejection', (reason, promise) => {
38
+ console.error('Unhandled rejection at:', promise, 'reason:', reason);
39
+ process.exit(1);
40
+ });
41
+ // Start the server and listen for incoming messages on stdin
42
+ await server.connect(transport);
43
+ process.stderr.write("[INFO] SyncfusionJavaScriptAssistant is running...\n");
44
+ }
45
+ runServer().catch((error) => {
46
+ console.error(`Server error: ${error}`);
47
+ process.exit(1);
48
+ });
@@ -0,0 +1,57 @@
1
+ import { z } from "zod";
2
+ import { callSyncfusionHelpbotAPI } from "../utils/helpbot.js";
3
+ const TOOL_NAME = "SyncfusionJavaScriptAssistant";
4
+ const TOOL_DESCRIPTION = `
5
+ The ${TOOL_NAME} helps you with Syncfusion UI for JavaScript development questions and provides documentation references. This tool is useful when you need assistance with:
6
+
7
+ 1. Understanding specific Syncfusion JavaScript controls like Grid, Chart, Scheduler, DatePicker, etc.
8
+ 2. Implementation techniques for Syncfusion JavaScript controls.
9
+
10
+ Provide your detailed question in the 'query' parameter. When your question involves specific Syncfusion JavaScript controls it will detect control references for retrieving relevant documentation and assistance.
11
+ This tool understands the context based on the context MCP client will send the proper query to this server.
12
+ This tool can be automatically triggered when any of the following phrases are detected in the user's input:
13
+ - 'SyncfusionJavaScriptAssistant'
14
+ - '/syncfusion-javascript-assistant'
15
+ - '/syncfusion-javascript'
16
+ - '@syncfusion-javascript'
17
+ - '@ask_syncfusion_javascript'
18
+ - 'ej2-javascript'
19
+ `;
20
+ // Define the input schema shape for the tool
21
+ const inputSchema = {
22
+ query: z.string().describe("The query used to search for Syncfusion JavaScript controls, features, or realworld use cases of Syncfusion controls"),
23
+ controls: z.string().optional().describe("Retrieve the controls list information from the user query make sure to separate controls using , .")
24
+ };
25
+ export const SyncfusionJavaScriptAssistantTool = {
26
+ name: TOOL_NAME,
27
+ description: TOOL_DESCRIPTION,
28
+ inputSchema,
29
+ handler: async ({ query, controls }) => {
30
+ try {
31
+ const result = await callSyncfusionHelpbotAPI(query, 'JavaScript', controls);
32
+ if ('error' in result) {
33
+ if (result.error.includes("401")) {
34
+ return resHandler(`❌ Request failed due to an invalid API key. Please try again with the valid API key.`);
35
+ }
36
+ return resHandler(`❌ Request failed (status ${result.status}): ${result.error}`);
37
+ }
38
+ const systemPrompt = 'Include this information in context for more accurate response generation: ';
39
+ return resHandler(systemPrompt + result.data);
40
+ }
41
+ catch (error) {
42
+ console.error(`Error during Syncfusion JavaScript Assistant processing for query "${query}":`, error);
43
+ const errorMessage = error instanceof Error ? error.message : String(error);
44
+ return resHandler(`❌ An error occurred while processing the request: ${errorMessage}`);
45
+ }
46
+ }
47
+ };
48
+ const resHandler = (msg) => {
49
+ return {
50
+ content: [
51
+ {
52
+ type: 'text',
53
+ text: msg,
54
+ }
55
+ ]
56
+ };
57
+ };
@@ -0,0 +1,24 @@
1
+ import axios from 'axios';
2
+ const apiKey = process.env.Syncfusion_API_Key || "";
3
+ export async function callSyncfusionHelpbotAPI(query, platform, controls) {
4
+ try {
5
+ const resp = await axios.post("https://helpbot.syncfusion.com/api/documents/search", { "query": `${query} ${controls}`, "platform": platform, "tool": "javascript-mcp" }, {
6
+ headers: {
7
+ "Content-Type": "application/json",
8
+ "API-Key": apiKey
9
+ }
10
+ });
11
+ const text = JSON.stringify(resp.data, null, 2);
12
+ return { data: text, status: resp.status };
13
+ }
14
+ catch (err) {
15
+ if (axios.isAxiosError(err)) {
16
+ const status = err.response?.status ?? 0;
17
+ const message = (typeof err.response?.data === 'string'
18
+ ? err.response.data
19
+ : JSON.stringify(err.response?.data)) || err.message;
20
+ return { error: message, status };
21
+ }
22
+ return { error: err.message, status: 0 };
23
+ }
24
+ }
@@ -0,0 +1,13 @@
1
+ export class ToolRegistry {
2
+ tools = new Map();
3
+ register(tool) {
4
+ this.tools.set(tool.name, tool);
5
+ }
6
+ getAll() {
7
+ return Array.from(this.tools.values());
8
+ }
9
+ getTool(name) {
10
+ return this.tools.get(name);
11
+ }
12
+ }
13
+ export const toolRegistry = new ToolRegistry();
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@syncfusion/javascript-assistant",
3
+ "version": "0.1.0",
4
+ "description": "MCP server that provides efficient access to Syncfusion documentation, implementation guidelines, and code generation for JavaScript",
5
+ "type": "module",
6
+ "bin": {
7
+ "javascript-assistant": "./dist/index.js"
8
+ },
9
+ "keywords": [
10
+ "MCP Server",
11
+ "Model Context Protocol",
12
+ "JavaScript",
13
+ "Syncfusion",
14
+ "AI",
15
+ "Copilot",
16
+ "SyncfusionJavaScript"
17
+ ],
18
+ "files": [
19
+ "dist",
20
+ "assets"
21
+ ],
22
+ "dependencies": {
23
+ "@modelcontextprotocol/sdk": "1.13.2",
24
+ "axios": "1.12.1"
25
+ },
26
+ "scripts": {
27
+ "build": "tsc",
28
+ "start": "tsc",
29
+ "inspector": "npx @modelcontextprotocol/inspector dist/index.js"
30
+ }
31
+ }