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

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.d.cts CHANGED
@@ -8,7 +8,6 @@ declare const convertMcpToolToWarp: (config: WarpClientConfig, tool: {
8
8
  }, url: string, headers?: Record<string, string>) => Promise<Warp>;
9
9
  declare const convertWarpToMcpCapabilities: (warp: Warp) => {
10
10
  tools: any[];
11
- resources: any[];
12
11
  };
13
12
 
14
13
  declare class WarpMcp {
package/dist/index.d.ts CHANGED
@@ -8,7 +8,6 @@ declare const convertMcpToolToWarp: (config: WarpClientConfig, tool: {
8
8
  }, url: string, headers?: Record<string, string>) => Promise<Warp>;
9
9
  declare const convertWarpToMcpCapabilities: (warp: Warp) => {
10
10
  tools: any[];
11
- resources: any[];
12
11
  };
13
12
 
14
13
  declare class WarpMcp {
package/dist/index.js CHANGED
@@ -67,7 +67,6 @@ var convertMcpToolToWarp = async (config, tool, url, headers) => {
67
67
  };
68
68
  var convertWarpToMcpCapabilities = (warp) => {
69
69
  const tools = [];
70
- const resources = [];
71
70
  const description = warp.description && typeof warp.description === "object" && "en" in warp.description ? warp.description.en : void 0;
72
71
  const outputSchema = {
73
72
  type: "object",
@@ -85,92 +84,75 @@ var convertWarpToMcpCapabilities = (warp) => {
85
84
  warp.actions.forEach((action, index) => {
86
85
  const actionDescription = action.description && typeof action.description === "object" && "en" in action.description ? action.description.en : void 0;
87
86
  const finalDescription = description || actionDescription || void 0;
88
- if (action.type === "transfer" || action.type === "contract") {
89
- const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : void 0, index);
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);
90
91
  tools.push(tool);
91
- } else if (action.type === "query") {
92
- const resource = convertActionToResource(warp, action, finalDescription, index);
93
- resources.push(resource);
94
92
  } else if (action.type === "collect") {
95
93
  const collectAction = action;
96
- if (collectAction.destination && typeof collectAction.destination === "object" && "method" in collectAction.destination && (collectAction.destination.method === "POST" || collectAction.destination.method === "PUT" || collectAction.destination.method === "DELETE")) {
97
- const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : void 0, index);
98
- tools.push(tool);
99
- } else {
100
- const resource = convertActionToResource(warp, action, finalDescription, index);
101
- resources.push(resource);
102
- }
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);
103
101
  } else if (action.type === "mcp") {
104
102
  const mcpAction = action;
105
103
  if (mcpAction.destination) {
106
- const tool = convertMcpActionToTool(warp, mcpAction, finalDescription, hasOutput ? outputSchema : void 0);
104
+ const tool = convertMcpActionToTool(warp, mcpAction, finalDescription, hasOutput ? outputSchema : void 0, isReadonly);
107
105
  tools.push(tool);
108
106
  }
109
107
  }
110
108
  });
111
- return { tools, resources };
109
+ return { tools };
112
110
  };
113
- var convertActionToTool = (warp, action, description, outputSchema, index) => {
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, "_");
113
+ };
114
+ var convertActionToTool = (warp, action, description, outputSchema, index, readonly = false) => {
114
115
  const inputSchema = buildInputSchema(action.inputs || []);
115
- const name = `${warp.name}_${index}`;
116
+ const name = sanitizeMcpName(`${warp.name}_${index}`);
116
117
  let url;
117
118
  let headers;
118
119
  if (action.type === "collect") {
119
- const collectAction = action;
120
- if (collectAction.destination && typeof collectAction.destination === "object" && "url" in collectAction.destination) {
121
- url = collectAction.destination.url;
122
- headers = collectAction.destination.headers;
123
- }
124
- }
125
- return {
126
- name,
127
- description,
128
- inputSchema: Object.keys(inputSchema.properties).length > 0 ? inputSchema : void 0,
129
- outputSchema,
130
- url,
131
- headers
132
- };
133
- };
134
- var convertActionToResource = (warp, action, description, index) => {
135
- const name = `${warp.name}_${index}`;
136
- let uri;
137
- let mimeType;
138
- let headers;
139
- if (action.type === "query") {
140
- const queryAction = action;
141
- if (queryAction.address) {
142
- uri = queryAction.address;
143
- }
144
- } else if (action.type === "collect") {
145
120
  const collectAction = action;
146
121
  if (collectAction.destination) {
147
122
  if (typeof collectAction.destination === "string") {
148
- uri = collectAction.destination;
123
+ url = collectAction.destination;
149
124
  } else if (typeof collectAction.destination === "object" && "url" in collectAction.destination) {
150
- uri = collectAction.destination.url;
125
+ url = collectAction.destination.url;
151
126
  headers = collectAction.destination.headers;
152
- mimeType = "application/json";
153
127
  }
154
128
  }
129
+ } else if (action.type === "query") {
130
+ const queryAction = action;
131
+ if (queryAction.address) {
132
+ url = queryAction.address;
133
+ }
155
134
  }
156
135
  return {
157
- uri: uri || name,
158
136
  name,
159
137
  description,
160
- mimeType,
161
- headers
138
+ inputSchema: Object.keys(inputSchema.properties).length > 0 ? inputSchema : void 0,
139
+ outputSchema,
140
+ url,
141
+ headers,
142
+ readonly
162
143
  };
163
144
  };
164
- var convertMcpActionToTool = (warp, action, description, outputSchema) => {
145
+ var convertMcpActionToTool = (warp, action, description, outputSchema, readonly = false) => {
165
146
  const inputSchema = buildInputSchema(action.inputs || []);
166
147
  const { url, tool: toolName, headers } = action.destination;
167
148
  return {
168
- name: toolName,
149
+ name: sanitizeMcpName(toolName),
169
150
  description,
170
151
  inputSchema: Object.keys(inputSchema.properties).length > 0 ? inputSchema : void 0,
171
152
  outputSchema,
172
153
  url,
173
- headers
154
+ headers,
155
+ readonly
174
156
  };
175
157
  };
176
158
  var buildInputSchema = (inputs) => {
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[]; resources: any[] } => {\n const tools: any[] = []\n const resources: 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 if (action.type === 'transfer' || action.type === 'contract') {\n const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : undefined, index)\n tools.push(tool)\n } else if (action.type === 'query') {\n const resource = convertActionToResource(warp, action, finalDescription, index)\n resources.push(resource)\n } else if (action.type === 'collect') {\n const collectAction = action as WarpCollectAction\n if (\n collectAction.destination &&\n typeof collectAction.destination === 'object' &&\n 'method' in collectAction.destination &&\n (collectAction.destination.method === 'POST' ||\n collectAction.destination.method === 'PUT' ||\n collectAction.destination.method === 'DELETE')\n ) {\n const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : undefined, index)\n tools.push(tool)\n } else {\n const resource = convertActionToResource(warp, action, finalDescription, index)\n resources.push(resource)\n }\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)\n tools.push(tool)\n }\n }\n })\n\n return { tools, resources }\n}\n\nconst convertActionToTool = (\n warp: Warp,\n action: WarpTransferAction | WarpContractAction | WarpCollectAction,\n description: string | undefined,\n outputSchema: any | undefined,\n index: number\n): any => {\n const inputSchema = buildInputSchema(action.inputs || [])\n const name = `${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 && typeof collectAction.destination === 'object' && 'url' in collectAction.destination) {\n url = collectAction.destination.url\n headers = collectAction.destination.headers\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 }\n}\n\nconst convertActionToResource = (\n warp: Warp,\n action: WarpQueryAction | WarpCollectAction,\n description: string | undefined,\n index: number\n): any => {\n const name = `${warp.name}_${index}`\n let uri: string | undefined\n let mimeType: string | undefined\n let headers: Record<string, string> | undefined\n\n if (action.type === 'query') {\n const queryAction = action as WarpQueryAction\n if (queryAction.address) {\n uri = queryAction.address\n }\n } else if (action.type === 'collect') {\n const collectAction = action as WarpCollectAction\n if (collectAction.destination) {\n if (typeof collectAction.destination === 'string') {\n uri = collectAction.destination\n } else if (typeof collectAction.destination === 'object' && 'url' in collectAction.destination) {\n uri = collectAction.destination.url\n headers = collectAction.destination.headers\n mimeType = 'application/json'\n }\n }\n }\n\n return {\n uri: uri || name,\n name,\n description,\n mimeType,\n headers,\n }\n}\n\nconst convertMcpActionToTool = (warp: Warp, action: WarpMcpAction, description: string | undefined, outputSchema: any | undefined): any => {\n const inputSchema = buildInputSchema(action.inputs || [])\n const { url, tool: toolName, headers } = action.destination!\n\n return {\n name: toolName,\n description,\n inputSchema: Object.keys(inputSchema.properties).length > 0 ? inputSchema : undefined,\n outputSchema,\n url,\n headers,\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;AAAA;AAAA;;;ACA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,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":[]}
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;AAAA;AAAA;;;ACAA,mBAWO;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,KAAK,aAAa,YAAY;AACrD,UAAM,aAAa,KAAK,aAAa;AACrC,WAAO,KAAK,UAAU,EAAE,QAAQ,CAAC,QAAQ;AACvC,aAA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;ACrQA,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
@@ -41,7 +41,6 @@ var convertMcpToolToWarp = async (config, tool, url, headers) => {
41
41
  };
42
42
  var convertWarpToMcpCapabilities = (warp) => {
43
43
  const tools = [];
44
- const resources = [];
45
44
  const description = warp.description && typeof warp.description === "object" && "en" in warp.description ? warp.description.en : void 0;
46
45
  const outputSchema = {
47
46
  type: "object",
@@ -59,92 +58,75 @@ var convertWarpToMcpCapabilities = (warp) => {
59
58
  warp.actions.forEach((action, index) => {
60
59
  const actionDescription = action.description && typeof action.description === "object" && "en" in action.description ? action.description.en : void 0;
61
60
  const finalDescription = description || actionDescription || void 0;
62
- if (action.type === "transfer" || action.type === "contract") {
63
- const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : void 0, index);
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);
64
65
  tools.push(tool);
65
- } else if (action.type === "query") {
66
- const resource = convertActionToResource(warp, action, finalDescription, index);
67
- resources.push(resource);
68
66
  } else if (action.type === "collect") {
69
67
  const collectAction = action;
70
- if (collectAction.destination && typeof collectAction.destination === "object" && "method" in collectAction.destination && (collectAction.destination.method === "POST" || collectAction.destination.method === "PUT" || collectAction.destination.method === "DELETE")) {
71
- const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : void 0, index);
72
- tools.push(tool);
73
- } else {
74
- const resource = convertActionToResource(warp, action, finalDescription, index);
75
- resources.push(resource);
76
- }
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);
77
75
  } else if (action.type === "mcp") {
78
76
  const mcpAction = action;
79
77
  if (mcpAction.destination) {
80
- const tool = convertMcpActionToTool(warp, mcpAction, finalDescription, hasOutput ? outputSchema : void 0);
78
+ const tool = convertMcpActionToTool(warp, mcpAction, finalDescription, hasOutput ? outputSchema : void 0, isReadonly);
81
79
  tools.push(tool);
82
80
  }
83
81
  }
84
82
  });
85
- return { tools, resources };
83
+ return { tools };
86
84
  };
87
- var convertActionToTool = (warp, action, description, outputSchema, index) => {
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, "_");
87
+ };
88
+ var convertActionToTool = (warp, action, description, outputSchema, index, readonly = false) => {
88
89
  const inputSchema = buildInputSchema(action.inputs || []);
89
- const name = `${warp.name}_${index}`;
90
+ const name = sanitizeMcpName(`${warp.name}_${index}`);
90
91
  let url;
91
92
  let headers;
92
93
  if (action.type === "collect") {
93
- const collectAction = action;
94
- if (collectAction.destination && typeof collectAction.destination === "object" && "url" in collectAction.destination) {
95
- url = collectAction.destination.url;
96
- headers = collectAction.destination.headers;
97
- }
98
- }
99
- return {
100
- name,
101
- description,
102
- inputSchema: Object.keys(inputSchema.properties).length > 0 ? inputSchema : void 0,
103
- outputSchema,
104
- url,
105
- headers
106
- };
107
- };
108
- var convertActionToResource = (warp, action, description, index) => {
109
- const name = `${warp.name}_${index}`;
110
- let uri;
111
- let mimeType;
112
- let headers;
113
- if (action.type === "query") {
114
- const queryAction = action;
115
- if (queryAction.address) {
116
- uri = queryAction.address;
117
- }
118
- } else if (action.type === "collect") {
119
94
  const collectAction = action;
120
95
  if (collectAction.destination) {
121
96
  if (typeof collectAction.destination === "string") {
122
- uri = collectAction.destination;
97
+ url = collectAction.destination;
123
98
  } else if (typeof collectAction.destination === "object" && "url" in collectAction.destination) {
124
- uri = collectAction.destination.url;
99
+ url = collectAction.destination.url;
125
100
  headers = collectAction.destination.headers;
126
- mimeType = "application/json";
127
101
  }
128
102
  }
103
+ } else if (action.type === "query") {
104
+ const queryAction = action;
105
+ if (queryAction.address) {
106
+ url = queryAction.address;
107
+ }
129
108
  }
130
109
  return {
131
- uri: uri || name,
132
110
  name,
133
111
  description,
134
- mimeType,
135
- headers
112
+ inputSchema: Object.keys(inputSchema.properties).length > 0 ? inputSchema : void 0,
113
+ outputSchema,
114
+ url,
115
+ headers,
116
+ readonly
136
117
  };
137
118
  };
138
- var convertMcpActionToTool = (warp, action, description, outputSchema) => {
119
+ var convertMcpActionToTool = (warp, action, description, outputSchema, readonly = false) => {
139
120
  const inputSchema = buildInputSchema(action.inputs || []);
140
121
  const { url, tool: toolName, headers } = action.destination;
141
122
  return {
142
- name: toolName,
123
+ name: sanitizeMcpName(toolName),
143
124
  description,
144
125
  inputSchema: Object.keys(inputSchema.properties).length > 0 ? inputSchema : void 0,
145
126
  outputSchema,
146
127
  url,
147
- headers
128
+ headers,
129
+ readonly
148
130
  };
149
131
  };
150
132
  var buildInputSchema = (inputs) => {
@@ -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[]; resources: any[] } => {\n const tools: any[] = []\n const resources: 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 if (action.type === 'transfer' || action.type === 'contract') {\n const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : undefined, index)\n tools.push(tool)\n } else if (action.type === 'query') {\n const resource = convertActionToResource(warp, action, finalDescription, index)\n resources.push(resource)\n } else if (action.type === 'collect') {\n const collectAction = action as WarpCollectAction\n if (\n collectAction.destination &&\n typeof collectAction.destination === 'object' &&\n 'method' in collectAction.destination &&\n (collectAction.destination.method === 'POST' ||\n collectAction.destination.method === 'PUT' ||\n collectAction.destination.method === 'DELETE')\n ) {\n const tool = convertActionToTool(warp, action, finalDescription, hasOutput ? outputSchema : undefined, index)\n tools.push(tool)\n } else {\n const resource = convertActionToResource(warp, action, finalDescription, index)\n resources.push(resource)\n }\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)\n tools.push(tool)\n }\n }\n })\n\n return { tools, resources }\n}\n\nconst convertActionToTool = (\n warp: Warp,\n action: WarpTransferAction | WarpContractAction | WarpCollectAction,\n description: string | undefined,\n outputSchema: any | undefined,\n index: number\n): any => {\n const inputSchema = buildInputSchema(action.inputs || [])\n const name = `${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 && typeof collectAction.destination === 'object' && 'url' in collectAction.destination) {\n url = collectAction.destination.url\n headers = collectAction.destination.headers\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 }\n}\n\nconst convertActionToResource = (\n warp: Warp,\n action: WarpQueryAction | WarpCollectAction,\n description: string | undefined,\n index: number\n): any => {\n const name = `${warp.name}_${index}`\n let uri: string | undefined\n let mimeType: string | undefined\n let headers: Record<string, string> | undefined\n\n if (action.type === 'query') {\n const queryAction = action as WarpQueryAction\n if (queryAction.address) {\n uri = queryAction.address\n }\n } else if (action.type === 'collect') {\n const collectAction = action as WarpCollectAction\n if (collectAction.destination) {\n if (typeof collectAction.destination === 'string') {\n uri = collectAction.destination\n } else if (typeof collectAction.destination === 'object' && 'url' in collectAction.destination) {\n uri = collectAction.destination.url\n headers = collectAction.destination.headers\n mimeType = 'application/json'\n }\n }\n }\n\n return {\n uri: uri || name,\n name,\n description,\n mimeType,\n headers,\n }\n}\n\nconst convertMcpActionToTool = (warp: Warp, action: WarpMcpAction, description: string | undefined, outputSchema: any | undefined): any => {\n const inputSchema = buildInputSchema(action.inputs || [])\n const { url, tool: toolName, headers } = action.destination!\n\n return {\n name: toolName,\n description,\n inputSchema: Object.keys(inputSchema.properties).length > 0 ? inputSchema : undefined,\n outputSchema,\n url,\n headers,\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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A6B,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 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,KAAK,aAAa,YAAY;AACrD,UAAM,aAAa,KAAK,aAAa;AACrC,WAAO,KAAK,UAAU,EAAE,QAAQ,CAAC,QAAQ;AACvC,aAAO,GAAG,IAAI,OAAO,GAAG;AAAA,IAC1B,CA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IvC,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":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vleap/warps-mcp",
3
- "version": "1.0.0-beta.5",
3
+ "version": "1.0.0-beta.7",
4
4
  "description": "MCP adapter for Warps SDK",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",