@sealab/mcp-server 1.0.2 → 1.0.4

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.
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.McpApiError = exports.client = void 0;
6
+ exports.McpApiError = exports.aiDrawingClient = exports.client = void 0;
7
7
  exports.handleAxiosError = handleAxiosError;
8
8
  const axios_1 = __importDefault(require("axios"));
9
9
  const API_KEY = process.env.SEALAB_API_KEY;
@@ -18,6 +18,13 @@ exports.client = axios_1.default.create({
18
18
  },
19
19
  timeout: 10000,
20
20
  });
21
+ exports.aiDrawingClient = axios_1.default.create({
22
+ baseURL: `${API_URL}/api/ai-drawing/v1`,
23
+ headers: {
24
+ 'X-API-Key': API_KEY,
25
+ },
26
+ timeout: 10000,
27
+ });
21
28
  class McpApiError extends Error {
22
29
  status;
23
30
  constructor(status, message) {
package/dist/index.js CHANGED
@@ -12,13 +12,17 @@ const configuration_info_1 = require("./tools/configuration-info");
12
12
  const saved_settings_1 = require("./tools/saved-settings");
13
13
  const canvas_1 = require("./tools/canvas");
14
14
  const permissions_1 = require("./tools/permissions");
15
- const allTools = [...catalog_1.catalogTools, ...orders_1.orderTools, ...configuration_1.configurationTools, ...configuration_info_1.configurationInfoTools, ...saved_settings_1.savedSettingsTools, ...canvas_1.canvasTools, ...permissions_1.permissionTools];
15
+ const projects_1 = require("./tools/projects");
16
+ const ai_drawing_1 = require("./tools/ai-drawing");
17
+ const ai_drawing_overlay_1 = require("./tools/ai-drawing-overlay");
18
+ const schema_normalizer_1 = require("./schema-normalizer");
19
+ const allTools = [...catalog_1.catalogTools, ...orders_1.orderTools, ...configuration_1.configurationTools, ...configuration_info_1.configurationInfoTools, ...saved_settings_1.savedSettingsTools, ...canvas_1.canvasTools, ...permissions_1.permissionTools, ...projects_1.projectTools, ...ai_drawing_1.aiDrawingTools, ...ai_drawing_overlay_1.aiDrawingOverlayTools];
16
20
  const server = new index_js_1.Server({ name: 'sealab', version: '1.0.0' }, { capabilities: { tools: {} } });
17
21
  server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
18
22
  tools: allTools.map((t) => ({
19
23
  name: t.name,
20
24
  description: t.description,
21
- inputSchema: (0, zod_to_json_schema_1.zodToJsonSchema)(t.inputSchema, { target: 'openApi3' }),
25
+ inputSchema: (0, schema_normalizer_1.normalizeMcpJsonSchema)((0, zod_to_json_schema_1.zodToJsonSchema)(t.inputSchema, { target: 'openApi3' })),
22
26
  })),
23
27
  }));
24
28
  server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeMcpJsonSchema = normalizeMcpJsonSchema;
4
+ function isJsonObject(value) {
5
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
6
+ }
7
+ function normalizeExclusiveBounds(schema) {
8
+ const normalized = { ...schema };
9
+ if (normalized.exclusiveMinimum === true) {
10
+ if (typeof normalized.minimum === 'number') {
11
+ normalized.exclusiveMinimum = normalized.minimum;
12
+ delete normalized.minimum;
13
+ }
14
+ else {
15
+ delete normalized.exclusiveMinimum;
16
+ }
17
+ }
18
+ else if (normalized.exclusiveMinimum === false) {
19
+ delete normalized.exclusiveMinimum;
20
+ }
21
+ if (normalized.exclusiveMaximum === true) {
22
+ if (typeof normalized.maximum === 'number') {
23
+ normalized.exclusiveMaximum = normalized.maximum;
24
+ delete normalized.maximum;
25
+ }
26
+ else {
27
+ delete normalized.exclusiveMaximum;
28
+ }
29
+ }
30
+ else if (normalized.exclusiveMaximum === false) {
31
+ delete normalized.exclusiveMaximum;
32
+ }
33
+ return normalized;
34
+ }
35
+ function schemaSignature(schema) {
36
+ if (Array.isArray(schema)) {
37
+ return `[${schema.map((item) => schemaSignature(item)).join(',')}]`;
38
+ }
39
+ if (!isJsonObject(schema)) {
40
+ return JSON.stringify(schema);
41
+ }
42
+ return `{${Object.keys(schema)
43
+ .sort()
44
+ .map((key) => `${JSON.stringify(key)}:${schemaSignature(schema[key])}`)
45
+ .join(',')}}`;
46
+ }
47
+ function isRefToFirstTupleItem(item) {
48
+ return isJsonObject(item) && typeof item.$ref === 'string' && item.$ref.endsWith('/items/0');
49
+ }
50
+ function normalizeTupleItems(schema) {
51
+ if (!Array.isArray(schema.items)) {
52
+ return schema;
53
+ }
54
+ const normalizedItems = schema.items.map((item) => normalizeMcpJsonSchema(item));
55
+ const firstItem = normalizedItems[0];
56
+ const allItemsMatchFirst = normalizedItems.every((item) => (schemaSignature(item) === schemaSignature(firstItem) || isRefToFirstTupleItem(item)));
57
+ return {
58
+ ...schema,
59
+ items: allItemsMatchFirst ? firstItem : { anyOf: normalizedItems },
60
+ };
61
+ }
62
+ function normalizeMcpJsonSchema(schema) {
63
+ if (Array.isArray(schema)) {
64
+ return schema.map((item) => normalizeMcpJsonSchema(item));
65
+ }
66
+ if (!isJsonObject(schema)) {
67
+ return schema;
68
+ }
69
+ const normalized = normalizeTupleItems(normalizeExclusiveBounds(schema));
70
+ for (const [key, value] of Object.entries(normalized)) {
71
+ normalized[key] = normalizeMcpJsonSchema(value);
72
+ }
73
+ return normalized;
74
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.aiDrawingOverlayTools = void 0;
4
+ exports.aiDrawingOverlayTools = [];