@knowledgesdk/mcp 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.
Files changed (40) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +151 -0
  3. package/dist/src/index.d.ts +16 -0
  4. package/dist/src/index.d.ts.map +1 -0
  5. package/dist/src/index.js +51 -0
  6. package/dist/src/index.js.map +1 -0
  7. package/dist/src/lib/config.d.ts +6 -0
  8. package/dist/src/lib/config.d.ts.map +1 -0
  9. package/dist/src/lib/config.js +49 -0
  10. package/dist/src/lib/config.js.map +1 -0
  11. package/dist/src/tools/classifyBusiness.d.ts +16 -0
  12. package/dist/src/tools/classifyBusiness.d.ts.map +1 -0
  13. package/dist/src/tools/classifyBusiness.js +62 -0
  14. package/dist/src/tools/classifyBusiness.js.map +1 -0
  15. package/dist/src/tools/extractKnowledge.d.ts +19 -0
  16. package/dist/src/tools/extractKnowledge.d.ts.map +1 -0
  17. package/dist/src/tools/extractKnowledge.js +67 -0
  18. package/dist/src/tools/extractKnowledge.js.map +1 -0
  19. package/dist/src/tools/getSitemap.d.ts +16 -0
  20. package/dist/src/tools/getSitemap.d.ts.map +1 -0
  21. package/dist/src/tools/getSitemap.js +51 -0
  22. package/dist/src/tools/getSitemap.js.map +1 -0
  23. package/dist/src/tools/index.d.ts +12 -0
  24. package/dist/src/tools/index.d.ts.map +1 -0
  25. package/dist/src/tools/index.js +188 -0
  26. package/dist/src/tools/index.js.map +1 -0
  27. package/dist/src/tools/scrapePage.d.ts +16 -0
  28. package/dist/src/tools/scrapePage.d.ts.map +1 -0
  29. package/dist/src/tools/scrapePage.js +37 -0
  30. package/dist/src/tools/scrapePage.js.map +1 -0
  31. package/dist/src/tools/searchKnowledge.d.ts +19 -0
  32. package/dist/src/tools/searchKnowledge.d.ts.map +1 -0
  33. package/dist/src/tools/searchKnowledge.js +82 -0
  34. package/dist/src/tools/searchKnowledge.js.map +1 -0
  35. package/dist/src/tools/takeScreenshot.d.ts +22 -0
  36. package/dist/src/tools/takeScreenshot.d.ts.map +1 -0
  37. package/dist/src/tools/takeScreenshot.js +52 -0
  38. package/dist/src/tools/takeScreenshot.js.map +1 -0
  39. package/package.json +61 -0
  40. package/stdio.js +52 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 KnowledgeSDK
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,151 @@
1
+ # @knowledgesdk/mcp
2
+
3
+ Official [KnowledgeSDK](https://knowledgesdk.com) Model Context Protocol (MCP) Server.
4
+
5
+ Gives AI assistants the ability to extract structured knowledge from websites, scrape pages to markdown, classify businesses, discover sitemaps, take screenshots, and search a semantic knowledge base — all via the KnowledgeSDK API.
6
+
7
+ ## Tools
8
+
9
+ | Tool | Description |
10
+ |---|---|
11
+ | `extract_knowledge` | Extract structured knowledge from any website URL. Returns business classification, product features, pricing, and key insights. |
12
+ | `scrape_page` | Scrape any webpage and return clean markdown content. Perfect for reading documentation, articles, or any web content. |
13
+ | `classify_business` | Classify a business from its website URL. Returns type, industry, target audience, value proposition, and key insights. |
14
+ | `get_sitemap` | Discover all pages on a website via its sitemap. Returns a list of URLs for further processing. |
15
+ | `take_screenshot` | Take a full-page screenshot of any URL. Returns a base64-encoded PNG image. |
16
+ | `search_knowledge` | Search your extracted knowledge base using natural language. Returns relevant knowledge items ranked by semantic similarity. |
17
+
18
+ ## Requirements
19
+
20
+ - Node.js >= 18
21
+ - A KnowledgeSDK API key — get one at [knowledgesdk.com/dashboard](https://knowledgesdk.com/dashboard)
22
+
23
+ ---
24
+
25
+ ## Setup with Claude Desktop
26
+
27
+ 1. Open your Claude Desktop configuration file:
28
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
29
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
30
+
31
+ 2. Add the following to the `mcpServers` section:
32
+
33
+ ```json
34
+ {
35
+ "mcpServers": {
36
+ "knowledgesdk": {
37
+ "command": "npx",
38
+ "args": ["-y", "@knowledgesdk/mcp"],
39
+ "env": {
40
+ "KNOWLEDGESDK_API_KEY": "sk_ks_your_key_here"
41
+ }
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ 3. Restart Claude Desktop.
48
+
49
+ You should now see the KnowledgeSDK tools available in your Claude Desktop conversations.
50
+
51
+ ---
52
+
53
+ ## Setup with Cursor
54
+
55
+ 1. Open Cursor Settings → Features → MCP Servers.
56
+ 2. Click **+ Add new MCP server**.
57
+ 3. Choose **stdio** as the transport type.
58
+ 4. Enter the following command:
59
+
60
+ ```
61
+ npx -y @knowledgesdk/mcp
62
+ ```
63
+
64
+ 5. Add the environment variable:
65
+
66
+ ```
67
+ KNOWLEDGESDK_API_KEY=sk_ks_your_key_here
68
+ ```
69
+
70
+ Alternatively, edit `~/.cursor/mcp.json` directly:
71
+
72
+ ```json
73
+ {
74
+ "mcpServers": {
75
+ "knowledgesdk": {
76
+ "command": "npx",
77
+ "args": ["-y", "@knowledgesdk/mcp"],
78
+ "env": {
79
+ "KNOWLEDGESDK_API_KEY": "sk_ks_your_key_here"
80
+ }
81
+ }
82
+ }
83
+ }
84
+ ```
85
+
86
+ ---
87
+
88
+ ## Setup with Windsurf
89
+
90
+ 1. Open Windsurf Settings → Cascade → MCP Servers.
91
+ 2. Click **Add Server** and select **Command**.
92
+ 3. Configure as follows:
93
+
94
+ ```json
95
+ {
96
+ "mcpServers": {
97
+ "knowledgesdk": {
98
+ "command": "npx",
99
+ "args": ["-y", "@knowledgesdk/mcp"],
100
+ "env": {
101
+ "KNOWLEDGESDK_API_KEY": "sk_ks_your_key_here"
102
+ }
103
+ }
104
+ }
105
+ }
106
+ ```
107
+
108
+ Or edit `~/.codeium/windsurf/mcp_config.json` directly with the same JSON block above.
109
+
110
+ ---
111
+
112
+ ## Environment Variables
113
+
114
+ | Variable | Required | Description |
115
+ |---|---|---|
116
+ | `KNOWLEDGESDK_API_KEY` | Yes | Your KnowledgeSDK API key |
117
+ | `KNOWLEDGESDK_BASE_URL` | No | Override the API base URL (default: `https://api.knowledgesdk.com`) |
118
+
119
+ ---
120
+
121
+ ## Example Usage
122
+
123
+ Once configured, you can ask your AI assistant:
124
+
125
+ - "Extract knowledge from https://stripe.com"
126
+ - "Scrape the page at https://docs.example.com/getting-started"
127
+ - "Classify the business at https://linear.app"
128
+ - "Get the sitemap for https://vercel.com"
129
+ - "Take a screenshot of https://github.com"
130
+ - "Search my knowledge base for 'pricing plans'"
131
+
132
+ ---
133
+
134
+ ## Development
135
+
136
+ ```bash
137
+ # Install dependencies
138
+ npm install
139
+
140
+ # Build TypeScript
141
+ npm run build
142
+
143
+ # Test the stdio server locally (requires KNOWLEDGESDK_API_KEY)
144
+ KNOWLEDGESDK_API_KEY=sk_ks_your_key npm run test:local
145
+ ```
146
+
147
+ ---
148
+
149
+ ## License
150
+
151
+ MIT
@@ -0,0 +1,16 @@
1
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
+ export interface McpServerOptions {
3
+ verboseLogs?: boolean;
4
+ }
5
+ /**
6
+ * Create a KnowledgeSDK MCP server
7
+ * Returns a configured Server instance ready to be connected to a transport
8
+ */
9
+ export declare const createKnowledgeSdkMcpServer: (options?: McpServerOptions) => Server;
10
+ export * from "./tools/extractKnowledge";
11
+ export * from "./tools/scrapePage";
12
+ export * from "./tools/classifyBusiness";
13
+ export * from "./tools/getSitemap";
14
+ export * from "./tools/takeScreenshot";
15
+ export * from "./tools/searchKnowledge";
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B,GACtC,UAAS,gBAAqB,KAC7B,MA0BF,CAAC;AAGF,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.createKnowledgeSdkMcpServer = void 0;
18
+ const config_1 = require("./lib/config");
19
+ const tools_1 = require("./tools");
20
+ const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
21
+ /**
22
+ * Create a KnowledgeSDK MCP server
23
+ * Returns a configured Server instance ready to be connected to a transport
24
+ */
25
+ const createKnowledgeSdkMcpServer = (options = {}) => {
26
+ if (!(0, config_1.hasApiKey)()) {
27
+ console.warn("KNOWLEDGESDK_API_KEY is not set. Tools will return errors when called.");
28
+ }
29
+ if (options.verboseLogs) {
30
+ console.error("KnowledgeSDK MCP Server: verbose logs enabled");
31
+ }
32
+ const server = new index_js_1.Server({
33
+ name: "@knowledgesdk/mcp",
34
+ version: "0.1.0",
35
+ }, {
36
+ capabilities: {
37
+ tools: {},
38
+ },
39
+ });
40
+ (0, tools_1.setupTools)(server);
41
+ return server;
42
+ };
43
+ exports.createKnowledgeSdkMcpServer = createKnowledgeSdkMcpServer;
44
+ // Re-export types for convenience
45
+ __exportStar(require("./tools/extractKnowledge"), exports);
46
+ __exportStar(require("./tools/scrapePage"), exports);
47
+ __exportStar(require("./tools/classifyBusiness"), exports);
48
+ __exportStar(require("./tools/getSitemap"), exports);
49
+ __exportStar(require("./tools/takeScreenshot"), exports);
50
+ __exportStar(require("./tools/searchKnowledge"), exports);
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yCAAyC;AACzC,mCAAqC;AACrC,wEAAmE;AAMnE;;;GAGG;AACI,MAAM,2BAA2B,GAAG,CACzC,UAA4B,EAAE,EACtB,EAAE;IACV,IAAI,CAAC,IAAA,kBAAS,GAAE,EAAE,CAAC;QACjB,OAAO,CAAC,IAAI,CACV,wEAAwE,CACzE,CAAC;IACJ,CAAC;IAED,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,iBAAM,CACvB;QACE,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,OAAO;KACjB,EACD;QACE,YAAY,EAAE;YACZ,KAAK,EAAE,EAAE;SACV;KACF,CACF,CAAC;IAEF,IAAA,kBAAU,EAAC,MAAM,CAAC,CAAC;IAEnB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AA5BW,QAAA,2BAA2B,+BA4BtC;AAEF,kCAAkC;AAClC,2DAAyC;AACzC,qDAAmC;AACnC,2DAAyC;AACzC,qDAAmC;AACnC,yDAAuC;AACvC,0DAAwC"}
@@ -0,0 +1,6 @@
1
+ export declare const BASE_URL: string;
2
+ export declare const hasApiKey: () => boolean;
3
+ export declare const getApiKey: () => string;
4
+ export declare const getHeaders: () => Record<string, string>;
5
+ export declare function callApi<T = any>(path: string, body: Record<string, any>): Promise<T>;
6
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/lib/config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,QACgD,CAAC;AAEtE,eAAO,MAAM,SAAS,eAErB,CAAC;AAEF,eAAO,MAAM,SAAS,QAAO,MAO5B,CAAC;AAEF,eAAO,MAAM,UAAU,QAAO,MAAM,CAAC,MAAM,EAAE,MAAM,CAKlD,CAAC;AAEF,wBAAsB,OAAO,CAAC,CAAC,GAAG,GAAG,EACnC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACxB,OAAO,CAAC,CAAC,CAAC,CAwBZ"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getHeaders = exports.getApiKey = exports.hasApiKey = exports.BASE_URL = void 0;
4
+ exports.callApi = callApi;
5
+ exports.BASE_URL = process.env.KNOWLEDGESDK_BASE_URL || "https://api.knowledgesdk.com";
6
+ const hasApiKey = () => {
7
+ return !!process.env.KNOWLEDGESDK_API_KEY;
8
+ };
9
+ exports.hasApiKey = hasApiKey;
10
+ const getApiKey = () => {
11
+ if (!process.env.KNOWLEDGESDK_API_KEY) {
12
+ throw new Error("KNOWLEDGESDK_API_KEY environment variable is not set. Please set it before using this tool.");
13
+ }
14
+ return process.env.KNOWLEDGESDK_API_KEY;
15
+ };
16
+ exports.getApiKey = getApiKey;
17
+ const getHeaders = () => {
18
+ return {
19
+ "x-api-key": (0, exports.getApiKey)(),
20
+ "Content-Type": "application/json",
21
+ };
22
+ };
23
+ exports.getHeaders = getHeaders;
24
+ async function callApi(path, body) {
25
+ const url = `${exports.BASE_URL}${path}`;
26
+ const response = await fetch(url, {
27
+ method: "POST",
28
+ headers: (0, exports.getHeaders)(),
29
+ body: JSON.stringify(body),
30
+ });
31
+ if (!response.ok) {
32
+ let errorMessage = `HTTP ${response.status}: ${response.statusText}`;
33
+ try {
34
+ const errorBody = await response.json();
35
+ if (typeof errorBody.message === "string") {
36
+ errorMessage = errorBody.message;
37
+ }
38
+ else if (typeof errorBody.error === "string") {
39
+ errorMessage = errorBody.error;
40
+ }
41
+ }
42
+ catch {
43
+ // ignore JSON parse errors on error response
44
+ }
45
+ throw new Error(errorMessage);
46
+ }
47
+ return response.json();
48
+ }
49
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/lib/config.ts"],"names":[],"mappings":";;;AAuBA,0BA2BC;AAlDY,QAAA,QAAQ,GACnB,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,8BAA8B,CAAC;AAE/D,MAAM,SAAS,GAAG,GAAG,EAAE;IAC5B,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC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C;QAAC,MAAM,CAAC;YACP,6CAA6C;QAC/C,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,EAAgB,CAAC;AACvC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ export declare const ClassifyBusinessSchema: z.ZodObject<{
3
+ url: z.ZodString;
4
+ }, "strip", z.ZodTypeAny, {
5
+ url: string;
6
+ }, {
7
+ url: string;
8
+ }>;
9
+ export type ClassifyBusinessArgs = z.infer<typeof ClassifyBusinessSchema>;
10
+ export declare function classifyBusiness(args: ClassifyBusinessArgs, _extra: unknown): Promise<{
11
+ content: {
12
+ type: "text";
13
+ text: string;
14
+ }[];
15
+ }>;
16
+ //# sourceMappingURL=classifyBusiness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classifyBusiness.d.ts","sourceRoot":"","sources":["../../../src/tools/classifyBusiness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,sBAAsB;;;;;;EAEjC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE1E,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,oBAAoB,EAC1B,MAAM,EAAE,OAAO;;;;;GAuDhB"}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClassifyBusinessSchema = void 0;
4
+ exports.classifyBusiness = classifyBusiness;
5
+ const zod_1 = require("zod");
6
+ const config_1 = require("../lib/config");
7
+ exports.ClassifyBusinessSchema = zod_1.z.object({
8
+ url: zod_1.z.string().url().describe("The website URL of the business to classify"),
9
+ });
10
+ async function classifyBusiness(args, _extra) {
11
+ try {
12
+ const result = await (0, config_1.callApi)("/v1/classify", { url: args.url });
13
+ const lines = [
14
+ `Business classified successfully for: ${args.url}`,
15
+ "",
16
+ ];
17
+ if (result.type)
18
+ lines.push(`- Type: ${result.type}`);
19
+ if (result.sector)
20
+ lines.push(`- Sector: ${result.sector}`);
21
+ if (result.industry)
22
+ lines.push(`- Industry: ${result.industry}`);
23
+ if (result.targetAudience)
24
+ lines.push(`- Target Audience: ${result.targetAudience}`);
25
+ if (result.valueProposition)
26
+ lines.push(`- Value Proposition: ${result.valueProposition}`);
27
+ if (result.insights && Array.isArray(result.insights) && result.insights.length > 0) {
28
+ lines.push("");
29
+ lines.push("## Key Insights");
30
+ for (const insight of result.insights) {
31
+ lines.push(`- ${insight}`);
32
+ }
33
+ }
34
+ if (!result.type &&
35
+ !result.sector &&
36
+ !result.industry &&
37
+ !result.targetAudience &&
38
+ !result.valueProposition) {
39
+ lines.push("## Raw Result");
40
+ lines.push(JSON.stringify(result, null, 2));
41
+ }
42
+ return {
43
+ content: [
44
+ {
45
+ type: "text",
46
+ text: lines.join("\n"),
47
+ },
48
+ ],
49
+ };
50
+ }
51
+ catch (error) {
52
+ return {
53
+ content: [
54
+ {
55
+ type: "text",
56
+ text: `Error: ${error instanceof Error ? error.message : "Unknown error occurred"}`,
57
+ },
58
+ ],
59
+ };
60
+ }
61
+ }
62
+ //# sourceMappingURL=classifyBusiness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classifyBusiness.js","sourceRoot":"","sources":["../../../src/tools/classifyBusiness.ts"],"names":[],"mappings":";;;AASA,4CAyDC;AAlED,6BAAwB;AACxB,0CAAwC;AAE3B,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;CAC9E,CAAC,CAAC;AAII,KAAK,UAAU,gBAAgB,CACpC,IAA0B,EAC1B,MAAe;IAEf,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAA,gBAAO,EAAC,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B,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;iBACvB;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,UACJ,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAC3C,EAAE;iBACH;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { z } from "zod";
2
+ export declare const ExtractKnowledgeSchema: z.ZodObject<{
3
+ url: z.ZodString;
4
+ maxPages: z.ZodOptional<z.ZodNumber>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ url: string;
7
+ maxPages?: number | undefined;
8
+ }, {
9
+ url: string;
10
+ maxPages?: number | undefined;
11
+ }>;
12
+ export type ExtractKnowledgeArgs = z.infer<typeof ExtractKnowledgeSchema>;
13
+ export declare function extractKnowledge(args: ExtractKnowledgeArgs, _extra: unknown): Promise<{
14
+ content: {
15
+ type: "text";
16
+ text: string;
17
+ }[];
18
+ }>;
19
+ //# sourceMappingURL=extractKnowledge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractKnowledge.d.ts","sourceRoot":"","sources":["../../../src/tools/extractKnowledge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,sBAAsB;;;;;;;;;EAQjC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE1E,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,oBAAoB,EAC1B,MAAM,EAAE,OAAO;;;;;GAsDhB"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExtractKnowledgeSchema = void 0;
4
+ exports.extractKnowledge = extractKnowledge;
5
+ const zod_1 = require("zod");
6
+ const config_1 = require("../lib/config");
7
+ exports.ExtractKnowledgeSchema = zod_1.z.object({
8
+ url: zod_1.z.string().url().describe("The website URL to extract knowledge from"),
9
+ maxPages: zod_1.z
10
+ .number()
11
+ .int()
12
+ .positive()
13
+ .optional()
14
+ .describe("Maximum number of pages to crawl (optional)"),
15
+ });
16
+ async function extractKnowledge(args, _extra) {
17
+ try {
18
+ const body = { url: args.url };
19
+ if (args.maxPages !== undefined) {
20
+ body.maxPages = args.maxPages;
21
+ }
22
+ const result = await (0, config_1.callApi)("/v1/extract", body);
23
+ const lines = [
24
+ `Knowledge extracted successfully from: ${args.url}`,
25
+ "",
26
+ ];
27
+ if (result.businessInfo) {
28
+ lines.push("## Business Info");
29
+ lines.push(JSON.stringify(result.businessInfo, null, 2));
30
+ lines.push("");
31
+ }
32
+ if (result.knowledgeItems && Array.isArray(result.knowledgeItems)) {
33
+ lines.push(`## Knowledge Items (${result.knowledgeItems.length} found)`);
34
+ for (const item of result.knowledgeItems) {
35
+ lines.push("");
36
+ lines.push(`### ${item.title || item.type || "Item"}`);
37
+ if (item.content)
38
+ lines.push(item.content);
39
+ if (item.url)
40
+ lines.push(`Source: ${item.url}`);
41
+ }
42
+ }
43
+ else {
44
+ lines.push("## Raw Result");
45
+ lines.push(JSON.stringify(result, null, 2));
46
+ }
47
+ return {
48
+ content: [
49
+ {
50
+ type: "text",
51
+ text: lines.join("\n"),
52
+ },
53
+ ],
54
+ };
55
+ }
56
+ catch (error) {
57
+ return {
58
+ content: [
59
+ {
60
+ type: "text",
61
+ text: `Error: ${error instanceof Error ? error.message : "Unknown error occurred"}`,
62
+ },
63
+ ],
64
+ };
65
+ }
66
+ }
67
+ //# sourceMappingURL=extractKnowledge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractKnowledge.js","sourceRoot":"","sources":["../../../src/tools/extractKnowledge.ts"],"names":[],"mappings":";;;AAeA,4CAwDC;AAvED,6BAAwB;AACxB,0CAAwC;AAE3B,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;IAC3E,QAAQ,EAAE,OAAC;SACR,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,QAAQ,CAAC,6CAA6C,CAAC;CAC3D,CAAC,CAAC;AAII,KAAK,UAAU,gBAAgB,CACpC,IAA0B,EAC1B,MAAe;IAEf,IAAI,CAAC;QACH,MAAM,IAAI,GAAwB,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;QACpD,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAChC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAChC,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAA,gBAAO,EAAC,aAAa,EAAE,IAAI,CAAC,CAAC;QAElD,MAAM,KAAK,GAAa;YACtB,0CAA0C,IAAI,CAAC,GAAG,EAAE;YACpD,EAAE;SACH,CAAC;QAEF,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;YACxB,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;YAC/B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YACzD,KAAK,CAAC,IAAI,CAAC,E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,16 @@
1
+ import { z } from "zod";
2
+ export declare const GetSitemapSchema: z.ZodObject<{
3
+ url: z.ZodString;
4
+ }, "strip", z.ZodTypeAny, {
5
+ url: string;
6
+ }, {
7
+ url: string;
8
+ }>;
9
+ export type GetSitemapArgs = z.infer<typeof GetSitemapSchema>;
10
+ export declare function getSitemap(args: GetSitemapArgs, _extra: unknown): Promise<{
11
+ content: {
12
+ type: "text";
13
+ text: string;
14
+ }[];
15
+ }>;
16
+ //# sourceMappingURL=getSitemap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSitemap.d.ts","sourceRoot":"","sources":["../../../src/tools/getSitemap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,gBAAgB;;;;;;EAE3B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE9D,wBAAsB,UAAU,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO;;;;;GA+CrE"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetSitemapSchema = void 0;
4
+ exports.getSitemap = getSitemap;
5
+ const zod_1 = require("zod");
6
+ const config_1 = require("../lib/config");
7
+ exports.GetSitemapSchema = zod_1.z.object({
8
+ url: zod_1.z.string().url().describe("The website URL to get the sitemap for"),
9
+ });
10
+ async function getSitemap(args, _extra) {
11
+ try {
12
+ const result = await (0, config_1.callApi)("/v1/sitemap", { url: args.url });
13
+ const urls = result.urls ||
14
+ result.pages ||
15
+ (Array.isArray(result) ? result : []);
16
+ const lines = [
17
+ `Sitemap discovered for: ${args.url}`,
18
+ `Total URLs found: ${urls.length}`,
19
+ "",
20
+ "## URLs",
21
+ ];
22
+ for (const pageUrl of urls) {
23
+ lines.push(`- ${pageUrl}`);
24
+ }
25
+ if (urls.length === 0) {
26
+ lines.push("(no URLs found)");
27
+ lines.push("");
28
+ lines.push("## Raw Result");
29
+ lines.push(JSON.stringify(result, null, 2));
30
+ }
31
+ return {
32
+ content: [
33
+ {
34
+ type: "text",
35
+ text: lines.join("\n"),
36
+ },
37
+ ],
38
+ };
39
+ }
40
+ catch (error) {
41
+ return {
42
+ content: [
43
+ {
44
+ type: "text",
45
+ text: `Error: ${error instanceof Error ? error.message : "Unknown error occurred"}`,
46
+ },
47
+ ],
48
+ };
49
+ }
50
+ }
51
+ //# sourceMappingURL=getSitemap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSitemap.js","sourceRoot":"","sources":["../../../src/tools/getSitemap.ts"],"names":[],"mappings":";;;AASA,gCA+CC;AAxDD,6BAAwB;AACxB,0CAAwC;AAE3B,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,wCAAwC,CAAC;CACzE,CAAC,CAAC;AAII,KAAK,UAAU,UAAU,CAAC,IAAoB,EAAE,MAAe;IACpE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAA,gBAAO,EAAC,aAAa,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAE/D,MAAM,IAAI,GACR,MAAM,CAAC,IAAI;YACX,MAAM,CAAC,KAAK;YACZ,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAExC,MAAM,KAAK,GAAa;YACtB,2BAA2B,IAAI,CAAC,GAAG,EAAE;YACrC,qBAAqB,IAAI,CAAC,MAAM,EAAE;YAClC,EAAE;YACF,SAAS;SACV,CAAC;QAEF,KAAK,MAAM,OAAO,IAAI,IAAI,EAAE,CAAC;YAC3B,KAAK,CAAC,IAAI,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;QAC7B,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAC9B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;iBACvB;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,UACJ,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAC3C,EAAE;iBACH;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
+ export * from "./extractKnowledge";
3
+ export * from "./scrapePage";
4
+ export * from "./classifyBusiness";
5
+ export * from "./getSitemap";
6
+ export * from "./takeScreenshot";
7
+ export * from "./searchKnowledge";
8
+ /**
9
+ * Set up all tools on the MCP server
10
+ */
11
+ export declare const setupTools: (server: Server) => void;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAenE,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAElC;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,SAuKxC,CAAC"}
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.setupTools = void 0;
18
+ const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
19
+ const extractKnowledge_1 = require("./extractKnowledge");
20
+ const scrapePage_1 = require("./scrapePage");
21
+ const classifyBusiness_1 = require("./classifyBusiness");
22
+ const getSitemap_1 = require("./getSitemap");
23
+ const takeScreenshot_1 = require("./takeScreenshot");
24
+ const searchKnowledge_1 = require("./searchKnowledge");
25
+ __exportStar(require("./extractKnowledge"), exports);
26
+ __exportStar(require("./scrapePage"), exports);
27
+ __exportStar(require("./classifyBusiness"), exports);
28
+ __exportStar(require("./getSitemap"), exports);
29
+ __exportStar(require("./takeScreenshot"), exports);
30
+ __exportStar(require("./searchKnowledge"), exports);
31
+ /**
32
+ * Set up all tools on the MCP server
33
+ */
34
+ const setupTools = (server) => {
35
+ // Register tools/list handler
36
+ server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
37
+ tools: [
38
+ {
39
+ name: "extract_knowledge",
40
+ description: "Extract structured knowledge from any website URL. Returns business classification, product features, pricing, and key insights.",
41
+ inputSchema: {
42
+ type: "object",
43
+ properties: {
44
+ url: {
45
+ type: "string",
46
+ description: "The website URL to extract knowledge from",
47
+ },
48
+ maxPages: {
49
+ type: "number",
50
+ description: "Maximum number of pages to crawl (optional)",
51
+ },
52
+ },
53
+ required: ["url"],
54
+ },
55
+ },
56
+ {
57
+ name: "scrape_page",
58
+ description: "Scrape any webpage and return clean markdown content. Perfect for reading documentation, articles, or any web content.",
59
+ inputSchema: {
60
+ type: "object",
61
+ properties: {
62
+ url: {
63
+ type: "string",
64
+ description: "The URL of the webpage to scrape",
65
+ },
66
+ },
67
+ required: ["url"],
68
+ },
69
+ },
70
+ {
71
+ name: "classify_business",
72
+ description: "Classify a business from its website URL. Returns type, industry, target audience, value proposition, and key insights.",
73
+ inputSchema: {
74
+ type: "object",
75
+ properties: {
76
+ url: {
77
+ type: "string",
78
+ description: "The website URL of the business to classify",
79
+ },
80
+ },
81
+ required: ["url"],
82
+ },
83
+ },
84
+ {
85
+ name: "get_sitemap",
86
+ description: "Discover all pages on a website via its sitemap. Returns a list of URLs for further processing.",
87
+ inputSchema: {
88
+ type: "object",
89
+ properties: {
90
+ url: {
91
+ type: "string",
92
+ description: "The website URL to get the sitemap for",
93
+ },
94
+ },
95
+ required: ["url"],
96
+ },
97
+ },
98
+ {
99
+ name: "take_screenshot",
100
+ description: "Take a full-page screenshot of any URL. Returns a base64-encoded PNG image.",
101
+ inputSchema: {
102
+ type: "object",
103
+ properties: {
104
+ url: {
105
+ type: "string",
106
+ description: "The URL of the webpage to screenshot",
107
+ },
108
+ },
109
+ required: ["url"],
110
+ },
111
+ },
112
+ {
113
+ name: "search_knowledge",
114
+ description: "Search your extracted knowledge base using natural language. Returns relevant knowledge items ranked by semantic similarity.",
115
+ inputSchema: {
116
+ type: "object",
117
+ properties: {
118
+ query: {
119
+ type: "string",
120
+ description: "Natural language query to search the knowledge base",
121
+ },
122
+ limit: {
123
+ type: "number",
124
+ description: "Maximum number of results to return (optional)",
125
+ },
126
+ },
127
+ required: ["query"],
128
+ },
129
+ },
130
+ ],
131
+ }));
132
+ // Handle tool calls
133
+ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
134
+ const { name, arguments: args } = request.params;
135
+ try {
136
+ switch (name) {
137
+ case "extract_knowledge": {
138
+ const validatedArgs = extractKnowledge_1.ExtractKnowledgeSchema.parse(args);
139
+ return await (0, extractKnowledge_1.extractKnowledge)(validatedArgs, null);
140
+ }
141
+ case "scrape_page": {
142
+ const validatedArgs = scrapePage_1.ScrapePageSchema.parse(args);
143
+ return await (0, scrapePage_1.scrapePage)(validatedArgs, null);
144
+ }
145
+ case "classify_business": {
146
+ const validatedArgs = classifyBusiness_1.ClassifyBusinessSchema.parse(args);
147
+ return await (0, classifyBusiness_1.classifyBusiness)(validatedArgs, null);
148
+ }
149
+ case "get_sitemap": {
150
+ const validatedArgs = getSitemap_1.GetSitemapSchema.parse(args);
151
+ return await (0, getSitemap_1.getSitemap)(validatedArgs, null);
152
+ }
153
+ case "take_screenshot": {
154
+ const validatedArgs = takeScreenshot_1.TakeScreenshotSchema.parse(args);
155
+ return await (0, takeScreenshot_1.takeScreenshot)(validatedArgs, null);
156
+ }
157
+ case "search_knowledge": {
158
+ const validatedArgs = searchKnowledge_1.SearchKnowledgeSchema.parse(args);
159
+ return await (0, searchKnowledge_1.searchKnowledge)(validatedArgs, null);
160
+ }
161
+ default:
162
+ throw new Error(`Unknown tool: ${name}`);
163
+ }
164
+ }
165
+ catch (error) {
166
+ if (error instanceof Error) {
167
+ return {
168
+ content: [
169
+ {
170
+ type: "text",
171
+ text: `Error: ${error.message}`,
172
+ },
173
+ ],
174
+ };
175
+ }
176
+ return {
177
+ content: [
178
+ {
179
+ type: "text",
180
+ text: `Error: ${String(error)}`,
181
+ },
182
+ ],
183
+ };
184
+ }
185
+ });
186
+ };
187
+ exports.setupTools = setupTools;
188
+ //# sourceMappingURL=index.js.map
@@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EAAE,CAAC;gBAC3B,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,UAAU,KAAK,CAAC,OAAO,EAAE;yBAChC;qBACF;iBACF,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,UAAU,MAAM,CAAC,KAAK,CAAC,EAAE;qBAChC;iBACF;aACF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAvKW,QAAA,UAAU,cAuKrB"}
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ export declare const ScrapePageSchema: z.ZodObject<{
3
+ url: z.ZodString;
4
+ }, "strip", z.ZodTypeAny, {
5
+ url: string;
6
+ }, {
7
+ url: string;
8
+ }>;
9
+ export type ScrapePageArgs = z.infer<typeof ScrapePageSchema>;
10
+ export declare function scrapePage(args: ScrapePageArgs, _extra: unknown): Promise<{
11
+ content: {
12
+ type: "text";
13
+ text: any;
14
+ }[];
15
+ }>;
16
+ //# sourceMappingURL=scrapePage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scrapePage.d.ts","sourceRoot":"","sources":["../../../src/tools/scrapePage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,gBAAgB;;;;;;EAE3B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE9D,wBAAsB,UAAU,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO;;;;;GA8BrE"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ScrapePageSchema = void 0;
4
+ exports.scrapePage = scrapePage;
5
+ const zod_1 = require("zod");
6
+ const config_1 = require("../lib/config");
7
+ exports.ScrapePageSchema = zod_1.z.object({
8
+ url: zod_1.z.string().url().describe("The URL of the webpage to scrape"),
9
+ });
10
+ async function scrapePage(args, _extra) {
11
+ try {
12
+ const result = await (0, config_1.callApi)("/v1/scrape", { url: args.url });
13
+ const markdown = result.markdown ||
14
+ result.content ||
15
+ result.text ||
16
+ JSON.stringify(result, null, 2);
17
+ return {
18
+ content: [
19
+ {
20
+ type: "text",
21
+ text: markdown,
22
+ },
23
+ ],
24
+ };
25
+ }
26
+ catch (error) {
27
+ return {
28
+ content: [
29
+ {
30
+ type: "text",
31
+ text: `Error: ${error instanceof Error ? error.message : "Unknown error occurred"}`,
32
+ },
33
+ ],
34
+ };
35
+ }
36
+ }
37
+ //# sourceMappingURL=scrapePage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scrapePage.js","sourceRoot":"","sources":["../../../src/tools/scrapePage.ts"],"names":[],"mappings":";;;AASA,gCA8BC;AAvCD,6BAAwB;AACxB,0CAAwC;AAE3B,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;CACnE,CAAC,CAAC;AAII,KAAK,UAAU,UAAU,CAAC,IAAoB,EAAE,MAAe;IACpE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAA,gBAAO,EAAC,YAAY,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAE9D,MAAM,QAAQ,GACZ,MAAM,CAAC,QAAQ;YACf,MAAM,CAAC,OAAO;YACd,MAAM,CAAC,IAAI;YACX,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAElC,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,QAAQ;iBACf;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,UACJ,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAC3C,EAAE;iBACH;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { z } from "zod";
2
+ export declare const SearchKnowledgeSchema: z.ZodObject<{
3
+ query: z.ZodString;
4
+ limit: z.ZodOptional<z.ZodNumber>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ query: string;
7
+ limit?: number | undefined;
8
+ }, {
9
+ query: string;
10
+ limit?: number | undefined;
11
+ }>;
12
+ export type SearchKnowledgeArgs = z.infer<typeof SearchKnowledgeSchema>;
13
+ export declare function searchKnowledge(args: SearchKnowledgeArgs, _extra: unknown): Promise<{
14
+ content: {
15
+ type: "text";
16
+ text: string;
17
+ }[];
18
+ }>;
19
+ //# sourceMappingURL=searchKnowledge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"searchKnowledge.d.ts","sourceRoot":"","sources":["../../../src/tools/searchKnowledge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,qBAAqB;;;;;;;;;EAWhC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAExE,wBAAsB,eAAe,CACnC,IAAI,EAAE,mBAAmB,EACzB,MAAM,EAAE,OAAO;;;;;GAoEhB"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SearchKnowledgeSchema = void 0;
4
+ exports.searchKnowledge = searchKnowledge;
5
+ const zod_1 = require("zod");
6
+ const config_1 = require("../lib/config");
7
+ exports.SearchKnowledgeSchema = zod_1.z.object({
8
+ query: zod_1.z
9
+ .string()
10
+ .min(1)
11
+ .describe("Natural language query to search the knowledge base"),
12
+ limit: zod_1.z
13
+ .number()
14
+ .int()
15
+ .positive()
16
+ .optional()
17
+ .describe("Maximum number of results to return (optional)"),
18
+ });
19
+ async function searchKnowledge(args, _extra) {
20
+ try {
21
+ const body = { query: args.query };
22
+ if (args.limit !== undefined) {
23
+ body.limit = args.limit;
24
+ }
25
+ const result = await (0, config_1.callApi)("/v1/search", body);
26
+ const items = result.results ||
27
+ result.items ||
28
+ result.hits ||
29
+ (Array.isArray(result) ? result : []);
30
+ const lines = [
31
+ `Search results for: "${args.query}"`,
32
+ `Results found: ${items.length}`,
33
+ "",
34
+ ];
35
+ for (let i = 0; i < items.length; i++) {
36
+ const item = items[i];
37
+ lines.push(`## Result ${i + 1}`);
38
+ if (item.score !== undefined)
39
+ lines.push(`Score: ${item.score}`);
40
+ if (item.title)
41
+ lines.push(`Title: ${item.title}`);
42
+ if (item.url)
43
+ lines.push(`URL: ${item.url}`);
44
+ if (item.content) {
45
+ lines.push("");
46
+ lines.push(item.content);
47
+ }
48
+ if (item.snippet) {
49
+ lines.push("");
50
+ lines.push(item.snippet);
51
+ }
52
+ lines.push("");
53
+ }
54
+ if (items.length === 0) {
55
+ lines.push("No results found.");
56
+ if (result && typeof result === "object" && !Array.isArray(result)) {
57
+ lines.push("");
58
+ lines.push("## Raw Result");
59
+ lines.push(JSON.stringify(result, null, 2));
60
+ }
61
+ }
62
+ return {
63
+ content: [
64
+ {
65
+ type: "text",
66
+ text: lines.join("\n"),
67
+ },
68
+ ],
69
+ };
70
+ }
71
+ catch (error) {
72
+ return {
73
+ content: [
74
+ {
75
+ type: "text",
76
+ text: `Error: ${error instanceof Error ? error.message : "Unknown error occurred"}`,
77
+ },
78
+ ],
79
+ };
80
+ }
81
+ }
82
+ //# sourceMappingURL=searchKnowledge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"searchKnowledge.js","sourceRoot":"","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oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;iBACvB;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,UACJ,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAC3C,EAAE;iBACH;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ export declare const TakeScreenshotSchema: z.ZodObject<{
3
+ url: z.ZodString;
4
+ }, "strip", z.ZodTypeAny, {
5
+ url: string;
6
+ }, {
7
+ url: string;
8
+ }>;
9
+ export type TakeScreenshotArgs = z.infer<typeof TakeScreenshotSchema>;
10
+ export declare function takeScreenshot(args: TakeScreenshotArgs, _extra: unknown): Promise<{
11
+ content: {
12
+ type: "text";
13
+ text: string;
14
+ }[];
15
+ } | {
16
+ content: {
17
+ type: "image";
18
+ data: any;
19
+ mimeType: string;
20
+ }[];
21
+ }>;
22
+ //# sourceMappingURL=takeScreenshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"takeScreenshot.d.ts","sourceRoot":"","sources":["../../../src/tools/takeScreenshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,oBAAoB;;;;;;EAE/B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEtE,wBAAsB,cAAc,CAClC,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,OAAO;;;;;;;;;;;GAgDhB"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TakeScreenshotSchema = void 0;
4
+ exports.takeScreenshot = takeScreenshot;
5
+ const zod_1 = require("zod");
6
+ const config_1 = require("../lib/config");
7
+ exports.TakeScreenshotSchema = zod_1.z.object({
8
+ url: zod_1.z.string().url().describe("The URL of the webpage to screenshot"),
9
+ });
10
+ async function takeScreenshot(args, _extra) {
11
+ try {
12
+ const result = await (0, config_1.callApi)("/v1/screenshot", { url: args.url });
13
+ const base64Image = result.image ||
14
+ result.screenshot ||
15
+ result.data ||
16
+ result.base64;
17
+ if (!base64Image) {
18
+ return {
19
+ content: [
20
+ {
21
+ type: "text",
22
+ text: `Screenshot taken for: ${args.url}\n\nRaw Result:\n${JSON.stringify(result, null, 2)}`,
23
+ },
24
+ ],
25
+ };
26
+ }
27
+ // Strip data URI prefix if present (e.g. "data:image/png;base64,...")
28
+ const cleanBase64 = base64Image.includes(",")
29
+ ? base64Image.split(",")[1]
30
+ : base64Image;
31
+ return {
32
+ content: [
33
+ {
34
+ type: "image",
35
+ data: cleanBase64,
36
+ mimeType: "image/png",
37
+ },
38
+ ],
39
+ };
40
+ }
41
+ catch (error) {
42
+ return {
43
+ content: [
44
+ {
45
+ type: "text",
46
+ text: `Error: ${error instanceof Error ? error.message : "Unknown error occurred"}`,
47
+ },
48
+ ],
49
+ };
50
+ }
51
+ }
52
+ //# sourceMappingURL=takeScreenshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"takeScreenshot.js","sourceRoot":"","sources":["../../../src/tools/takeScreenshot.ts"],"names":[],"mappings":";;;AASA,wCAkDC;AA3DD,6BAAwB;AACxB,0CAAwC;AAE3B,QAAA,oBAAoB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3C,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;CACvE,CAAC,CAAC;AAII,KAAK,UAAU,cAAc,CAClC,IAAwB,EACxB,MAAe;IAEf,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAA,gBAAO,EAAC,gBAAgB,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAElE,MAAM,WAAW,GACf,MAAM,CAAC,KAAK;YACZ,MAAM,CAAC,UAAU;YACjB,MAAM,CAAC,IAAI;YACX,MAAM,CAAC,MAAM,CAAC;QAEhB,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,yBAAyB,IAAI,CAAC,GAAG,oBAAoB,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;qBAC7F;iBACF;aACF,CAAC;QACJ,CAAC;QAED,sEAAsE;QACtE,MAAM,WAAW,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC3C,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAC3B,CAAC,CAAC,WAAW,CAAC;QAEhB,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,OAAgB;oBACtB,IAAI,EAAE,WAAW;oBACjB,QAAQ,EAAE,WAAW;iBACtB;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,UACJ,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAC3C,EAAE;iBACH;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@knowledgesdk/mcp",
3
+ "version": "0.1.0",
4
+ "description": "Official KnowledgeSDK Model Context Protocol Server - AI assistant integration for web knowledge extraction",
5
+ "type": "module",
6
+ "main": "dist/src/index.js",
7
+ "types": "dist/src/index.d.ts",
8
+ "bin": {
9
+ "@knowledgesdk/mcp": "./stdio.js"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "stdio.js",
14
+ "README.md",
15
+ "LICENSE"
16
+ ],
17
+ "engines": {
18
+ "node": ">=18"
19
+ },
20
+ "scripts": {
21
+ "build": "npm run clean && tsc -p tsconfig.build.json",
22
+ "clean": "rm -rf dist",
23
+ "test:local": "KNOWLEDGESDK_API_KEY=test node stdio.js",
24
+ "prepare": "npm run build",
25
+ "prepublishOnly": "npm run build",
26
+ "publish-stable": "npm run build && npm publish",
27
+ "publish-beta": "npm run build && npm publish --tag beta"
28
+ },
29
+ "keywords": [
30
+ "mcp",
31
+ "knowledgesdk",
32
+ "knowledge",
33
+ "extraction",
34
+ "scraping",
35
+ "ai",
36
+ "assistant",
37
+ "model-context-protocol"
38
+ ],
39
+ "author": "KnowledgeSDK",
40
+ "license": "MIT",
41
+ "homepage": "https://knowledgesdk.com",
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "https://github.com/knowledgesdk/knowledgesdk-mcp.git"
45
+ },
46
+ "bugs": {
47
+ "url": "https://github.com/knowledgesdk/knowledgesdk-mcp/issues"
48
+ },
49
+ "publishConfig": {
50
+ "access": "public",
51
+ "registry": "https://registry.npmjs.org/"
52
+ },
53
+ "dependencies": {
54
+ "@modelcontextprotocol/sdk": "^0.5.0",
55
+ "zod": "^3.24.2"
56
+ },
57
+ "devDependencies": {
58
+ "@types/node": "^20",
59
+ "typescript": "^5"
60
+ }
61
+ }
package/stdio.js ADDED
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
4
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
+
6
+ // Check if API key is set
7
+ if (!process.env.KNOWLEDGESDK_API_KEY) {
8
+ console.error("Error: KNOWLEDGESDK_API_KEY environment variable is not set.");
9
+ console.error("Please set it before running the MCP server:");
10
+ console.error(" export KNOWLEDGESDK_API_KEY=your_api_key_here");
11
+ console.error("");
12
+ console.error("To get an API key:");
13
+ console.error(" 1. Log in to https://knowledgesdk.com/dashboard");
14
+ console.error(" 2. Navigate to Settings → API Keys");
15
+ console.error(" 3. Click 'Create API Key'");
16
+ process.exit(1);
17
+ }
18
+
19
+ // Dynamic imports for ES modules
20
+ const loadTools = async () => {
21
+ const { setupTools } = await import("./dist/src/tools/index.js");
22
+ return setupTools;
23
+ };
24
+
25
+ async function main() {
26
+ const setupTools = await loadTools();
27
+
28
+ const server = new Server(
29
+ {
30
+ name: "@knowledgesdk/mcp",
31
+ version: "0.1.0",
32
+ },
33
+ {
34
+ capabilities: {
35
+ tools: {},
36
+ },
37
+ }
38
+ );
39
+
40
+ // Set up all the tools
41
+ setupTools(server);
42
+
43
+ const transport = new StdioServerTransport();
44
+ await server.connect(transport);
45
+
46
+ console.error("KnowledgeSDK MCP Server started successfully");
47
+ }
48
+
49
+ main().catch((error) => {
50
+ console.error("Fatal error:", error);
51
+ process.exit(1);
52
+ });