@vleap/warps-mcp 1.0.0-beta.7 → 1.0.0-beta.8

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/dist/index.js CHANGED
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(index_exports);
30
30
  var import_warps = require("@vleap/warps");
31
31
  var convertMcpToolToWarp = async (config, tool, url, headers) => {
32
32
  const inputs = [];
33
- if (tool.inputSchema && tool.inputSchema.properties) {
33
+ if (tool.inputSchema?.properties) {
34
34
  const properties = tool.inputSchema.properties;
35
35
  const required = tool.inputSchema.required || [];
36
36
  Object.entries(properties).forEach(([key, value]) => {
@@ -50,9 +50,8 @@ var convertMcpToolToWarp = async (config, tool, url, headers) => {
50
50
  });
51
51
  }
52
52
  const output = {};
53
- if (tool.outputSchema && tool.outputSchema.properties) {
54
- const properties = tool.outputSchema.properties;
55
- Object.keys(properties).forEach((key) => {
53
+ if (tool.outputSchema?.properties) {
54
+ Object.keys(tool.outputSchema.properties).forEach((key) => {
56
55
  output[key] = `out.${key}`;
57
56
  });
58
57
  }
@@ -67,126 +66,122 @@ var convertMcpToolToWarp = async (config, tool, url, headers) => {
67
66
  };
68
67
  var convertWarpToMcpCapabilities = (warp) => {
69
68
  const tools = [];
70
- const description = warp.description && typeof warp.description === "object" && "en" in warp.description ? warp.description.en : void 0;
71
- const outputSchema = {
72
- type: "object",
73
- properties: {}
74
- };
75
- if (warp.output && Object.keys(warp.output).length > 0) {
76
- Object.keys(warp.output).forEach((key) => {
77
- outputSchema.properties[key] = {
78
- type: "string",
79
- description: `Output field ${key}`
80
- };
81
- });
82
- }
83
- const hasOutput = Object.keys(outputSchema.properties).length > 0;
69
+ const warpDescription = extractText(warp.description);
84
70
  warp.actions.forEach((action, index) => {
85
- const actionDescription = action.description && typeof action.description === "object" && "en" in action.description ? action.description.en : void 0;
86
- const finalDescription = description || actionDescription || void 0;
87
- let isReadonly = false;
88
- if (action.type === "query") {
89
- isReadonly = true;
90
- const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : void 0, index, isReadonly);
91
- tools.push(tool);
92
- } else if (action.type === "collect") {
93
- const collectAction = action;
94
- const method = collectAction.destination && typeof collectAction.destination === "object" && "method" in collectAction.destination ? collectAction.destination.method : "GET";
95
- isReadonly = method === "GET";
96
- const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : void 0, index, isReadonly);
97
- tools.push(tool);
98
- } else if (action.type === "transfer" || action.type === "contract") {
99
- const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : void 0, index, isReadonly);
100
- tools.push(tool);
101
- } else if (action.type === "mcp") {
71
+ const actionDescription = extractText(action.description);
72
+ const description = warpDescription || actionDescription;
73
+ if (action.type === "mcp") {
102
74
  const mcpAction = action;
103
75
  if (mcpAction.destination) {
104
- const tool = convertMcpActionToTool(warp, mcpAction, finalDescription, hasOutput ? outputSchema : void 0, isReadonly);
76
+ const tool = convertMcpActionToTool(mcpAction, description);
105
77
  tools.push(tool);
106
78
  }
79
+ } else {
80
+ const tool = convertActionToTool(warp, action, description, index);
81
+ tools.push(tool);
107
82
  }
108
83
  });
109
84
  return { tools };
110
85
  };
111
- var sanitizeMcpName = (name) => {
112
- return name.replace(/\s+/g, "_").replace(/:/g, "_").replace(/[^A-Za-z0-9_.-]/g, "_").replace(/^[^A-Za-z0-9]+|[^A-Za-z0-9]+$/g, "").replace(/_+/g, "_");
86
+ var extractText = (text) => {
87
+ if (!text) return void 0;
88
+ if (typeof text === "string") return text;
89
+ if (typeof text === "object" && "en" in text) return text.en;
90
+ return void 0;
113
91
  };
114
- var convertActionToTool = (warp, action, description, outputSchema, index, readonly = false) => {
92
+ var convertActionToTool = (warp, action, description, index) => {
115
93
  const inputSchema = buildInputSchema(action.inputs || []);
116
94
  const name = sanitizeMcpName(`${warp.name}_${index}`);
117
- let url;
118
- let headers;
119
- if (action.type === "collect") {
120
- const collectAction = action;
121
- if (collectAction.destination) {
122
- if (typeof collectAction.destination === "string") {
123
- url = collectAction.destination;
124
- } else if (typeof collectAction.destination === "object" && "url" in collectAction.destination) {
125
- url = collectAction.destination.url;
126
- headers = collectAction.destination.headers;
127
- }
128
- }
129
- } else if (action.type === "query") {
130
- const queryAction = action;
131
- if (queryAction.address) {
132
- url = queryAction.address;
133
- }
134
- }
135
95
  return {
136
96
  name,
137
97
  description,
138
- inputSchema: Object.keys(inputSchema.properties).length > 0 ? inputSchema : void 0,
139
- outputSchema,
140
- url,
141
- headers,
142
- readonly
98
+ inputSchema: hasProperties(inputSchema) ? inputSchema : void 0
143
99
  };
144
100
  };
145
- var convertMcpActionToTool = (warp, action, description, outputSchema, readonly = false) => {
101
+ var convertMcpActionToTool = (action, description) => {
146
102
  const inputSchema = buildInputSchema(action.inputs || []);
147
- const { url, tool: toolName, headers } = action.destination;
103
+ const toolName = action.destination.tool;
148
104
  return {
149
105
  name: sanitizeMcpName(toolName),
150
106
  description,
151
- inputSchema: Object.keys(inputSchema.properties).length > 0 ? inputSchema : void 0,
152
- outputSchema,
153
- url,
154
- headers,
155
- readonly
107
+ inputSchema: hasProperties(inputSchema) ? inputSchema : void 0
156
108
  };
157
109
  };
158
110
  var buildInputSchema = (inputs) => {
159
- const inputSchema = {
111
+ const schema = {
160
112
  type: "object",
161
113
  properties: {},
162
114
  required: []
163
115
  };
164
116
  inputs.forEach((input) => {
165
- if (input.position && typeof input.position === "string" && input.position.startsWith("payload:")) {
166
- const key = input.position.replace("payload:", "");
167
- const jsonSchemaType = convertWarpTypeToJsonSchemaType(input.type);
168
- const property = {
169
- type: jsonSchemaType.type
170
- };
171
- if (jsonSchemaType.format) {
172
- property.format = jsonSchemaType.format;
173
- }
174
- if (input.label && typeof input.label === "object" && "en" in input.label) {
175
- property.title = input.label.en;
176
- }
177
- if (input.description && typeof input.description === "object" && "en" in input.description) {
178
- property.description = input.description.en;
179
- }
180
- if (input.default !== void 0) {
181
- property.default = input.default;
182
- }
183
- inputSchema.properties[key] = property;
184
- if (input.required) {
185
- inputSchema.required.push(key);
186
- }
117
+ if (!isPayloadInput(input)) return;
118
+ const key = extractPayloadKey(input.position);
119
+ const property = buildPropertySchema(input);
120
+ schema.properties[key] = property;
121
+ if (input.required) {
122
+ schema.required.push(key);
187
123
  }
188
124
  });
189
- return inputSchema;
125
+ return schema;
126
+ };
127
+ var isPayloadInput = (input) => {
128
+ return typeof input.position === "string" && input.position.startsWith("payload:");
129
+ };
130
+ var extractPayloadKey = (position) => {
131
+ return position.replace("payload:", "");
132
+ };
133
+ var buildPropertySchema = (input) => {
134
+ const jsonSchemaType = convertWarpTypeToJsonSchemaType(input.type);
135
+ const property = {
136
+ type: jsonSchemaType.type
137
+ };
138
+ if (jsonSchemaType.format) {
139
+ property.format = jsonSchemaType.format;
140
+ }
141
+ const title = extractText(input.label) || input.name;
142
+ if (title) {
143
+ property.title = title;
144
+ }
145
+ const description = buildDescription(input);
146
+ if (description) {
147
+ property.description = description;
148
+ }
149
+ if (input.default !== void 0) {
150
+ property.default = input.default;
151
+ }
152
+ if (typeof input.min === "number") {
153
+ property.minimum = input.min;
154
+ }
155
+ if (typeof input.max === "number") {
156
+ property.maximum = input.max;
157
+ }
158
+ if (input.pattern) {
159
+ property.pattern = input.pattern;
160
+ }
161
+ const enumValues = extractEnumValues(input.options);
162
+ if (enumValues) {
163
+ property.enum = enumValues;
164
+ }
165
+ return property;
166
+ };
167
+ var buildDescription = (input) => {
168
+ const description = extractText(input.description);
169
+ const patternDesc = extractText(input.patternDescription);
170
+ if (!description && !patternDesc) return void 0;
171
+ if (description && patternDesc) return `${description}. ${patternDesc}`;
172
+ return description || patternDesc;
173
+ };
174
+ var extractEnumValues = (options) => {
175
+ if (!options) return void 0;
176
+ if (Array.isArray(options)) return options;
177
+ if (typeof options === "object") return Object.keys(options);
178
+ return void 0;
179
+ };
180
+ var hasProperties = (schema) => {
181
+ return schema && schema.properties && Object.keys(schema.properties).length > 0;
182
+ };
183
+ var sanitizeMcpName = (name) => {
184
+ return name.replace(/\s+/g, "_").replace(/:/g, "_").replace(/[^A-Za-z0-9_.-]/g, "_").replace(/^[^A-Za-z0-9]+|[^A-Za-z0-9]+$/g, "").replace(/_+/g, "_");
190
185
  };
191
186
  var convertJsonSchemaTypeToWarpType = (type, format) => {
192
187
  if (format === "date-time" || format === "date") return "string";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/helpers/warps.ts","../src/WarpMcp.ts"],"sourcesContent":["export * from './helpers'\nexport * from './WarpMcp'\n","import {\n Warp,\n WarpActionInput,\n WarpActionInputType,\n WarpBuilder,\n WarpClientConfig,\n WarpCollectAction,\n WarpContractAction,\n WarpMcpAction,\n WarpQueryAction,\n WarpTransferAction,\n} from '@vleap/warps'\n\nexport const convertMcpToolToWarp = async (\n config: WarpClientConfig,\n tool: { name: string; description?: string; inputSchema?: any; outputSchema?: any },\n url: string,\n headers?: Record<string, string>\n): Promise<Warp> => {\n const inputs: WarpActionInput[] = []\n\n if (tool.inputSchema && tool.inputSchema.properties) {\n const properties = tool.inputSchema.properties\n const required = tool.inputSchema.required || []\n\n Object.entries(properties).forEach(([key, value]: [string, any]) => {\n const isRequired = required.includes(key)\n const inputType = convertJsonSchemaTypeToWarpType(value.type, value.format)\n\n const inputDef: WarpActionInput = {\n name: key,\n label: value.title || { en: key },\n description: value.description ? { en: value.description.trim() } : null,\n type: inputType,\n position: `payload:${key}`,\n source: 'field',\n required: isRequired,\n default: value.default,\n }\n\n inputs.push(inputDef)\n })\n }\n\n const output: Record<string, string> = {}\n if (tool.outputSchema && tool.outputSchema.properties) {\n const properties = tool.outputSchema.properties\n Object.keys(properties).forEach((key) => {\n output[key] = `out.${key}`\n })\n }\n\n const mcpAction: WarpMcpAction = {\n type: 'mcp',\n label: { en: tool.name },\n description: tool.description ? { en: tool.description.trim() } : null,\n destination: { url, tool: tool.name, headers },\n inputs,\n }\n\n return await new WarpBuilder(config)\n .setName(tool.name)\n .setTitle({ en: tool.name })\n .setDescription(tool.description ? { en: tool.description.trim() } : null)\n .addAction(mcpAction)\n .setOutput(Object.keys(output).length > 0 ? output : null)\n .build(false)\n}\n\nexport const convertWarpToMcpCapabilities = (warp: Warp): { tools: any[] } => {\n const tools: any[] = []\n\n const description = warp.description && typeof warp.description === 'object' && 'en' in warp.description ? warp.description.en : undefined\n\n const outputSchema: any = {\n type: 'object',\n properties: {},\n }\n\n if (warp.output && Object.keys(warp.output).length > 0) {\n Object.keys(warp.output).forEach((key) => {\n outputSchema.properties[key] = {\n type: 'string',\n description: `Output field ${key}`,\n }\n })\n }\n\n const hasOutput = Object.keys(outputSchema.properties).length > 0\n\n warp.actions.forEach((action, index) => {\n const actionDescription =\n action.description && typeof action.description === 'object' && 'en' in action.description ? action.description.en : undefined\n\n const finalDescription = description || actionDescription || undefined\n\n let isReadonly = false\n\n if (action.type === 'query') {\n isReadonly = true\n const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : undefined, index, isReadonly)\n tools.push(tool)\n } else if (action.type === 'collect') {\n const collectAction = action as WarpCollectAction\n const method = collectAction.destination && typeof collectAction.destination === 'object' && 'method' in collectAction.destination\n ? collectAction.destination.method\n : 'GET'\n isReadonly = method === 'GET'\n const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : undefined, index, isReadonly)\n tools.push(tool)\n } else if (action.type === 'transfer' || action.type === 'contract') {\n const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : undefined, index, isReadonly)\n tools.push(tool)\n } else if (action.type === 'mcp') {\n const mcpAction = action as WarpMcpAction\n if (mcpAction.destination) {\n const tool = convertMcpActionToTool(warp, mcpAction, finalDescription, hasOutput ? outputSchema : undefined, isReadonly)\n tools.push(tool)\n }\n }\n })\n\n return { tools }\n}\n\nconst sanitizeMcpName = (name: string): string => {\n return name\n .replace(/\\s+/g, '_')\n .replace(/:/g, '_')\n .replace(/[^A-Za-z0-9_.-]/g, '_')\n .replace(/^[^A-Za-z0-9]+|[^A-Za-z0-9]+$/g, '')\n .replace(/_+/g, '_')\n}\n\nconst convertActionToTool = (\n warp: Warp,\n action: WarpTransferAction | WarpContractAction | WarpCollectAction | WarpQueryAction,\n description: string | undefined,\n outputSchema: any | undefined,\n index: number,\n readonly: boolean = false\n): any => {\n const inputSchema = buildInputSchema(action.inputs || [])\n const name = sanitizeMcpName(`${warp.name}_${index}`)\n\n let url: string | undefined\n let headers: Record<string, string> | undefined\n\n if (action.type === 'collect') {\n const collectAction = action as WarpCollectAction\n if (collectAction.destination) {\n if (typeof collectAction.destination === 'string') {\n url = collectAction.destination\n } else if (typeof collectAction.destination === 'object' && 'url' in collectAction.destination) {\n url = collectAction.destination.url\n headers = collectAction.destination.headers\n }\n }\n } else if (action.type === 'query') {\n const queryAction = action as WarpQueryAction\n if (queryAction.address) {\n url = queryAction.address\n }\n }\n\n return {\n name,\n description,\n inputSchema: Object.keys(inputSchema.properties).length > 0 ? inputSchema : undefined,\n outputSchema,\n url,\n headers,\n readonly,\n }\n}\n\nconst convertMcpActionToTool = (warp: Warp, action: WarpMcpAction, description: string | undefined, outputSchema: any | undefined, readonly: boolean = false): any => {\n const inputSchema = buildInputSchema(action.inputs || [])\n const { url, tool: toolName, headers } = action.destination!\n\n return {\n name: sanitizeMcpName(toolName),\n description,\n inputSchema: Object.keys(inputSchema.properties).length > 0 ? inputSchema : undefined,\n outputSchema,\n url,\n headers,\n readonly,\n }\n}\n\nconst buildInputSchema = (inputs: WarpActionInput[]): any => {\n const inputSchema: any = {\n type: 'object',\n properties: {},\n required: [],\n }\n\n inputs.forEach((input) => {\n if (input.position && typeof input.position === 'string' && input.position.startsWith('payload:')) {\n const key = input.position.replace('payload:', '')\n const jsonSchemaType = convertWarpTypeToJsonSchemaType(input.type)\n\n const property: any = {\n type: jsonSchemaType.type,\n }\n\n if (jsonSchemaType.format) {\n property.format = jsonSchemaType.format\n }\n\n if (input.label && typeof input.label === 'object' && 'en' in input.label) {\n property.title = input.label.en\n }\n\n if (input.description && typeof input.description === 'object' && 'en' in input.description) {\n property.description = input.description.en\n }\n\n if (input.default !== undefined) {\n property.default = input.default\n }\n\n inputSchema.properties[key] = property\n\n if (input.required) {\n inputSchema.required.push(key)\n }\n }\n })\n\n return inputSchema\n}\n\nconst convertJsonSchemaTypeToWarpType = (type: string, format?: string): WarpActionInputType => {\n if (format === 'date-time' || format === 'date') return 'string'\n if (type === 'string') return 'string'\n if (type === 'number') return 'uint256'\n if (type === 'integer') return 'uint256'\n if (type === 'boolean') return 'bool'\n if (type === 'array') return 'string'\n if (type === 'object') return 'string'\n return 'string'\n}\n\nconst convertWarpTypeToJsonSchemaType = (warpType: string): { type: string; format?: string } => {\n if (warpType === 'string') return { type: 'string' }\n if (warpType === 'bool') return { type: 'boolean' }\n if (\n warpType === 'uint8' ||\n warpType === 'uint16' ||\n warpType === 'uint32' ||\n warpType === 'uint64' ||\n warpType === 'uint128' ||\n warpType === 'uint256' ||\n warpType === 'biguint'\n ) {\n return { type: 'integer' }\n }\n if (warpType === 'number') return { type: 'number' }\n return { type: 'string' }\n}\n","import { Client } from '@modelcontextprotocol/sdk/client/index.js'\nimport { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'\nimport { Warp, WarpClientConfig } from '@vleap/warps'\nimport { convertMcpToolToWarp } from './helpers/warps'\n\nexport class WarpMcp {\n constructor(private readonly config: WarpClientConfig) {}\n\n async getWarpsFromTools(url: string, headers?: Record<string, string>): Promise<Warp[]> {\n const transport = new StreamableHTTPClientTransport(new URL(url), {\n requestInit: { headers: headers || {} },\n })\n\n const client = new Client({ name: 'warps-mcp-client', version: '1.0.0' }, { capabilities: {} })\n\n try {\n await client.connect(transport)\n\n const tools = await client.listTools()\n\n await client.close()\n\n return await Promise.all(tools.tools.map((tool) => convertMcpToolToWarp(this.config, tool, url, headers)))\n } catch (error) {\n await client.close().catch(() => {})\n throw error\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA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,QAAI;AACF,YAAM,OAAO,QAAQ,SAAS;AAE9B,YAAM,QAAQ,MAAM,OAAO,UAAU;AAErC,YAAM,OAAO,MAAM;AAEnB,aAAO,MAAM,QAAQ,IAAI,MAAM,MAAM,IAAI,CAAC,SAAS,qBAAqB,KAAK,QAAQ,MAAM,KAAK,OAAO,CAAC,CAAC;AAAA,IAC3G,SAAS,OAAO;AACd,YAAM,OAAO,MAAM,EAAE,MAAM,MAAM;AAAA,MAAC,CAAC;AACnC,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/helpers/warps.ts","../src/WarpMcp.ts"],"sourcesContent":["export * from './helpers'\nexport * from './WarpMcp'\n","import {\n Warp,\n WarpActionInput,\n WarpActionInputType,\n WarpBuilder,\n WarpClientConfig,\n WarpCollectAction,\n WarpContractAction,\n WarpMcpAction,\n WarpQueryAction,\n WarpText,\n WarpTransferAction,\n} from '@vleap/warps'\n\nexport const convertMcpToolToWarp = async (\n config: WarpClientConfig,\n tool: { name: string; description?: string; inputSchema?: any; outputSchema?: any },\n url: string,\n headers?: Record<string, string>\n): Promise<Warp> => {\n const inputs: WarpActionInput[] = []\n\n if (tool.inputSchema?.properties) {\n const properties = tool.inputSchema.properties\n const required = tool.inputSchema.required || []\n\n Object.entries(properties).forEach(([key, value]: [string, any]) => {\n const isRequired = required.includes(key)\n const inputType = convertJsonSchemaTypeToWarpType(value.type, value.format)\n\n const inputDef: WarpActionInput = {\n name: key,\n label: value.title || { en: key },\n description: value.description ? { en: value.description.trim() } : null,\n type: inputType,\n position: `payload:${key}`,\n source: 'field',\n required: isRequired,\n default: value.default,\n }\n\n inputs.push(inputDef)\n })\n }\n\n const output: Record<string, string> = {}\n if (tool.outputSchema?.properties) {\n Object.keys(tool.outputSchema.properties).forEach((key) => {\n output[key] = `out.${key}`\n })\n }\n\n const mcpAction: WarpMcpAction = {\n type: 'mcp',\n label: { en: tool.name },\n description: tool.description ? { en: tool.description.trim() } : null,\n destination: { url, tool: tool.name, headers },\n inputs,\n }\n\n return await new WarpBuilder(config)\n .setName(tool.name)\n .setTitle({ en: tool.name })\n .setDescription(tool.description ? { en: tool.description.trim() } : null)\n .addAction(mcpAction)\n .setOutput(Object.keys(output).length > 0 ? output : null)\n .build(false)\n}\n\nexport const convertWarpToMcpCapabilities = (warp: Warp): { tools: any[] } => {\n const tools: any[] = []\n const warpDescription = extractText(warp.description)\n\n warp.actions.forEach((action, index) => {\n const actionDescription = extractText(action.description)\n const description = warpDescription || actionDescription\n\n if (action.type === 'mcp') {\n const mcpAction = action as WarpMcpAction\n if (mcpAction.destination) {\n const tool = convertMcpActionToTool(mcpAction, description)\n tools.push(tool)\n }\n } else {\n const tool = convertActionToTool(warp, action, description, index)\n tools.push(tool)\n }\n })\n\n return { tools }\n}\n\nconst extractText = (text: WarpText | null | undefined): string | undefined => {\n if (!text) return undefined\n if (typeof text === 'string') return text\n if (typeof text === 'object' && 'en' in text) return text.en\n return undefined\n}\n\nconst convertActionToTool = (\n warp: Warp,\n action: WarpTransferAction | WarpContractAction | WarpCollectAction | WarpQueryAction,\n description: string | undefined,\n index: number\n): any => {\n const inputSchema = buildInputSchema(action.inputs || [])\n const name = sanitizeMcpName(`${warp.name}_${index}`)\n\n return {\n name,\n description,\n inputSchema: hasProperties(inputSchema) ? inputSchema : undefined,\n }\n}\n\nconst convertMcpActionToTool = (action: WarpMcpAction, description: string | undefined): any => {\n const inputSchema = buildInputSchema(action.inputs || [])\n const toolName = action.destination!.tool\n\n return {\n name: sanitizeMcpName(toolName),\n description,\n inputSchema: hasProperties(inputSchema) ? inputSchema : undefined,\n }\n}\n\nconst buildInputSchema = (inputs: WarpActionInput[]): any => {\n const schema: any = {\n type: 'object',\n properties: {},\n required: [],\n }\n\n inputs.forEach((input) => {\n if (!isPayloadInput(input)) return\n\n const key = extractPayloadKey(input.position as string)\n const property = buildPropertySchema(input)\n\n schema.properties[key] = property\n\n if (input.required) {\n schema.required.push(key)\n }\n })\n\n return schema\n}\n\nconst isPayloadInput = (input: WarpActionInput): boolean => {\n return typeof input.position === 'string' && input.position.startsWith('payload:')\n}\n\nconst extractPayloadKey = (position: string): string => {\n return position.replace('payload:', '')\n}\n\nconst buildPropertySchema = (input: WarpActionInput): any => {\n const jsonSchemaType = convertWarpTypeToJsonSchemaType(input.type)\n const property: any = {\n type: jsonSchemaType.type,\n }\n\n if (jsonSchemaType.format) {\n property.format = jsonSchemaType.format\n }\n\n const title = extractText(input.label) || input.name\n if (title) {\n property.title = title\n }\n\n const description = buildDescription(input)\n if (description) {\n property.description = description\n }\n\n if (input.default !== undefined) {\n property.default = input.default\n }\n\n if (typeof input.min === 'number') {\n property.minimum = input.min\n }\n\n if (typeof input.max === 'number') {\n property.maximum = input.max\n }\n\n if (input.pattern) {\n property.pattern = input.pattern\n }\n\n const enumValues = extractEnumValues(input.options)\n if (enumValues) {\n property.enum = enumValues\n }\n\n return property\n}\n\nconst buildDescription = (input: WarpActionInput): string | undefined => {\n const description = extractText(input.description)\n const patternDesc = extractText(input.patternDescription)\n\n if (!description && !patternDesc) return undefined\n if (description && patternDesc) return `${description}. ${patternDesc}`\n return description || patternDesc\n}\n\nconst extractEnumValues = (options: string[] | { [key: string]: WarpText } | undefined): string[] | undefined => {\n if (!options) return undefined\n if (Array.isArray(options)) return options\n if (typeof options === 'object') return Object.keys(options)\n return undefined\n}\n\nconst hasProperties = (schema: any): boolean => {\n return schema && schema.properties && Object.keys(schema.properties).length > 0\n}\n\nconst sanitizeMcpName = (name: string): string => {\n return name\n .replace(/\\s+/g, '_')\n .replace(/:/g, '_')\n .replace(/[^A-Za-z0-9_.-]/g, '_')\n .replace(/^[^A-Za-z0-9]+|[^A-Za-z0-9]+$/g, '')\n .replace(/_+/g, '_')\n}\n\nconst convertJsonSchemaTypeToWarpType = (type: string, format?: string): WarpActionInputType => {\n if (format === 'date-time' || format === 'date') return 'string'\n if (type === 'string') return 'string'\n if (type === 'number') return 'uint256'\n if (type === 'integer') return 'uint256'\n if (type === 'boolean') return 'bool'\n if (type === 'array') return 'string'\n if (type === 'object') return 'string'\n return 'string'\n}\n\nconst convertWarpTypeToJsonSchemaType = (warpType: string): { type: string; format?: string } => {\n if (warpType === 'string') return { type: 'string' }\n if (warpType === 'bool') return { type: 'boolean' }\n if (\n warpType === 'uint8' ||\n warpType === 'uint16' ||\n warpType === 'uint32' ||\n warpType === 'uint64' ||\n warpType === 'uint128' ||\n warpType === 'uint256' ||\n warpType === 'biguint'\n ) {\n return { type: 'integer' }\n }\n if (warpType === 'number') return { type: 'number' }\n return { type: 'string' }\n}\n","import { Client } from '@modelcontextprotocol/sdk/client/index.js'\nimport { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'\nimport { Warp, WarpClientConfig } from '@vleap/warps'\nimport { convertMcpToolToWarp } from './helpers/warps'\n\nexport class WarpMcp {\n constructor(private readonly config: WarpClientConfig) {}\n\n async getWarpsFromTools(url: string, headers?: Record<string, string>): Promise<Warp[]> {\n const transport = new StreamableHTTPClientTransport(new URL(url), {\n requestInit: { headers: headers || {} },\n })\n\n const client = new Client({ name: 'warps-mcp-client', version: '1.0.0' }, { capabilities: {} })\n\n try {\n await client.connect(transport)\n\n const tools = await client.listTools()\n\n await client.close()\n\n return await Promise.all(tools.tools.map((tool) => convertMcpToolToWarp(this.config, tool, url, headers)))\n } catch (error) {\n await client.close().catch(() => {})\n throw error\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAYO;AAEA,IAAM,uBAAuB,OAClC,QACA,MACA,KACA,YACkB;AAClB,QAAM,SAA4B,CAAC;AAEnC,MAAI,KAAK,aAAa,YAAY;AAChC,UAAM,aAAa,KAAK,YAAY;AACpC,UAAM,WAAW,KAAK,YAAY,YAAY,CAAC;AAE/C,WAAO,QAAQ,UAAU,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAqB;AAClE,Y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AAM,SAAS;AAC1B;;;ACjQA,oBAAuB;AACvB,4BAA8C;AAIvC,IAAM,UAAN,MAAc;AAAA,EACnB,YAA6B,QAA0B;AAA1B;AAAA,EAA2B;AAAA,EAExD,MAAM,kBAAkB,KAAa,SAAmD;AACtF,UAAM,YAAY,IAAI,oDAA8B,IAAI,IAAI,GAAG,GAAG;AAAA,MAChE,aAAa,EAAE,SAAS,WAAW,CAAC,EAAE;AAAA,IACxC,CAAC;AAED,UAAM,SAAS,IAAI,qBAAO,EAAE,MAAM,oBAAoB,SAAS,QAAQ,GAAG,EAAE,cAAc,CAAC,EAAE,CAAC;AAE9F,QAAI;AACF,YAAM,OAAO,QAAQ,SAAS;AAE9B,YAAM,QAAQ,MAAM,OAAO,UAAU;AAErC,YAAM,OAAO,MAAM;AAEnB,aAAO,MAAM,QAAQ,IAAI,MAAM,MAAM,IAAI,CAAC,SAAS,qBAAqB,KAAK,QAAQ,MAAM,KAAK,OAAO,CAAC,CAAC;AAAA,IAC3G,SAAS,OAAO;AACd,YAAM,OAAO,MAAM,EAAE,MAAM,MAAM;AAAA,MAAC,CAAC;AACnC,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  } from "@vleap/warps";
5
5
  var convertMcpToolToWarp = async (config, tool, url, headers) => {
6
6
  const inputs = [];
7
- if (tool.inputSchema && tool.inputSchema.properties) {
7
+ if (tool.inputSchema?.properties) {
8
8
  const properties = tool.inputSchema.properties;
9
9
  const required = tool.inputSchema.required || [];
10
10
  Object.entries(properties).forEach(([key, value]) => {
@@ -24,9 +24,8 @@ var convertMcpToolToWarp = async (config, tool, url, headers) => {
24
24
  });
25
25
  }
26
26
  const output = {};
27
- if (tool.outputSchema && tool.outputSchema.properties) {
28
- const properties = tool.outputSchema.properties;
29
- Object.keys(properties).forEach((key) => {
27
+ if (tool.outputSchema?.properties) {
28
+ Object.keys(tool.outputSchema.properties).forEach((key) => {
30
29
  output[key] = `out.${key}`;
31
30
  });
32
31
  }
@@ -41,126 +40,122 @@ var convertMcpToolToWarp = async (config, tool, url, headers) => {
41
40
  };
42
41
  var convertWarpToMcpCapabilities = (warp) => {
43
42
  const tools = [];
44
- const description = warp.description && typeof warp.description === "object" && "en" in warp.description ? warp.description.en : void 0;
45
- const outputSchema = {
46
- type: "object",
47
- properties: {}
48
- };
49
- if (warp.output && Object.keys(warp.output).length > 0) {
50
- Object.keys(warp.output).forEach((key) => {
51
- outputSchema.properties[key] = {
52
- type: "string",
53
- description: `Output field ${key}`
54
- };
55
- });
56
- }
57
- const hasOutput = Object.keys(outputSchema.properties).length > 0;
43
+ const warpDescription = extractText(warp.description);
58
44
  warp.actions.forEach((action, index) => {
59
- const actionDescription = action.description && typeof action.description === "object" && "en" in action.description ? action.description.en : void 0;
60
- const finalDescription = description || actionDescription || void 0;
61
- let isReadonly = false;
62
- if (action.type === "query") {
63
- isReadonly = true;
64
- const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : void 0, index, isReadonly);
65
- tools.push(tool);
66
- } else if (action.type === "collect") {
67
- const collectAction = action;
68
- const method = collectAction.destination && typeof collectAction.destination === "object" && "method" in collectAction.destination ? collectAction.destination.method : "GET";
69
- isReadonly = method === "GET";
70
- const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : void 0, index, isReadonly);
71
- tools.push(tool);
72
- } else if (action.type === "transfer" || action.type === "contract") {
73
- const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : void 0, index, isReadonly);
74
- tools.push(tool);
75
- } else if (action.type === "mcp") {
45
+ const actionDescription = extractText(action.description);
46
+ const description = warpDescription || actionDescription;
47
+ if (action.type === "mcp") {
76
48
  const mcpAction = action;
77
49
  if (mcpAction.destination) {
78
- const tool = convertMcpActionToTool(warp, mcpAction, finalDescription, hasOutput ? outputSchema : void 0, isReadonly);
50
+ const tool = convertMcpActionToTool(mcpAction, description);
79
51
  tools.push(tool);
80
52
  }
53
+ } else {
54
+ const tool = convertActionToTool(warp, action, description, index);
55
+ tools.push(tool);
81
56
  }
82
57
  });
83
58
  return { tools };
84
59
  };
85
- var sanitizeMcpName = (name) => {
86
- return name.replace(/\s+/g, "_").replace(/:/g, "_").replace(/[^A-Za-z0-9_.-]/g, "_").replace(/^[^A-Za-z0-9]+|[^A-Za-z0-9]+$/g, "").replace(/_+/g, "_");
60
+ var extractText = (text) => {
61
+ if (!text) return void 0;
62
+ if (typeof text === "string") return text;
63
+ if (typeof text === "object" && "en" in text) return text.en;
64
+ return void 0;
87
65
  };
88
- var convertActionToTool = (warp, action, description, outputSchema, index, readonly = false) => {
66
+ var convertActionToTool = (warp, action, description, index) => {
89
67
  const inputSchema = buildInputSchema(action.inputs || []);
90
68
  const name = sanitizeMcpName(`${warp.name}_${index}`);
91
- let url;
92
- let headers;
93
- if (action.type === "collect") {
94
- const collectAction = action;
95
- if (collectAction.destination) {
96
- if (typeof collectAction.destination === "string") {
97
- url = collectAction.destination;
98
- } else if (typeof collectAction.destination === "object" && "url" in collectAction.destination) {
99
- url = collectAction.destination.url;
100
- headers = collectAction.destination.headers;
101
- }
102
- }
103
- } else if (action.type === "query") {
104
- const queryAction = action;
105
- if (queryAction.address) {
106
- url = queryAction.address;
107
- }
108
- }
109
69
  return {
110
70
  name,
111
71
  description,
112
- inputSchema: Object.keys(inputSchema.properties).length > 0 ? inputSchema : void 0,
113
- outputSchema,
114
- url,
115
- headers,
116
- readonly
72
+ inputSchema: hasProperties(inputSchema) ? inputSchema : void 0
117
73
  };
118
74
  };
119
- var convertMcpActionToTool = (warp, action, description, outputSchema, readonly = false) => {
75
+ var convertMcpActionToTool = (action, description) => {
120
76
  const inputSchema = buildInputSchema(action.inputs || []);
121
- const { url, tool: toolName, headers } = action.destination;
77
+ const toolName = action.destination.tool;
122
78
  return {
123
79
  name: sanitizeMcpName(toolName),
124
80
  description,
125
- inputSchema: Object.keys(inputSchema.properties).length > 0 ? inputSchema : void 0,
126
- outputSchema,
127
- url,
128
- headers,
129
- readonly
81
+ inputSchema: hasProperties(inputSchema) ? inputSchema : void 0
130
82
  };
131
83
  };
132
84
  var buildInputSchema = (inputs) => {
133
- const inputSchema = {
85
+ const schema = {
134
86
  type: "object",
135
87
  properties: {},
136
88
  required: []
137
89
  };
138
90
  inputs.forEach((input) => {
139
- if (input.position && typeof input.position === "string" && input.position.startsWith("payload:")) {
140
- const key = input.position.replace("payload:", "");
141
- const jsonSchemaType = convertWarpTypeToJsonSchemaType(input.type);
142
- const property = {
143
- type: jsonSchemaType.type
144
- };
145
- if (jsonSchemaType.format) {
146
- property.format = jsonSchemaType.format;
147
- }
148
- if (input.label && typeof input.label === "object" && "en" in input.label) {
149
- property.title = input.label.en;
150
- }
151
- if (input.description && typeof input.description === "object" && "en" in input.description) {
152
- property.description = input.description.en;
153
- }
154
- if (input.default !== void 0) {
155
- property.default = input.default;
156
- }
157
- inputSchema.properties[key] = property;
158
- if (input.required) {
159
- inputSchema.required.push(key);
160
- }
91
+ if (!isPayloadInput(input)) return;
92
+ const key = extractPayloadKey(input.position);
93
+ const property = buildPropertySchema(input);
94
+ schema.properties[key] = property;
95
+ if (input.required) {
96
+ schema.required.push(key);
161
97
  }
162
98
  });
163
- return inputSchema;
99
+ return schema;
100
+ };
101
+ var isPayloadInput = (input) => {
102
+ return typeof input.position === "string" && input.position.startsWith("payload:");
103
+ };
104
+ var extractPayloadKey = (position) => {
105
+ return position.replace("payload:", "");
106
+ };
107
+ var buildPropertySchema = (input) => {
108
+ const jsonSchemaType = convertWarpTypeToJsonSchemaType(input.type);
109
+ const property = {
110
+ type: jsonSchemaType.type
111
+ };
112
+ if (jsonSchemaType.format) {
113
+ property.format = jsonSchemaType.format;
114
+ }
115
+ const title = extractText(input.label) || input.name;
116
+ if (title) {
117
+ property.title = title;
118
+ }
119
+ const description = buildDescription(input);
120
+ if (description) {
121
+ property.description = description;
122
+ }
123
+ if (input.default !== void 0) {
124
+ property.default = input.default;
125
+ }
126
+ if (typeof input.min === "number") {
127
+ property.minimum = input.min;
128
+ }
129
+ if (typeof input.max === "number") {
130
+ property.maximum = input.max;
131
+ }
132
+ if (input.pattern) {
133
+ property.pattern = input.pattern;
134
+ }
135
+ const enumValues = extractEnumValues(input.options);
136
+ if (enumValues) {
137
+ property.enum = enumValues;
138
+ }
139
+ return property;
140
+ };
141
+ var buildDescription = (input) => {
142
+ const description = extractText(input.description);
143
+ const patternDesc = extractText(input.patternDescription);
144
+ if (!description && !patternDesc) return void 0;
145
+ if (description && patternDesc) return `${description}. ${patternDesc}`;
146
+ return description || patternDesc;
147
+ };
148
+ var extractEnumValues = (options) => {
149
+ if (!options) return void 0;
150
+ if (Array.isArray(options)) return options;
151
+ if (typeof options === "object") return Object.keys(options);
152
+ return void 0;
153
+ };
154
+ var hasProperties = (schema) => {
155
+ return schema && schema.properties && Object.keys(schema.properties).length > 0;
156
+ };
157
+ var sanitizeMcpName = (name) => {
158
+ return name.replace(/\s+/g, "_").replace(/:/g, "_").replace(/[^A-Za-z0-9_.-]/g, "_").replace(/^[^A-Za-z0-9]+|[^A-Za-z0-9]+$/g, "").replace(/_+/g, "_");
164
159
  };
165
160
  var convertJsonSchemaTypeToWarpType = (type, format) => {
166
161
  if (format === "date-time" || format === "date") return "string";
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/helpers/warps.ts","../src/WarpMcp.ts"],"sourcesContent":["import {\n Warp,\n WarpActionInput,\n WarpActionInputType,\n WarpBuilder,\n WarpClientConfig,\n WarpCollectAction,\n WarpContractAction,\n WarpMcpAction,\n WarpQueryAction,\n WarpTransferAction,\n} from '@vleap/warps'\n\nexport const convertMcpToolToWarp = async (\n config: WarpClientConfig,\n tool: { name: string; description?: string; inputSchema?: any; outputSchema?: any },\n url: string,\n headers?: Record<string, string>\n): Promise<Warp> => {\n const inputs: WarpActionInput[] = []\n\n if (tool.inputSchema && tool.inputSchema.properties) {\n const properties = tool.inputSchema.properties\n const required = tool.inputSchema.required || []\n\n Object.entries(properties).forEach(([key, value]: [string, any]) => {\n const isRequired = required.includes(key)\n const inputType = convertJsonSchemaTypeToWarpType(value.type, value.format)\n\n const inputDef: WarpActionInput = {\n name: key,\n label: value.title || { en: key },\n description: value.description ? { en: value.description.trim() } : null,\n type: inputType,\n position: `payload:${key}`,\n source: 'field',\n required: isRequired,\n default: value.default,\n }\n\n inputs.push(inputDef)\n })\n }\n\n const output: Record<string, string> = {}\n if (tool.outputSchema && tool.outputSchema.properties) {\n const properties = tool.outputSchema.properties\n Object.keys(properties).forEach((key) => {\n output[key] = `out.${key}`\n })\n }\n\n const mcpAction: WarpMcpAction = {\n type: 'mcp',\n label: { en: tool.name },\n description: tool.description ? { en: tool.description.trim() } : null,\n destination: { url, tool: tool.name, headers },\n inputs,\n }\n\n return await new WarpBuilder(config)\n .setName(tool.name)\n .setTitle({ en: tool.name })\n .setDescription(tool.description ? { en: tool.description.trim() } : null)\n .addAction(mcpAction)\n .setOutput(Object.keys(output).length > 0 ? output : null)\n .build(false)\n}\n\nexport const convertWarpToMcpCapabilities = (warp: Warp): { tools: any[] } => {\n const tools: any[] = []\n\n const description = warp.description && typeof warp.description === 'object' && 'en' in warp.description ? warp.description.en : undefined\n\n const outputSchema: any = {\n type: 'object',\n properties: {},\n }\n\n if (warp.output && Object.keys(warp.output).length > 0) {\n Object.keys(warp.output).forEach((key) => {\n outputSchema.properties[key] = {\n type: 'string',\n description: `Output field ${key}`,\n }\n })\n }\n\n const hasOutput = Object.keys(outputSchema.properties).length > 0\n\n warp.actions.forEach((action, index) => {\n const actionDescription =\n action.description && typeof action.description === 'object' && 'en' in action.description ? action.description.en : undefined\n\n const finalDescription = description || actionDescription || undefined\n\n let isReadonly = false\n\n if (action.type === 'query') {\n isReadonly = true\n const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : undefined, index, isReadonly)\n tools.push(tool)\n } else if (action.type === 'collect') {\n const collectAction = action as WarpCollectAction\n const method = collectAction.destination && typeof collectAction.destination === 'object' && 'method' in collectAction.destination\n ? collectAction.destination.method\n : 'GET'\n isReadonly = method === 'GET'\n const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : undefined, index, isReadonly)\n tools.push(tool)\n } else if (action.type === 'transfer' || action.type === 'contract') {\n const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : undefined, index, isReadonly)\n tools.push(tool)\n } else if (action.type === 'mcp') {\n const mcpAction = action as WarpMcpAction\n if (mcpAction.destination) {\n const tool = convertMcpActionToTool(warp, mcpAction, finalDescription, hasOutput ? outputSchema : undefined, isReadonly)\n tools.push(tool)\n }\n }\n })\n\n return { tools }\n}\n\nconst sanitizeMcpName = (name: string): string => {\n return name\n .replace(/\\s+/g, '_')\n .replace(/:/g, '_')\n .replace(/[^A-Za-z0-9_.-]/g, '_')\n .replace(/^[^A-Za-z0-9]+|[^A-Za-z0-9]+$/g, '')\n .replace(/_+/g, '_')\n}\n\nconst convertActionToTool = (\n warp: Warp,\n action: WarpTransferAction | WarpContractAction | WarpCollectAction | WarpQueryAction,\n description: string | undefined,\n outputSchema: any | undefined,\n index: number,\n readonly: boolean = false\n): any => {\n const inputSchema = buildInputSchema(action.inputs || [])\n const name = sanitizeMcpName(`${warp.name}_${index}`)\n\n let url: string | undefined\n let headers: Record<string, string> | undefined\n\n if (action.type === 'collect') {\n const collectAction = action as WarpCollectAction\n if (collectAction.destination) {\n if (typeof collectAction.destination === 'string') {\n url = collectAction.destination\n } else if (typeof collectAction.destination === 'object' && 'url' in collectAction.destination) {\n url = collectAction.destination.url\n headers = collectAction.destination.headers\n }\n }\n } else if (action.type === 'query') {\n const queryAction = action as WarpQueryAction\n if (queryAction.address) {\n url = queryAction.address\n }\n }\n\n return {\n name,\n description,\n inputSchema: Object.keys(inputSchema.properties).length > 0 ? inputSchema : undefined,\n outputSchema,\n url,\n headers,\n readonly,\n }\n}\n\nconst convertMcpActionToTool = (warp: Warp, action: WarpMcpAction, description: string | undefined, outputSchema: any | undefined, readonly: boolean = false): any => {\n const inputSchema = buildInputSchema(action.inputs || [])\n const { url, tool: toolName, headers } = action.destination!\n\n return {\n name: sanitizeMcpName(toolName),\n description,\n inputSchema: Object.keys(inputSchema.properties).length > 0 ? inputSchema : undefined,\n outputSchema,\n url,\n headers,\n readonly,\n }\n}\n\nconst buildInputSchema = (inputs: WarpActionInput[]): any => {\n const inputSchema: any = {\n type: 'object',\n properties: {},\n required: [],\n }\n\n inputs.forEach((input) => {\n if (input.position && typeof input.position === 'string' && input.position.startsWith('payload:')) {\n const key = input.position.replace('payload:', '')\n const jsonSchemaType = convertWarpTypeToJsonSchemaType(input.type)\n\n const property: any = {\n type: jsonSchemaType.type,\n }\n\n if (jsonSchemaType.format) {\n property.format = jsonSchemaType.format\n }\n\n if (input.label && typeof input.label === 'object' && 'en' in input.label) {\n property.title = input.label.en\n }\n\n if (input.description && typeof input.description === 'object' && 'en' in input.description) {\n property.description = input.description.en\n }\n\n if (input.default !== undefined) {\n property.default = input.default\n }\n\n inputSchema.properties[key] = property\n\n if (input.required) {\n inputSchema.required.push(key)\n }\n }\n })\n\n return inputSchema\n}\n\nconst convertJsonSchemaTypeToWarpType = (type: string, format?: string): WarpActionInputType => {\n if (format === 'date-time' || format === 'date') return 'string'\n if (type === 'string') return 'string'\n if (type === 'number') return 'uint256'\n if (type === 'integer') return 'uint256'\n if (type === 'boolean') return 'bool'\n if (type === 'array') return 'string'\n if (type === 'object') return 'string'\n return 'string'\n}\n\nconst convertWarpTypeToJsonSchemaType = (warpType: string): { type: string; format?: string } => {\n if (warpType === 'string') return { type: 'string' }\n if (warpType === 'bool') return { type: 'boolean' }\n if (\n warpType === 'uint8' ||\n warpType === 'uint16' ||\n warpType === 'uint32' ||\n warpType === 'uint64' ||\n warpType === 'uint128' ||\n warpType === 'uint256' ||\n warpType === 'biguint'\n ) {\n return { type: 'integer' }\n }\n if (warpType === 'number') return { type: 'number' }\n return { type: 'string' }\n}\n","import { Client } from '@modelcontextprotocol/sdk/client/index.js'\nimport { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'\nimport { Warp, WarpClientConfig } from '@vleap/warps'\nimport { convertMcpToolToWarp } from './helpers/warps'\n\nexport class WarpMcp {\n constructor(private readonly config: WarpClientConfig) {}\n\n async getWarpsFromTools(url: string, headers?: Record<string, string>): Promise<Warp[]> {\n const transport = new StreamableHTTPClientTransport(new URL(url), {\n requestInit: { headers: headers || {} },\n })\n\n const client = new Client({ name: 'warps-mcp-client', version: '1.0.0' }, { capabilities: {} })\n\n try {\n await client.connect(transport)\n\n const tools = await client.listTools()\n\n await client.close()\n\n return await Promise.all(tools.tools.map((tool) => convertMcpToolToWarp(this.config, tool, url, headers)))\n } catch (error) {\n await client.close().catch(() => {})\n throw error\n }\n }\n}\n"],"mappings":";AAAA;AAAA,EAIE;AAAA,OAOK;AAEA,IAAM,uBAAuB,OAClC,QACA,MACA,KACA,YACkB;AAClB,QAAM,SAA4B,CAAC;AAEnC,MAAI,KAAK,eAAe,KAAK,YAAY,YAAY;AACnD,UAAM,aAAa,KAAK,YAAY;AACpC,UAAM,WAAW,KAAK,YAAY,YAAY,CAAC;AAE/C,WAAO,QAAQ,UAAU,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAqB;AAClE,YAAM,aAAa,SAAS,SAAS,GAAG;AACxC,YAAM,YAAY,gCAAgC,MAAM,MAAM,MAAM,MAAM;AAE1E,YAAM,WAA4B;AAAA,QAChC,MAAM;AAAA,QACN,OAAO,MAAM,SAAS,EAAE,IAAI,IAAI;AAAA,QAChC,aAAa,MAAM,cAAc,EAAE,IAAI,MAAM,YAAY,KAAK,EAAE,IAAI;AAAA,QACpE,MAAM;AAAA,QACN,UAAU,WAAW,GAAG;AAAA,QACxB,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,SAAS,MAAM;AAAA,MACjB;AAEA,aAAO,KAAK,QAAQ;AAAA,IACtB,CAAC;AAAA,EACH;AAEA,QAAM,SAAiC,CAAC;AACxC,MAAI,KAAK,gBAAgB,KA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UAAU;AAAA,EAC3B;AACA,MAAI,aAAa,SAAU,QAAO,EAAE,MAAM,SAAS;AACnD,SAAO,EAAE,MAAM,SAAS;AAC1B;;;ACrQA,SAAS,cAAc;AACvB,SAAS,qCAAqC;AAIvC,IAAM,UAAN,MAAc;AAAA,EACnB,YAA6B,QAA0B;AAA1B;AAAA,EAA2B;AAAA,EAExD,MAAM,kBAAkB,KAAa,SAAmD;AACtF,UAAM,YAAY,IAAI,8BAA8B,IAAI,IAAI,GAAG,GAAG;AAAA,MAChE,aAAa,EAAE,SAAS,WAAW,CAAC,EAAE;AAAA,IACxC,CAAC;AAED,UAAM,SAAS,IAAI,OAAO,EAAE,MAAM,oBAAoB,SAAS,QAAQ,GAAG,EAAE,cAAc,CAAC,EAAE,CAAC;AAE9F,QAAI;AACF,YAAM,OAAO,QAAQ,SAAS;AAE9B,YAAM,QAAQ,MAAM,OAAO,UAAU;AAErC,YAAM,OAAO,MAAM;AAEnB,aAAO,MAAM,QAAQ,IAAI,MAAM,MAAM,IAAI,CAAC,SAAS,qBAAqB,KAAK,QAAQ,MAAM,KAAK,OAAO,CAAC,CAAC;AAAA,IAC3G,SAAS,OAAO;AACd,YAAM,OAAO,MAAM,EAAE,MAAM,MAAM;AAAA,MAAC,CAAC;AACnC,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/helpers/warps.ts","../src/WarpMcp.ts"],"sourcesContent":["import {\n Warp,\n WarpActionInput,\n WarpActionInputType,\n WarpBuilder,\n WarpClientConfig,\n WarpCollectAction,\n WarpContractAction,\n WarpMcpAction,\n WarpQueryAction,\n WarpText,\n WarpTransferAction,\n} from '@vleap/warps'\n\nexport const convertMcpToolToWarp = async (\n config: WarpClientConfig,\n tool: { name: string; description?: string; inputSchema?: any; outputSchema?: any },\n url: string,\n headers?: Record<string, string>\n): Promise<Warp> => {\n const inputs: WarpActionInput[] = []\n\n if (tool.inputSchema?.properties) {\n const properties = tool.inputSchema.properties\n const required = tool.inputSchema.required || []\n\n Object.entries(properties).forEach(([key, value]: [string, any]) => {\n const isRequired = required.includes(key)\n const inputType = convertJsonSchemaTypeToWarpType(value.type, value.format)\n\n const inputDef: WarpActionInput = {\n name: key,\n label: value.title || { en: key },\n description: value.description ? { en: value.description.trim() } : null,\n type: inputType,\n position: `payload:${key}`,\n source: 'field',\n required: isRequired,\n default: value.default,\n }\n\n inputs.push(inputDef)\n })\n }\n\n const output: Record<string, string> = {}\n if (tool.outputSchema?.properties) {\n Object.keys(tool.outputSchema.properties).forEach((key) => {\n output[key] = `out.${key}`\n })\n }\n\n const mcpAction: WarpMcpAction = {\n type: 'mcp',\n label: { en: tool.name },\n description: tool.description ? { en: tool.description.trim() } : null,\n destination: { url, tool: tool.name, headers },\n inputs,\n }\n\n return await new WarpBuilder(config)\n .setName(tool.name)\n .setTitle({ en: tool.name })\n .setDescription(tool.description ? { en: tool.description.trim() } : null)\n .addAction(mcpAction)\n .setOutput(Object.keys(output).length > 0 ? output : null)\n .build(false)\n}\n\nexport const convertWarpToMcpCapabilities = (warp: Warp): { tools: any[] } => {\n const tools: any[] = []\n const warpDescription = extractText(warp.description)\n\n warp.actions.forEach((action, index) => {\n const actionDescription = extractText(action.description)\n const description = warpDescription || actionDescription\n\n if (action.type === 'mcp') {\n const mcpAction = action as WarpMcpAction\n if (mcpAction.destination) {\n const tool = convertMcpActionToTool(mcpAction, description)\n tools.push(tool)\n }\n } else {\n const tool = convertActionToTool(warp, action, description, index)\n tools.push(tool)\n }\n })\n\n return { tools }\n}\n\nconst extractText = (text: WarpText | null | undefined): string | undefined => {\n if (!text) return undefined\n if (typeof text === 'string') return text\n if (typeof text === 'object' && 'en' in text) return text.en\n return undefined\n}\n\nconst convertActionToTool = (\n warp: Warp,\n action: WarpTransferAction | WarpContractAction | WarpCollectAction | WarpQueryAction,\n description: string | undefined,\n index: number\n): any => {\n const inputSchema = buildInputSchema(action.inputs || [])\n const name = sanitizeMcpName(`${warp.name}_${index}`)\n\n return {\n name,\n description,\n inputSchema: hasProperties(inputSchema) ? inputSchema : undefined,\n }\n}\n\nconst convertMcpActionToTool = (action: WarpMcpAction, description: string | undefined): any => {\n const inputSchema = buildInputSchema(action.inputs || [])\n const toolName = action.destination!.tool\n\n return {\n name: sanitizeMcpName(toolName),\n description,\n inputSchema: hasProperties(inputSchema) ? inputSchema : undefined,\n }\n}\n\nconst buildInputSchema = (inputs: WarpActionInput[]): any => {\n const schema: any = {\n type: 'object',\n properties: {},\n required: [],\n }\n\n inputs.forEach((input) => {\n if (!isPayloadInput(input)) return\n\n const key = extractPayloadKey(input.position as string)\n const property = buildPropertySchema(input)\n\n schema.properties[key] = property\n\n if (input.required) {\n schema.required.push(key)\n }\n })\n\n return schema\n}\n\nconst isPayloadInput = (input: WarpActionInput): boolean => {\n return typeof input.position === 'string' && input.position.startsWith('payload:')\n}\n\nconst extractPayloadKey = (position: string): string => {\n return position.replace('payload:', '')\n}\n\nconst buildPropertySchema = (input: WarpActionInput): any => {\n const jsonSchemaType = convertWarpTypeToJsonSchemaType(input.type)\n const property: any = {\n type: jsonSchemaType.type,\n }\n\n if (jsonSchemaType.format) {\n property.format = jsonSchemaType.format\n }\n\n const title = extractText(input.label) || input.name\n if (title) {\n property.title = title\n }\n\n const description = buildDescription(input)\n if (description) {\n property.description = description\n }\n\n if (input.default !== undefined) {\n property.default = input.default\n }\n\n if (typeof input.min === 'number') {\n property.minimum = input.min\n }\n\n if (typeof input.max === 'number') {\n property.maximum = input.max\n }\n\n if (input.pattern) {\n property.pattern = input.pattern\n }\n\n const enumValues = extractEnumValues(input.options)\n if (enumValues) {\n property.enum = enumValues\n }\n\n return property\n}\n\nconst buildDescription = (input: WarpActionInput): string | undefined => {\n const description = extractText(input.description)\n const patternDesc = extractText(input.patternDescription)\n\n if (!description && !patternDesc) return undefined\n if (description && patternDesc) return `${description}. ${patternDesc}`\n return description || patternDesc\n}\n\nconst extractEnumValues = (options: string[] | { [key: string]: WarpText } | undefined): string[] | undefined => {\n if (!options) return undefined\n if (Array.isArray(options)) return options\n if (typeof options === 'object') return Object.keys(options)\n return undefined\n}\n\nconst hasProperties = (schema: any): boolean => {\n return schema && schema.properties && Object.keys(schema.properties).length > 0\n}\n\nconst sanitizeMcpName = (name: string): string => {\n return name\n .replace(/\\s+/g, '_')\n .replace(/:/g, '_')\n .replace(/[^A-Za-z0-9_.-]/g, '_')\n .replace(/^[^A-Za-z0-9]+|[^A-Za-z0-9]+$/g, '')\n .replace(/_+/g, '_')\n}\n\nconst convertJsonSchemaTypeToWarpType = (type: string, format?: string): WarpActionInputType => {\n if (format === 'date-time' || format === 'date') return 'string'\n if (type === 'string') return 'string'\n if (type === 'number') return 'uint256'\n if (type === 'integer') return 'uint256'\n if (type === 'boolean') return 'bool'\n if (type === 'array') return 'string'\n if (type === 'object') return 'string'\n return 'string'\n}\n\nconst convertWarpTypeToJsonSchemaType = (warpType: string): { type: string; format?: string } => {\n if (warpType === 'string') return { type: 'string' }\n if (warpType === 'bool') return { type: 'boolean' }\n if (\n warpType === 'uint8' ||\n warpType === 'uint16' ||\n warpType === 'uint32' ||\n warpType === 'uint64' ||\n warpType === 'uint128' ||\n warpType === 'uint256' ||\n warpType === 'biguint'\n ) {\n return { type: 'integer' }\n }\n if (warpType === 'number') return { type: 'number' }\n return { type: 'string' }\n}\n","import { Client } from '@modelcontextprotocol/sdk/client/index.js'\nimport { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'\nimport { Warp, WarpClientConfig } from '@vleap/warps'\nimport { convertMcpToolToWarp } from './helpers/warps'\n\nexport class WarpMcp {\n constructor(private readonly config: WarpClientConfig) {}\n\n async getWarpsFromTools(url: string, headers?: Record<string, string>): Promise<Warp[]> {\n const transport = new StreamableHTTPClientTransport(new URL(url), {\n requestInit: { headers: headers || {} },\n })\n\n const client = new Client({ name: 'warps-mcp-client', version: '1.0.0' }, { capabilities: {} })\n\n try {\n await client.connect(transport)\n\n const tools = await client.listTools()\n\n await client.close()\n\n return await Promise.all(tools.tools.map((tool) => convertMcpToolToWarp(this.config, tool, url, headers)))\n } catch (error) {\n await client.close().catch(() => {})\n throw error\n }\n }\n}\n"],"mappings":";AAAA;AAAA,EAIE;AAAA,OAQK;AAEA,IAAM,uBAAuB,OAClC,QACA,MACA,KACA,YACkB;AAClB,QAAM,SAA4B,CAAC;AAEnC,MAAI,KAAK,aAAa,YAAY;AAChC,UAAM,aAAa,KAAK,YAAY;AACpC,UAAM,WAAW,KAAK,YAAY,YAAY,CAAC;AAE/C,WAAO,QAAQ,UAAU,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAqB;AAClE,YAAM,aAAa,SAAS,SAAS,GAAG;AACxC,YAAM,YAAY,gCAAgC,MAAM,MAAM,MAAM,MAAM;AAE1E,YAAM,WAA4B;AAAA,QAChC,MAAM;AAAA,QACN,OAAO,MAAM,SAAS,EAAE,IAAI,IAAI;AAAA,QAChC,aAAa,MAAM,cAAc,EAAE,IAAI,MAAM,YAAY,KAAK,EAAE,IAAI;AAAA,QACpE,MAAM;AAAA,QACN,UAAU,WAAW,GAAG;AAAA,QACxB,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,SAAS,MAAM;AAAA,MACjB;AAEA,aAAO,KAAK,QAAQ;AAAA,IACtB,CAAC;AAAA,EACH;AAEA,QAAM,SAAiC,CAAC;AACxC,MAAI,KAAK,cAAc,YAAY;AACjC,WAAO,KAAK,KAAK,aAAa,UAAU,EAAE,QAAQ,CAAC,QAAQ;AACzD,aAAO,GAAG,IAAI,OAAO,GAAG;AAAA,IAC1B,CAAC;AAAA,EACH;AAEA,QAAM,YAA2B;AAAA,IAC/B,MAAM;AAAA,IACN,OAAO,EAAE,IAAI,KAAK,KAAK;AAAA,IACvB,aAAa,KAAK,cAAc,EAAE,IAAI,KAAK,YAAY,KAAK,EAAE,IAAI;AAAA,IAClE,aAAa,EAAE,KAAK,MAAM,KAAK,MAAM,QAAQ;AAAA,IAC7C;AAAA,EACF;AAEA,SAAO,M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 "version": "1.0.0-beta.8",
4
4
  "description": "MCP adapter for Warps SDK",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",