@digipair/skill-mcp 0.107.3 → 0.107.5

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/index.esm.js CHANGED
@@ -62340,6 +62340,35 @@ var MAXIMUM_MESSAGE_SIZE = "4mb";
62340
62340
  ();
62341
62341
 
62342
62342
  let MCPServerService = class MCPServerService {
62343
+ jsonSchemaToZod(schema) {
62344
+ const zodProps = {};
62345
+ switch(schema.type){
62346
+ case 'string':
62347
+ return z.string().optional();
62348
+ case 'number':
62349
+ return z.number().optional();
62350
+ case 'boolean':
62351
+ return z.boolean().optional();
62352
+ case 'object':
62353
+ for(const prop in schema.properties){
62354
+ zodProps[prop] = this.jsonSchemaToZod(schema.properties[prop]);
62355
+ if (schema.properties[prop].description) {
62356
+ zodProps[prop] = zodProps[prop].describe(schema.properties[prop].description);
62357
+ }
62358
+ }
62359
+ var _schema_required;
62360
+ return z.object(zodProps).required(((_schema_required = schema.required) != null ? _schema_required : []).reduce((acc, reqProp)=>_extends({}, acc, {
62361
+ [reqProp]: true
62362
+ }), {})).optional();
62363
+ case 'array':
62364
+ if (schema.items) {
62365
+ return z.array(this.jsonSchemaToZod(schema.items)).optional();
62366
+ }
62367
+ return z.array(z.unknown()).optional();
62368
+ default:
62369
+ throw new Error(`Unsupported JSON Schema type: ${schema.type}`);
62370
+ }
62371
+ }
62343
62372
  async createServer(params, _pinsSettingsList, context) {
62344
62373
  const { name = 'digipair-mcp-server', version = '1.0.0', tools = [] } = params;
62345
62374
  const server = new McpServer({
@@ -62349,11 +62378,25 @@ let MCPServerService = class MCPServerService {
62349
62378
  // Register tools
62350
62379
  for(let i = 0; i < tools.length; i++){
62351
62380
  const tool = tools[i];
62381
+ let inputSchema;
62382
+ if (tool.inputSchema) {
62383
+ inputSchema = {};
62384
+ for(const prop in tool.inputSchema){
62385
+ inputSchema[prop] = this.jsonSchemaToZod(tool.inputSchema[prop]);
62386
+ }
62387
+ }
62388
+ let outputSchema;
62389
+ if (tool.outputSchema) {
62390
+ outputSchema = {};
62391
+ for(const prop in tool.outputSchema){
62392
+ outputSchema[prop] = this.jsonSchemaToZod(tool.outputSchema[prop]);
62393
+ }
62394
+ }
62352
62395
  server.registerTool(tool.name, {
62353
62396
  title: tool.title,
62354
62397
  description: tool.description,
62355
- inputSchema: tool.inputSchema,
62356
- outputSchema: tool.outputSchema
62398
+ inputSchema: inputSchema,
62399
+ outputSchema: outputSchema
62357
62400
  }, async (params)=>{
62358
62401
  return await executePinsList(tool.execute, {
62359
62402
  context,
@@ -62366,7 +62409,7 @@ let MCPServerService = class MCPServerService {
62366
62409
  });
62367
62410
  // Start the server
62368
62411
  await server.connect(transport);
62369
- await transport.handleRequest(context.privates.req, context.privates.res, context.privates.req.body);
62412
+ await transport.handleRequest(context.protected.req, context.protected.res, context.protected.req.body);
62370
62413
  }
62371
62414
  };
62372
62415
  const mcpServerService = new MCPServerService();
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@digipair/skill-mcp",
3
- "version": "0.107.3",
3
+ "version": "0.107.5",
4
4
  "keywords": [
5
5
  "digipair",
6
6
  "service",
7
7
  "tool"
8
8
  ],
9
- "dependencies": {},
9
+ "dependencies": {
10
+ "@digipair/engine": "0.107.5",
11
+ "zod": "^3.23.8",
12
+ "@modelcontextprotocol/sdk": "^1.18.2"
13
+ },
10
14
  "main": "./index.cjs.js",
11
15
  "module": "./index.esm.js"
12
16
  }
@@ -1,2 +0,0 @@
1
- export * from './lib/engine';
2
- export * from './lib/pins-settings.interface';
@@ -1,9 +0,0 @@
1
- export interface Alias {
2
- name: string;
3
- library: string;
4
- element: string;
5
- properties: {
6
- library: string;
7
- element: string;
8
- };
9
- }
@@ -1,13 +0,0 @@
1
- import { PinsSettings } from './pins-settings.interface';
2
- type CONFIG_KEY = 'BASE_URL' | 'LIBRARIES' | 'ALIAS' | 'LOGGER';
3
- export declare const config: {
4
- set: (key: CONFIG_KEY, value: any) => void;
5
- log: (level: string, path: string, message: string, context: any, data?: any) => any;
6
- };
7
- export declare const applyTemplate: (value: any, context: any) => any;
8
- export declare const executePinsList: (pinsSettingsList: PinsSettings[], context: any, path?: string) => Promise<any>;
9
- export declare const generateElementFromPins: (pinsSettings: PinsSettings, parent: Element, context: any, document?: Document, options?: {
10
- import: boolean;
11
- }) => Promise<Element | void>;
12
- export declare const preparePinsSettings: (settings: PinsSettings, context: any) => PinsSettings;
13
- export {};
@@ -1,15 +0,0 @@
1
- export interface PinsSettings {
2
- library: string;
3
- element: string;
4
- properties?: {
5
- [key: string]: any;
6
- };
7
- conditions?: {
8
- if?: boolean;
9
- each?: any[];
10
- };
11
- pins?: PinsSettings[];
12
- events?: {
13
- [key: string]: PinsSettings[];
14
- };
15
- }