@syncfusion/pdfviewersdk-assistant 1.0.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 +247 -0
- package/dist/index.js +48 -0
- package/dist/tools/pdfviewersdk.js +56 -0
- package/dist/utils/helpbot.js +31 -0
- package/dist/utils/toolRegistry.js +13 -0
- package/package.json +27 -0
package/README.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# SyncfusionPDFViewerSDKAssistant MCP Server
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The **SyncfusionPDFViewerSDKAssistant** is a specialized [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server that provides intelligent, context-aware coding assistance for Syncfusion **PDFViewerSDK** across all supported platforms:
|
|
6
|
+
|
|
7
|
+
- ASP.NET Core
|
|
8
|
+
- ASP.NET MVC
|
|
9
|
+
- Angular
|
|
10
|
+
- React
|
|
11
|
+
- Vue
|
|
12
|
+
- JavaScript (ES5)
|
|
13
|
+
- JavaScript (ES6)
|
|
14
|
+
- UWP
|
|
15
|
+
- Windows Forms
|
|
16
|
+
- WPF
|
|
17
|
+
- Blazor
|
|
18
|
+
|
|
19
|
+
It integrates seamlessly with [MCP clients](https://modelcontextprotocol.io/clients) to provide intelligent assistance for building applications with Syncfusion<sup style="font-size:70%">®</sup> components.
|
|
20
|
+
|
|
21
|
+
### Key Benefits
|
|
22
|
+
|
|
23
|
+
- Instant code generation & explanations for Syncfusion<sup style="font-size:70%">®</sup> PdfViewerDK
|
|
24
|
+
- Detailed component documentation and usage examples.
|
|
25
|
+
- Troubleshooting assistance for common integration challenges.
|
|
26
|
+
|
|
27
|
+
## Prerequisites
|
|
28
|
+
|
|
29
|
+
Before using SyncfusionPDFViewerSDKAssistant, ensure you have:
|
|
30
|
+
|
|
31
|
+
* Required [node](https://nodejs.org/en/) version >= 18
|
|
32
|
+
* A [compatible MCP client](https://modelcontextprotocol.io/clients) (VS Code with GitHub Copilot, [Syncfusion<sup style="font-size:70%">®</sup> CodeStudio](https://www.syncfusion.com/code-studio/), etc.)
|
|
33
|
+
* An active Syncfusion<sup style="font-size:70%">®</sup> license (any of the following):
|
|
34
|
+
- [Commercial License](https://www.syncfusion.com/sales/unlimitedlicense)
|
|
35
|
+
- [Free Community License](https://www.syncfusion.com/products/communitylicense)
|
|
36
|
+
- [Free Trial](https://www.syncfusion.com/account/manage-trials/start-trials)
|
|
37
|
+
* An active [API KEY](https://syncfusion.com/account/api-key)
|
|
38
|
+
|
|
39
|
+
## Unlimited Access
|
|
40
|
+
|
|
41
|
+
Syncfusion<sup style="font-size:70%">®</sup> offers unlimited access to this MCP server. There are no restrictions on:
|
|
42
|
+
|
|
43
|
+
* Number of requests
|
|
44
|
+
* Components usage
|
|
45
|
+
* Query types
|
|
46
|
+
* Usage duration
|
|
47
|
+
|
|
48
|
+
This ensures users can fully leverage Syncfusion<sup style="font-size:70%">®</sup> components to enhance their development experience without limitations.
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
Before you can invoke the `SyncfusionPDFViewerSDKAssistant` 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:
|
|
53
|
+
|
|
54
|
+
### Generic MCP Server Settings
|
|
55
|
+
|
|
56
|
+
- **npm package name**: `@syncfusion/pdfviewersdk-assistant`
|
|
57
|
+
- **Type**: stdio (standard input/output transport)
|
|
58
|
+
- **Command**: npx
|
|
59
|
+
- **Arguments**: -y
|
|
60
|
+
- **Server name**: SyncfusionPDFViewerSDKAssistant
|
|
61
|
+
|
|
62
|
+
## API Key Configuration
|
|
63
|
+
|
|
64
|
+
Login to your [Syncfusion account](http://syncfusion.com/account/) and generate an API Key from the [API Key page](https://www.syncfusion.com/account/api-key). Replace `YOUR_API_KEY_FILE_PATH` or `YOUR_API_KEY` in the configuration files with your generated key.
|
|
65
|
+
|
|
66
|
+
There are two options:
|
|
67
|
+
|
|
68
|
+
* **Using an API Key File (Recommended)**
|
|
69
|
+
|
|
70
|
+
Store your API key in a separate file and reference its path in the Syncfusion_API_Key_Path environment parameter. This approach is more secure as you don't expose the key directly in configuration files.
|
|
71
|
+
|
|
72
|
+
**Supported file formats:** `.txt` or `.key` file
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
"env": {
|
|
76
|
+
"Syncfusion_API_Key_Path": "YOUR_API_KEY_FILE_PATH" // "D:\\syncfusion-key.txt" (or) "D:\\syncfusion-key.key"
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
* **Direct API Key**
|
|
81
|
+
|
|
82
|
+
Paste your `Syncfusion_API_Key` directly in the configuration file's environment parameter.
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
"env": {
|
|
86
|
+
"Syncfusion_API_Key": "YOUR_API_KEY"
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
[SyncfusionPDFViewerSDKAssistant](https://www.npmjs.com/package/@syncfusion/pdfviewersdk-assistant) can be configured in various MCP clients. Below are setup instructions for popular environment:
|
|
91
|
+
|
|
92
|
+
### Syncfusion<sup style="font-size:70%">®</sup> Code Studio
|
|
93
|
+
|
|
94
|
+
* In [Code Studio](https://www.syncfusion.com/code-studio/), open MCP Marketplace and navigate to the ```Custom Servers``` tab.
|
|
95
|
+
* Enter the Server Name as ```pdfviewersdk-mcp```, choose Server Type as npm package, and set the NPM Package name to ```@syncfusion/pdfviewersdk-assistant```.
|
|
96
|
+
* Add an environment variable as ```Syncfusion_API_Key``` and value as your [Syncfusion API key](https://syncfusion.com/account/api-key), then click **Install Server**.
|
|
97
|
+
* Once installed, the server will appear in the User Installed Server list and will be added to the **config.yaml** file.
|
|
98
|
+
* 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/customservers).
|
|
99
|
+
|
|
100
|
+
### VS Code (GitHub Copilot MCP)
|
|
101
|
+
|
|
102
|
+
* To configure an MCP server for a specific workspace, you can create a `.vscode/mcp.json` file in your workspace folder.
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"servers": {
|
|
107
|
+
"syncfusion-pdfviewersdk-assistant": {
|
|
108
|
+
"type": "stdio",
|
|
109
|
+
"command": "npx",
|
|
110
|
+
"args": [
|
|
111
|
+
"-y",
|
|
112
|
+
"@syncfusion/pdfviewersdk-assistant@latest"
|
|
113
|
+
],
|
|
114
|
+
"env": {
|
|
115
|
+
"Syncfusion_API_Key_Path": "YOUR_API_KEY_FILE_PATH",
|
|
116
|
+
// or
|
|
117
|
+
"Syncfusion_API_Key": "YOUR_API_KEY"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
* 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 [SyncfusionPDFViewerSDKAssistant](https://www.npmjs.com/package/@syncfusion/pdfviewersdk-assistant) server directly from the settings interface without additional commands.
|
|
125
|
+
|
|
126
|
+
* Confirm that [SyncfusionPDFViewerSDKAssistant](https://www.npmjs.com/package/@syncfusion/pdfviewersdk-assistant) is being used (this does not happen automatically). Look for a statement in the output, which is similar to:
|
|
127
|
+
* `SyncfusionPDFViewerSDKAssistant is running...` (in VS Code)
|
|
128
|
+
|
|
129
|
+
* For more details, refer to the official <a href = "https://learn.microsoft.com/en-us/visualstudio/ide/mcp-servers?view=vs-2022"> Visual Studio documentation</a>.
|
|
130
|
+
|
|
131
|
+
### Cursor
|
|
132
|
+
|
|
133
|
+
To configure an MCP server for a specific workspace, you can create a .cursor/mcp.json file in your workspace folder.
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"mcpServers": {
|
|
138
|
+
"syncfusion-pdfviewersdk-assistant": {
|
|
139
|
+
"type": "stdio",
|
|
140
|
+
"command": "npx",
|
|
141
|
+
"args": [
|
|
142
|
+
"-y",
|
|
143
|
+
"@syncfusion/pdfviewersdk-assistant@latest"
|
|
144
|
+
],
|
|
145
|
+
"env": {
|
|
146
|
+
"Syncfusion_API_Key_Path": "YOUR_API_KEY_FILE_PATH",
|
|
147
|
+
// or
|
|
148
|
+
"Syncfusion_API_Key": "YOUR_API_KEY"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
For more details, refer to the <a href = "https://docs.cursor.com/en/context/mcp#using-mcp-json">Cursor documentation</a>.
|
|
155
|
+
|
|
156
|
+
### JetBrains IDEs
|
|
157
|
+
|
|
158
|
+
1. Go to Settings -> Tools -> AI Assistant -> Model Context Protocol (MCP).
|
|
159
|
+
2. Click + Add to add a new MCP server configuration.
|
|
160
|
+
3. In the New MCP Server dialog, switch the dropdown as `As JSON` and add the following config:
|
|
161
|
+
|
|
162
|
+
```json
|
|
163
|
+
{
|
|
164
|
+
"mcpServers": {
|
|
165
|
+
"syncfusion-pdfviewersdk-assistant": {
|
|
166
|
+
"command": "npx",
|
|
167
|
+
"args": [
|
|
168
|
+
"-y",
|
|
169
|
+
"@syncfusion/pdfviewersdk-assistant@latest"
|
|
170
|
+
],
|
|
171
|
+
"env": {
|
|
172
|
+
"Syncfusion_API_Key_Path": "YOUR_API_KEY_FILE_PATH",
|
|
173
|
+
// or
|
|
174
|
+
"Syncfusion_API_Key": "YOUR_API_KEY"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
4. Click OK and Apply.
|
|
182
|
+
|
|
183
|
+
For further assistance, see the <a href ="https://www.jetbrains.com/help/ai-assistant/mcp.html#connect-to-an-mcp-server">JetBrains documentation</a>.
|
|
184
|
+
|
|
185
|
+
> For more detailed information about configuring MCP servers in various clients, refer to the official documentations, e.g., [Windsurf](https://docs.windsurf.com/windsurf/cascade/mcp#mcp-config-json)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
## Usage
|
|
189
|
+
|
|
190
|
+
To activate the SyncfusionPDFViewerSDKAssistant MCP server:
|
|
191
|
+
|
|
192
|
+
1. Start your prompt with one of the following:
|
|
193
|
+
* 'SyncfusionPDFViewerSDKAssistant'
|
|
194
|
+
* '/syncfusion-pdfviewersdk-assistant'
|
|
195
|
+
* '/syncfusion-pdfviewersdk'
|
|
196
|
+
* '@syncfusion-pdfviewersdk'
|
|
197
|
+
* '@ask_syncfusion_pdfviewersdk'
|
|
198
|
+
|
|
199
|
+
In VS Code, you can also use #SyncfusionPDFViewerSDKAssistant to explicitly invoke the MCP server.
|
|
200
|
+
|
|
201
|
+
2. Grant the SyncfusionPDFViewerSDKAssistant MCP server a permission to run for this session, workspace, or always.
|
|
202
|
+
3. For best results, start a new chat for each new topic to maintain clean context.
|
|
203
|
+
|
|
204
|
+
### Mode availability
|
|
205
|
+
|
|
206
|
+
Syncfusion<sup style="font-size:70%">®</sup> MCP Servers provide full access to all AI interaction modes — Ask/Chat, Edit, and Agent — across supported MCP clients.
|
|
207
|
+
|
|
208
|
+
### Best Practices for Effective Usage
|
|
209
|
+
|
|
210
|
+
1. `Be specific`: Mention both platform and component (e.g., "How do I apply conditional formatting to highlight duplicate values in a React Syncfusion PDFViewer?").
|
|
211
|
+
2. `Provide context`: Include details about your use case for more targeted solutions.
|
|
212
|
+
3. `Use descriptive queries`: Avoid vague questions that lack necessary context.
|
|
213
|
+
4. `Start fresh for new topics`: Begin a new chat session when switching components or topics.
|
|
214
|
+
|
|
215
|
+
### Example Queries
|
|
216
|
+
|
|
217
|
+
Here are some effective ways to use [SyncfusionPDFViewerSDKAssistant](https://www.npmjs.com/package/@syncfusion/pdfviewersdk-assistant):
|
|
218
|
+
|
|
219
|
+
* "Provide View PDF files using the PDF Viewer in a Blazor Web App."
|
|
220
|
+
* "Show me a code snippet to load a PDF from Google Drive into Syncfusion PDF Viewer using React"
|
|
221
|
+
* "How do I toggle the annotation toolbar using Angular PDF Viewer"
|
|
222
|
+
* "Explain how to open the thumbnail panel programmatically in Syncfusion PDF Viewer using Vue."
|
|
223
|
+
* "Provide code to restrict zoom levels between 150% and 300% in Javascript PDF Viewer."
|
|
224
|
+
|
|
225
|
+
## Troubleshooting
|
|
226
|
+
|
|
227
|
+
If you encounter issues:
|
|
228
|
+
|
|
229
|
+
* Verify your API key is correctly configured.
|
|
230
|
+
* Ensure the MCP server is enabled in your client's tools selection.
|
|
231
|
+
* Check that you're using a compatible MCP client version.
|
|
232
|
+
* Try restarting your development environment.
|
|
233
|
+
|
|
234
|
+
## Support
|
|
235
|
+
|
|
236
|
+
Product support is available through the following mediums.
|
|
237
|
+
|
|
238
|
+
* [Support ticket](https://support.syncfusion.com/support/tickets/create) - Guaranteed Response in 24 hours | Unlimited tickets | Holiday support
|
|
239
|
+
* [Community forum](https://www.syncfusion.com/forums/pdf-viewer-sdk)
|
|
240
|
+
* [Request feature or report bug](https://www.syncfusion.com/feedback/pdf-viewer-sdk)
|
|
241
|
+
* Live chat
|
|
242
|
+
|
|
243
|
+
## License
|
|
244
|
+
This is a commercial product and requires a paid license for possession or use. Syncfusion<sup>®</sup> licensed software, including this component, 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).
|
|
245
|
+
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.
|
|
246
|
+
© Copyright 2025 Syncfusion<sup>®</sup> Inc. All Rights Reserved. The Syncfusion<sup>®</sup> Essential Studio<sup>®</sup> license and copyright applies to this distribution.
|
|
247
|
+
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 { SyncfusionPDFViewerSDKAssistantTool } from "./tools/pdfviewersdk.js";
|
|
5
|
+
import { toolRegistry } from "./utils/toolRegistry.js";
|
|
6
|
+
// Register tools in the registry
|
|
7
|
+
toolRegistry.register(SyncfusionPDFViewerSDKAssistantTool);
|
|
8
|
+
async function runServer() {
|
|
9
|
+
const server = new McpServer({
|
|
10
|
+
name: "SyncfusionPDFViewerSDKAssistant",
|
|
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] SyncfusionPDFViewerSDKAssistant is running...\n");
|
|
44
|
+
}
|
|
45
|
+
runServer().catch((error) => {
|
|
46
|
+
console.error(`Server error: ${error}`);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { callSyncfusionHelpbotAPI } from "../utils/helpbot.js";
|
|
3
|
+
const TOOL_NAME = "SyncfusionPDFViewerSDKAssistant";
|
|
4
|
+
const TOOL_DESCRIPTION = `
|
|
5
|
+
The ${TOOL_NAME} helps you with Syncfusion PDFViewerSDK development questions and provides documentation, code samples, and best practices. This tool is useful when you need assistance with:
|
|
6
|
+
|
|
7
|
+
1. PDFViewer component is a GUI component used to view, edit and print PDF files.
|
|
8
|
+
2. Working with PDFViewerSDK in Windows Forms, WPF, JavaScript, Angular, React, Vue, ASP.NET MVC, ASP.NET Core, Blazor, MAUI and Flutter applications that works without Adobe dependencies.
|
|
9
|
+
|
|
10
|
+
Provide your detailed question in the 'query' parameter. When your question involves specific Syncfusion PDFViewerSDK component it will detect component 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
|
+
- 'SyncfusionPDFViewerSDKAssistant'
|
|
14
|
+
- '/syncfusion-pdfviewersdk-assistant'
|
|
15
|
+
- '/syncfusion-pdfviewersdk'
|
|
16
|
+
- '@syncfusion-pdfviewersdk'
|
|
17
|
+
- '@ask_syncfusion_pdfviewersdk'
|
|
18
|
+
`;
|
|
19
|
+
// Define the input schema shape for the tool
|
|
20
|
+
const inputSchema = {
|
|
21
|
+
query: z.string().describe("The query used to search for Syncfusion PDFViewerSDK component, features, or realworld use cases of Syncfusion components"),
|
|
22
|
+
components: z.string().optional().describe("Retrieve the components list information from the user query make sure to separate components using , ."),
|
|
23
|
+
};
|
|
24
|
+
export const SyncfusionPDFViewerSDKAssistantTool = {
|
|
25
|
+
name: TOOL_NAME,
|
|
26
|
+
description: TOOL_DESCRIPTION,
|
|
27
|
+
inputSchema,
|
|
28
|
+
handler: async ({ query, components }) => {
|
|
29
|
+
try {
|
|
30
|
+
const result = await callSyncfusionHelpbotAPI(query, "File Formats", components);
|
|
31
|
+
if ("error" in result) {
|
|
32
|
+
if (result.error.includes("401")) {
|
|
33
|
+
return resHandler(`❌ Request failed due to an invalid API key. Please try again with the valid API key.`);
|
|
34
|
+
}
|
|
35
|
+
return resHandler(`❌ Request failed (status ${result.status}): ${result.error}`);
|
|
36
|
+
}
|
|
37
|
+
const systemPrompt = 'Include this information in context for more accurate response generation: ';
|
|
38
|
+
return resHandler(systemPrompt + result.data);
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
console.error(`Error in Syncfusion PDFViewerSDK Assistant for query "${query}":`, error);
|
|
42
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
43
|
+
return resHandler(`❌ An error occurred while processing the request: ${errorMessage}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const resHandler = (msg) => {
|
|
48
|
+
return {
|
|
49
|
+
content: [
|
|
50
|
+
{
|
|
51
|
+
type: "text",
|
|
52
|
+
text: msg,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
};
|
|
56
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
let apiKey;
|
|
4
|
+
if (process.env.Syncfusion_API_Key_Path) {
|
|
5
|
+
apiKey = readFileSync(process.env.Syncfusion_API_Key_Path, 'utf8');
|
|
6
|
+
}
|
|
7
|
+
else {
|
|
8
|
+
apiKey = process.env.Syncfusion_API_Key || "";
|
|
9
|
+
}
|
|
10
|
+
export async function callSyncfusionHelpbotAPI(query, platform, components) {
|
|
11
|
+
try {
|
|
12
|
+
const resp = await axios.post("https://helpbot.syncfusion.com/api/documents/search", { "query": `${query} ${components}`, "platform": platform, "tool": "pdfviewersdk-mcp" }, {
|
|
13
|
+
headers: {
|
|
14
|
+
"Content-Type": "application/json",
|
|
15
|
+
"API-Key": apiKey
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
const text = JSON.stringify(resp.data, null, 2);
|
|
19
|
+
return { data: text, status: resp.status };
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
if (axios.isAxiosError(err)) {
|
|
23
|
+
const status = err.response?.status ?? 0;
|
|
24
|
+
const message = (typeof err.response?.data === 'string'
|
|
25
|
+
? err.response.data
|
|
26
|
+
: JSON.stringify(err.response?.data)) || err.message;
|
|
27
|
+
return { error: message, status };
|
|
28
|
+
}
|
|
29
|
+
return { error: err.message, status: 0 };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -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,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@syncfusion/pdfviewersdk-assistant",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MCP server that provides efficient access to Syncfusion documentation, implementation guidelines, and code generation for pdfviewerSDK",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "SEE LICENSE IN license",
|
|
7
|
+
"bin": {
|
|
8
|
+
"pdfviewersdk-assistant": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"MCP Server",
|
|
12
|
+
"Model Context Protocol",
|
|
13
|
+
"pdfviewerSDK",
|
|
14
|
+
"Syncfusion",
|
|
15
|
+
"AI",
|
|
16
|
+
"Copilot",
|
|
17
|
+
"SyncfusionpdfviewerSDK"
|
|
18
|
+
],
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"assets"
|
|
22
|
+
],
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@modelcontextprotocol/sdk": "1.23.0",
|
|
25
|
+
"axios": "1.13.2"
|
|
26
|
+
}
|
|
27
|
+
}
|