@henrylabs/mcp 0.14.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/README.md +13 -334
  2. package/code-tool-types.d.mts +2 -0
  3. package/code-tool-types.d.mts.map +1 -1
  4. package/code-tool-types.d.ts +2 -0
  5. package/code-tool-types.d.ts.map +1 -1
  6. package/code-tool.d.mts +2 -2
  7. package/code-tool.d.mts.map +1 -1
  8. package/code-tool.d.ts +2 -2
  9. package/code-tool.d.ts.map +1 -1
  10. package/code-tool.js +27 -130
  11. package/code-tool.js.map +1 -1
  12. package/code-tool.mjs +27 -97
  13. package/code-tool.mjs.map +1 -1
  14. package/docs-search-tool.d.mts +15 -9
  15. package/docs-search-tool.d.mts.map +1 -1
  16. package/docs-search-tool.d.ts +15 -9
  17. package/docs-search-tool.d.ts.map +1 -1
  18. package/docs-search-tool.js +4 -1
  19. package/docs-search-tool.js.map +1 -1
  20. package/docs-search-tool.mjs +4 -1
  21. package/docs-search-tool.mjs.map +1 -1
  22. package/http.d.mts.map +1 -1
  23. package/http.d.ts.map +1 -1
  24. package/http.js +1 -18
  25. package/http.js.map +1 -1
  26. package/http.mjs +1 -18
  27. package/http.mjs.map +1 -1
  28. package/index.js +4 -40
  29. package/index.js.map +1 -1
  30. package/index.mjs +4 -40
  31. package/index.mjs.map +1 -1
  32. package/options.d.mts +0 -9
  33. package/options.d.mts.map +1 -1
  34. package/options.d.ts +0 -9
  35. package/options.d.ts.map +1 -1
  36. package/options.js +4 -359
  37. package/options.js.map +1 -1
  38. package/options.mjs +4 -359
  39. package/options.mjs.map +1 -1
  40. package/package.json +10 -66
  41. package/server.d.mts +3 -8
  42. package/server.d.mts.map +1 -1
  43. package/server.d.ts +3 -8
  44. package/server.d.ts.map +1 -1
  45. package/server.js +12 -65
  46. package/server.js.map +1 -1
  47. package/server.mjs +11 -62
  48. package/server.mjs.map +1 -1
  49. package/src/code-tool-types.ts +5 -1
  50. package/src/code-tool.ts +36 -121
  51. package/src/docs-search-tool.ts +8 -1
  52. package/src/http.ts +1 -19
  53. package/src/index.ts +5 -52
  54. package/src/options.ts +5 -386
  55. package/src/server.ts +12 -72
  56. package/src/stdio.ts +2 -3
  57. package/src/{tools/types.ts → types.ts} +1 -1
  58. package/stdio.d.mts +1 -2
  59. package/stdio.d.mts.map +1 -1
  60. package/stdio.d.ts +1 -2
  61. package/stdio.d.ts.map +1 -1
  62. package/stdio.js +2 -2
  63. package/stdio.js.map +1 -1
  64. package/stdio.mjs +2 -2
  65. package/stdio.mjs.map +1 -1
  66. package/{tools/types.d.mts → types.d.mts} +1 -1
  67. package/types.d.mts.map +1 -0
  68. package/{tools/types.d.ts → types.d.ts} +1 -1
  69. package/types.d.ts.map +1 -0
  70. package/types.js.map +1 -0
  71. package/types.mjs.map +1 -0
  72. package/code-tool-paths.cjs +0 -6
  73. package/code-tool-paths.cjs.map +0 -1
  74. package/code-tool-paths.d.cts +0 -2
  75. package/code-tool-paths.d.cts.map +0 -1
  76. package/code-tool-worker.d.mts +0 -5
  77. package/code-tool-worker.d.mts.map +0 -1
  78. package/code-tool-worker.d.ts +0 -5
  79. package/code-tool-worker.d.ts.map +0 -1
  80. package/code-tool-worker.js +0 -162
  81. package/code-tool-worker.js.map +0 -1
  82. package/code-tool-worker.mjs +0 -157
  83. package/code-tool-worker.mjs.map +0 -1
  84. package/compat.d.mts +0 -58
  85. package/compat.d.mts.map +0 -1
  86. package/compat.d.ts +0 -58
  87. package/compat.d.ts.map +0 -1
  88. package/compat.js +0 -387
  89. package/compat.js.map +0 -1
  90. package/compat.mjs +0 -378
  91. package/compat.mjs.map +0 -1
  92. package/dynamic-tools.d.mts +0 -12
  93. package/dynamic-tools.d.mts.map +0 -1
  94. package/dynamic-tools.d.ts +0 -12
  95. package/dynamic-tools.d.ts.map +0 -1
  96. package/dynamic-tools.js +0 -135
  97. package/dynamic-tools.js.map +0 -1
  98. package/dynamic-tools.mjs +0 -132
  99. package/dynamic-tools.mjs.map +0 -1
  100. package/filtering.d.mts +0 -3
  101. package/filtering.d.mts.map +0 -1
  102. package/filtering.d.ts +0 -3
  103. package/filtering.d.ts.map +0 -1
  104. package/filtering.js +0 -24
  105. package/filtering.js.map +0 -1
  106. package/filtering.mjs +0 -16
  107. package/filtering.mjs.map +0 -1
  108. package/src/code-tool-paths.cts +0 -3
  109. package/src/code-tool-worker.ts +0 -208
  110. package/src/compat.ts +0 -483
  111. package/src/dynamic-tools.ts +0 -153
  112. package/src/filtering.ts +0 -18
  113. package/src/tools/cart/create-cart-checkout.ts +0 -56
  114. package/src/tools/cart/items/add-cart-items.ts +0 -100
  115. package/src/tools/cart/items/clear-cart-items.ts +0 -54
  116. package/src/tools/cart/items/list-cart-items.ts +0 -54
  117. package/src/tools/cart/items/remove-cart-items.ts +0 -57
  118. package/src/tools/index.ts +0 -87
  119. package/src/tools/orders/retrieve-status-orders.ts +0 -54
  120. package/src/tools/products/retrieve-product-details.ts +0 -41
  121. package/src/tools/products/search-products.ts +0 -110
  122. package/src/tools/wallet/collect-payment-details.ts +0 -56
  123. package/src/tools.ts +0 -1
  124. package/tools/cart/create-cart-checkout.d.mts +0 -45
  125. package/tools/cart/create-cart-checkout.d.mts.map +0 -1
  126. package/tools/cart/create-cart-checkout.d.ts +0 -45
  127. package/tools/cart/create-cart-checkout.d.ts.map +0 -1
  128. package/tools/cart/create-cart-checkout.js +0 -52
  129. package/tools/cart/create-cart-checkout.js.map +0 -1
  130. package/tools/cart/create-cart-checkout.mjs +0 -48
  131. package/tools/cart/create-cart-checkout.mjs.map +0 -1
  132. package/tools/cart/items/add-cart-items.d.mts +0 -45
  133. package/tools/cart/items/add-cart-items.d.mts.map +0 -1
  134. package/tools/cart/items/add-cart-items.d.ts +0 -45
  135. package/tools/cart/items/add-cart-items.d.ts.map +0 -1
  136. package/tools/cart/items/add-cart-items.js +0 -94
  137. package/tools/cart/items/add-cart-items.js.map +0 -1
  138. package/tools/cart/items/add-cart-items.mjs +0 -90
  139. package/tools/cart/items/add-cart-items.mjs.map +0 -1
  140. package/tools/cart/items/clear-cart-items.d.mts +0 -45
  141. package/tools/cart/items/clear-cart-items.d.mts.map +0 -1
  142. package/tools/cart/items/clear-cart-items.d.ts +0 -45
  143. package/tools/cart/items/clear-cart-items.d.ts.map +0 -1
  144. package/tools/cart/items/clear-cart-items.js +0 -50
  145. package/tools/cart/items/clear-cart-items.js.map +0 -1
  146. package/tools/cart/items/clear-cart-items.mjs +0 -46
  147. package/tools/cart/items/clear-cart-items.mjs.map +0 -1
  148. package/tools/cart/items/list-cart-items.d.mts +0 -45
  149. package/tools/cart/items/list-cart-items.d.mts.map +0 -1
  150. package/tools/cart/items/list-cart-items.d.ts +0 -45
  151. package/tools/cart/items/list-cart-items.d.ts.map +0 -1
  152. package/tools/cart/items/list-cart-items.js +0 -50
  153. package/tools/cart/items/list-cart-items.js.map +0 -1
  154. package/tools/cart/items/list-cart-items.mjs +0 -46
  155. package/tools/cart/items/list-cart-items.mjs.map +0 -1
  156. package/tools/cart/items/remove-cart-items.d.mts +0 -45
  157. package/tools/cart/items/remove-cart-items.d.mts.map +0 -1
  158. package/tools/cart/items/remove-cart-items.d.ts +0 -45
  159. package/tools/cart/items/remove-cart-items.d.ts.map +0 -1
  160. package/tools/cart/items/remove-cart-items.js +0 -53
  161. package/tools/cart/items/remove-cart-items.js.map +0 -1
  162. package/tools/cart/items/remove-cart-items.mjs +0 -49
  163. package/tools/cart/items/remove-cart-items.mjs.map +0 -1
  164. package/tools/index.d.mts +0 -10
  165. package/tools/index.d.mts.map +0 -1
  166. package/tools/index.d.ts +0 -10
  167. package/tools/index.d.ts.map +0 -1
  168. package/tools/index.js +0 -71
  169. package/tools/index.js.map +0 -1
  170. package/tools/index.mjs +0 -64
  171. package/tools/index.mjs.map +0 -1
  172. package/tools/orders/retrieve-status-orders.d.mts +0 -45
  173. package/tools/orders/retrieve-status-orders.d.mts.map +0 -1
  174. package/tools/orders/retrieve-status-orders.d.ts +0 -45
  175. package/tools/orders/retrieve-status-orders.d.ts.map +0 -1
  176. package/tools/orders/retrieve-status-orders.js +0 -50
  177. package/tools/orders/retrieve-status-orders.js.map +0 -1
  178. package/tools/orders/retrieve-status-orders.mjs +0 -46
  179. package/tools/orders/retrieve-status-orders.mjs.map +0 -1
  180. package/tools/products/retrieve-product-details.d.mts +0 -45
  181. package/tools/products/retrieve-product-details.d.mts.map +0 -1
  182. package/tools/products/retrieve-product-details.d.ts +0 -45
  183. package/tools/products/retrieve-product-details.d.ts.map +0 -1
  184. package/tools/products/retrieve-product-details.js +0 -37
  185. package/tools/products/retrieve-product-details.js.map +0 -1
  186. package/tools/products/retrieve-product-details.mjs +0 -33
  187. package/tools/products/retrieve-product-details.mjs.map +0 -1
  188. package/tools/products/search-products.d.mts +0 -45
  189. package/tools/products/search-products.d.mts.map +0 -1
  190. package/tools/products/search-products.d.ts +0 -45
  191. package/tools/products/search-products.d.ts.map +0 -1
  192. package/tools/products/search-products.js +0 -106
  193. package/tools/products/search-products.js.map +0 -1
  194. package/tools/products/search-products.mjs +0 -102
  195. package/tools/products/search-products.mjs.map +0 -1
  196. package/tools/types.d.mts.map +0 -1
  197. package/tools/types.d.ts.map +0 -1
  198. package/tools/types.js.map +0 -1
  199. package/tools/types.mjs.map +0 -1
  200. package/tools/wallet/collect-payment-details.d.mts +0 -45
  201. package/tools/wallet/collect-payment-details.d.mts.map +0 -1
  202. package/tools/wallet/collect-payment-details.d.ts +0 -45
  203. package/tools/wallet/collect-payment-details.d.ts.map +0 -1
  204. package/tools/wallet/collect-payment-details.js +0 -52
  205. package/tools/wallet/collect-payment-details.js.map +0 -1
  206. package/tools/wallet/collect-payment-details.mjs +0 -48
  207. package/tools/wallet/collect-payment-details.mjs.map +0 -1
  208. package/tools.d.mts +0 -2
  209. package/tools.d.mts.map +0 -1
  210. package/tools.d.ts +0 -2
  211. package/tools.d.ts.map +0 -1
  212. package/tools.js +0 -18
  213. package/tools.js.map +0 -1
  214. package/tools.mjs +0 -2
  215. package/tools.mjs.map +0 -1
  216. /package/{tools/types.js → types.js} +0 -0
  217. /package/{tools/types.mjs → types.mjs} +0 -0
package/README.md CHANGED
@@ -24,7 +24,7 @@ For clients with a configuration JSON, it might look something like this:
24
24
  "mcpServers": {
25
25
  "henrylabs_sdk_api": {
26
26
  "command": "npx",
27
- "args": ["-y", "@henrylabs/mcp", "--client=claude", "--tools=all"],
27
+ "args": ["-y", "@henrylabs/mcp"],
28
28
  "env": {
29
29
  "HENRY_SDK_API_KEY": "My API Key",
30
30
  "HENRY_SDK_ENVIRONMENT": "sandbox"
@@ -57,110 +57,22 @@ environment variables in Claude Code's `.claude.json`, which can be found in you
57
57
  claude mcp add --transport stdio henrylabs_sdk_api --env HENRY_SDK_API_KEY="Your HENRY_SDK_API_KEY here." -- npx -y @henrylabs/mcp
58
58
  ```
59
59
 
60
- ## Exposing endpoints to your MCP Client
60
+ ## Code Mode
61
61
 
62
- There are three ways to expose endpoints as tools in the MCP server:
62
+ This MCP server is built on the "Code Mode" tool scheme. In this MCP Server,
63
+ your agent will write code against the TypeScript SDK, which will then be executed in an
64
+ isolated sandbox. To accomplish this, the server will expose two tools to your agent:
63
65
 
64
- 1. Exposing one tool per endpoint, and filtering as necessary
65
- 2. Exposing a set of tools to dynamically discover and invoke endpoints from the API
66
- 3. Exposing a docs search tool and a code execution tool, allowing the client to write code to be executed against the TypeScript client
66
+ - The first tool is a docs search tool, which can be used to generically query for
67
+ documentation about your API/SDK.
67
68
 
68
- ### Filtering endpoints and tools
69
+ - The second tool is a code tool, where the agent can write code against the TypeScript SDK.
70
+ The code will be executed in a sandbox environment without web or filesystem access. Then,
71
+ anything the code returns or prints will be returned to the agent as the result of the
72
+ tool call.
69
73
 
70
- You can run the package on the command line to discover and filter the set of tools that are exposed by the
71
- MCP Server. This can be helpful for large APIs where including all endpoints at once is too much for your AI's
72
- context window.
73
-
74
- You can filter by multiple aspects:
75
-
76
- - `--tool` includes a specific tool by name
77
- - `--resource` includes all tools under a specific resource, and can have wildcards, e.g. `my.resource*`
78
- - `--operation` includes just read (get/list) or just write operations
79
-
80
- ### Dynamic tools
81
-
82
- If you specify `--tools=dynamic` to the MCP server, instead of exposing one tool per endpoint in the API, it will
83
- expose the following tools:
84
-
85
- 1. `list_api_endpoints` - Discovers available endpoints, with optional filtering by search query
86
- 2. `get_api_endpoint_schema` - Gets detailed schema information for a specific endpoint
87
- 3. `invoke_api_endpoint` - Executes any endpoint with the appropriate parameters
88
-
89
- This allows you to have the full set of API endpoints available to your MCP Client, while not requiring that all
90
- of their schemas be loaded into context at once. Instead, the LLM will automatically use these tools together to
91
- search for, look up, and invoke endpoints dynamically. However, due to the indirect nature of the schemas, it
92
- can struggle to provide the correct properties a bit more than when tools are imported explicitly. Therefore,
93
- you can opt-in to explicit tools, the dynamic tools, or both.
94
-
95
- See more information with `--help`.
96
-
97
- All of these command-line options can be repeated, combined together, and have corresponding exclusion versions (e.g. `--no-tool`).
98
-
99
- Use `--list` to see the list of available tools, or see below.
100
-
101
- ### Code execution
102
-
103
- If you specify `--tools=code` to the MCP server, it will expose just two tools:
104
-
105
- - `search_docs` - Searches the API documentation and returns a list of markdown results
106
- - `execute` - Runs code against the TypeScript client
107
-
108
- This allows the LLM to implement more complex logic by chaining together many API calls without loading
109
- intermediary results into its context window.
110
-
111
- The code execution itself happens in a Deno sandbox that has network access only to the base URL for the API.
112
-
113
- ### Specifying the MCP Client
114
-
115
- Different clients have varying abilities to handle arbitrary tools and schemas.
116
-
117
- You can specify the client you are using with the `--client` argument, and the MCP server will automatically
118
- serve tools and schemas that are more compatible with that client.
119
-
120
- - `--client=<type>`: Set all capabilities based on a known MCP client
121
-
122
- - Valid values: `openai-agents`, `claude`, `claude-code`, `cursor`
123
- - Example: `--client=cursor`
124
-
125
- Additionally, if you have a client not on the above list, or the client has gotten better
126
- over time, you can manually enable or disable certain capabilities:
127
-
128
- - `--capability=<name>`: Specify individual client capabilities
129
- - Available capabilities:
130
- - `top-level-unions`: Enable support for top-level unions in tool schemas
131
- - `valid-json`: Enable JSON string parsing for arguments
132
- - `refs`: Enable support for $ref pointers in schemas
133
- - `unions`: Enable support for union types (anyOf) in schemas
134
- - `formats`: Enable support for format validations in schemas (e.g. date-time, email)
135
- - `tool-name-length=N`: Set maximum tool name length to N characters
136
- - Example: `--capability=top-level-unions --capability=tool-name-length=40`
137
- - Example: `--capability=top-level-unions,tool-name-length=40`
138
-
139
- ### Examples
140
-
141
- 1. Filter for read operations on cards:
142
-
143
- ```bash
144
- --resource=cards --operation=read
145
- ```
146
-
147
- 2. Exclude specific tools while including others:
148
-
149
- ```bash
150
- --resource=cards --no-tool=create_cards
151
- ```
152
-
153
- 3. Configure for Cursor client with custom max tool name length:
154
-
155
- ```bash
156
- --client=cursor --capability=tool-name-length=40
157
- ```
158
-
159
- 4. Complex filtering with multiple criteria:
160
-
161
- ```bash
162
- --resource=cards,accounts --operation=read --tag=kyc --no-tool=create_cards
163
- ```
74
+ Using this scheme, agents are capable of performing very complex tasks deterministically
75
+ and repeatably.
164
76
 
165
77
  ## Running remotely
166
78
 
@@ -185,236 +97,3 @@ A configuration JSON for this server might look like this, assuming the server i
185
97
  }
186
98
  }
187
99
  ```
188
-
189
- The command-line arguments for filtering tools and specifying clients can also be used as query parameters in the URL.
190
- For example, to exclude specific tools while including others, use the URL:
191
-
192
- ```
193
- http://localhost:3000?resource=cards&resource=accounts&no_tool=create_cards
194
- ```
195
-
196
- Or, to configure for the Cursor client, with a custom max tool name length, use the URL:
197
-
198
- ```
199
- http://localhost:3000?client=cursor&capability=tool-name-length%3D40
200
- ```
201
-
202
- ## Importing the tools and server individually
203
-
204
- ```js
205
- // Import the server, generated endpoints, or the init function
206
- import { server, endpoints, init } from "@henrylabs/mcp/server";
207
-
208
- // import a specific tool
209
- import retrieveProductDetails from "@henrylabs/mcp/tools/products/retrieve-product-details";
210
-
211
- // initialize the server and all endpoints
212
- init({ server, endpoints });
213
-
214
- // manually start server
215
- const transport = new StdioServerTransport();
216
- await server.connect(transport);
217
-
218
- // or initialize your own server with specific tools
219
- const myServer = new McpServer(...);
220
-
221
- // define your own endpoint
222
- const myCustomEndpoint = {
223
- tool: {
224
- name: 'my_custom_tool',
225
- description: 'My custom tool',
226
- inputSchema: zodToJsonSchema(z.object({ a_property: z.string() })),
227
- },
228
- handler: async (client: client, args: any) => {
229
- return { myResponse: 'Hello world!' };
230
- })
231
- };
232
-
233
- // initialize the server with your custom endpoints
234
- init({ server: myServer, endpoints: [retrieveProductDetails, myCustomEndpoint] });
235
- ```
236
-
237
- ## Available Tools
238
-
239
- The following tools are available in this MCP server.
240
-
241
- ### Resource `products`:
242
-
243
- - `retrieve_product_details` (`read`): Retrieve comprehensive product details using a product ID from search results.
244
-
245
- MUST BE CALLED BEFORE adding items to cart - this is the only way to get the productLink required for cart operations.
246
-
247
- Returns:
248
-
249
- - Product title, brand, rating, review count
250
- - Stores array with name, price, shipping, total, and LINK for each retailer
251
- - Available variants (sizes, colors, etc.) with availability status
252
- - Thumbnail images (multiple angles)
253
-
254
- - `search_products` (`write`): Search for products using keywords and filters (price range, color, size, gender, manufacturer, region).
255
-
256
- Returns basic product information:
257
-
258
- - Product ID (required for next step)
259
- - Name, price, currency, description
260
- - Thumbnail image URL
261
-
262
- You MUST call retrieve_product_details() with each product's ID to get:
263
-
264
- - Actual store links for purchasing
265
- - All available variants
266
- - Detailed reviews and ratings
267
- - Price comparisons across stores
268
-
269
- Recommended flow:
270
-
271
- 1. search_products(query, filters) - Get product IDs
272
- 2. retrieve_product_details(productId) - Get store URLs and variants for each
273
- 3. Present results with images, prices, AND clickable store links
274
-
275
- Common filters: limit (default 10), greaterThanPrice, lowerThanPrice, color, size, gender
276
-
277
- ### Resource `cart`:
278
-
279
- - `create_cart_checkout` (`write`): Generates a fully-hosted checkout URL for the user's cart. This is the SIMPLEST checkout method.
280
-
281
- The hosted page handles:
282
-
283
- - Order review
284
- - Shipping address collection
285
- - Payment information (via Stripe)
286
- - Order confirmation
287
- - All UI and validation
288
-
289
- Returns: checkout_url (direct link for user to complete purchase)
290
-
291
- Parameters:
292
-
293
- - auth: true (default) - requires user authentication, false for guest checkout
294
-
295
- Use this when:
296
-
297
- - You want a quick, complete checkout solution
298
- - Don't need custom checkout UI
299
- - Want Stripe to handle payment collection
300
-
301
- For custom checkout UI, use the headless flow instead:
302
- create_checkout_session → collect_payment_details → confirm_checkout_session
303
-
304
- ### Resource `cart.items`:
305
-
306
- - `list_cart_items` (`read`): Retrieve all products currently in the user's cart.
307
-
308
- Returns products array with:
309
-
310
- - name, price, productLink, quantity
311
- - productId (if provided when added)
312
- - metadata (variant selections)
313
- - productImageLink (thumbnail)
314
- - affiliateProductLink (if used)
315
-
316
- Use this to:
317
-
318
- - Show cart contents before checkout
319
- - Calculate totals
320
- - Verify items before creating checkout
321
-
322
- - `add_cart_items` (`write`): Add products to cart or update quantities if already in cart.
323
-
324
- Required fields per product:
325
-
326
- - name: Product name (from retrieve_product_details)
327
- - price: Price as string, e.g. "29.99" (from stores[0].price)
328
- - productLink: Store URL (from stores[0].link - MUST call retrieve_product_details first)
329
- - quantity: Number of items
330
-
331
- Optional but IMPORTANT:
332
-
333
- - metadata: Object containing variant selections (size, color, etc.)
334
- Example: {"size": "Large", "color": "Blue"}
335
- - productImageLink: Thumbnail URL (from thumbnails[0])
336
- - affiliateProductLink: Use instead of productLink for affiliate tracking
337
- - productId: Include for easier tracking
338
-
339
- VARIANT HANDLING:
340
- If retrieve_product_details shows variants array, you MUST:
341
-
342
- 1. Show variants to user: "Available sizes: S, M, L, XL"
343
- 2. Get user's selection
344
- 3. Include in metadata: {"size": "L"}
345
-
346
- Optional: Set checkVariantAvailability: true to verify variants exist at stores
347
-
348
- Returns:
349
-
350
- - added_products: New items in cart
351
- - updated_products: Items with quantity increases
352
- - cart_summary: total_items and total_unique_products
353
- - variant_checks: Availability verification results (if requested)
354
-
355
- - `clear_cart_items` (`write`): Remove ALL products from the cart. Cannot be undone.
356
-
357
- Use when:
358
-
359
- - User wants to start over
360
- - Clearing abandoned cart
361
- - After successful order completion
362
-
363
- Returns success confirmation message.
364
-
365
- - `remove_cart_items` (`write`): Remove a specific product from the cart by its productId.
366
-
367
- Required: productId (must match the ID used when adding item)
368
-
369
- Returns success confirmation message.
370
-
371
- ### Resource `orders`:
372
-
373
- - `retrieve_status_orders` (`read`): Check the status and details of an order using its order ID.
374
-
375
- Returns:
376
-
377
- - id: Order ID
378
- - status: Current order status (e.g., "processing", "shipped", "delivered")
379
- - statusMessage: Detailed status description
380
- - products: Array with productName, quantity, productMetadata (variants)
381
- - currency, subtotal, shipping, tax, grandTotal
382
- - shippingDetails: Full delivery address
383
- - userId: User who placed order
384
- - cardLast4: Payment card used (last 4 digits)
385
-
386
- Use for:
387
-
388
- - Order tracking
389
- - Status updates
390
- - Order history
391
- - Customer support
392
-
393
- ### Resource `wallet`:
394
-
395
- - `collect_payment_details` (`write`): Generate a modal URL for securely collecting payment card information via Stripe.
396
-
397
- MUST be called in headless checkout flow BEFORE confirm_checkout_session.
398
-
399
- Parameters:
400
-
401
- - auth: true (default) - requires authentication, false for guest checkout
402
-
403
- Returns:
404
-
405
- - modal_url: Stripe-hosted page for card collection
406
-
407
- Workflow:
408
-
409
- 1. Call this endpoint
410
- 2. Direct user to modal_url to enter payment details
411
- 3. After user completes payment form, proceed with confirm_checkout_session
412
-
413
- The modal handles:
414
-
415
- - PCI-compliant card collection
416
- - Card validation
417
- - Secure tokenization
418
- - Saving card for future use
419
-
420
- For hosted checkout, payment collection is automatic (use create_cart_checkout instead).
@@ -10,5 +10,7 @@ export type WorkerSuccess = {
10
10
  };
11
11
  export type WorkerError = {
12
12
  message: string | undefined;
13
+ logLines: string[];
14
+ errLines: string[];
13
15
  };
14
16
  //# sourceMappingURL=code-tool-types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-tool-types.d.mts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,gBAAgB;AAE9C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"code-tool-types.d.mts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,gBAAgB;AAE9C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC"}
@@ -10,5 +10,7 @@ export type WorkerSuccess = {
10
10
  };
11
11
  export type WorkerError = {
12
12
  message: string | undefined;
13
+ logLines: string[];
14
+ errLines: string[];
13
15
  };
14
16
  //# sourceMappingURL=code-tool-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-tool-types.d.ts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,gBAAgB;AAE9C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"code-tool-types.d.ts","sourceRoot":"","sources":["src/code-tool-types.ts"],"names":[],"mappings":"OAEO,EAAE,aAAa,EAAE,MAAM,gBAAgB;AAE9C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC"}
package/code-tool.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { Endpoint } from "./tools/types.mjs";
1
+ import { McpTool } from "./types.mjs";
2
2
  /**
3
3
  * A tool that runs code against a copy of the SDK.
4
4
  *
@@ -8,5 +8,5 @@ import { Endpoint } from "./tools/types.mjs";
8
8
  *
9
9
  * @param endpoints - The endpoints to include in the list.
10
10
  */
11
- export declare function codeTool(): Promise<Endpoint>;
11
+ export declare function codeTool(): McpTool;
12
12
  //# sourceMappingURL=code-tool.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-tool.d.mts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAKO,EAAgB,QAAQ,EAA4B;AAM3D;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,CA8HlD"}
1
+ {"version":3,"file":"code-tool.d.mts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAEO,EAAE,OAAO,EAAiD;AAIjE;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CA8ClC"}
package/code-tool.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Endpoint } from "./tools/types.js";
1
+ import { McpTool } from "./types.js";
2
2
  /**
3
3
  * A tool that runs code against a copy of the SDK.
4
4
  *
@@ -8,5 +8,5 @@ import { Endpoint } from "./tools/types.js";
8
8
  *
9
9
  * @param endpoints - The endpoints to include in the list.
10
10
  */
11
- export declare function codeTool(): Promise<Endpoint>;
11
+ export declare function codeTool(): McpTool;
12
12
  //# sourceMappingURL=code-tool.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-tool.d.ts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAKO,EAAgB,QAAQ,EAA4B;AAM3D;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,CA8HlD"}
1
+ {"version":3,"file":"code-tool.d.ts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAEO,EAAE,OAAO,EAAiD;AAIjE;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CA8ClC"}
package/code-tool.js CHANGED
@@ -1,42 +1,9 @@
1
1
  "use strict";
2
2
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || (function () {
20
- var ownKeys = function(o) {
21
- ownKeys = Object.getOwnPropertyNames || function (o) {
22
- var ar = [];
23
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
- return ar;
25
- };
26
- return ownKeys(o);
27
- };
28
- return function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
35
- })();
36
3
  Object.defineProperty(exports, "__esModule", { value: true });
37
4
  exports.codeTool = codeTool;
38
- const node_path_1 = require("node:path");
39
- const node_url_1 = require("node:url");
5
+ const types_1 = require("./types.js");
6
+ const server_1 = require("./server.js");
40
7
  /**
41
8
  * A tool that runs code against a copy of the SDK.
42
9
  *
@@ -46,109 +13,39 @@ const node_url_1 = require("node:url");
46
13
  *
47
14
  * @param endpoints - The endpoints to include in the list.
48
15
  */
49
- async function codeTool() {
16
+ function codeTool() {
50
17
  const metadata = { resource: 'all', operation: 'write', tags: [] };
51
18
  const tool = {
52
19
  name: 'execute',
53
- description: 'Runs JavaScript code to interact with the API.\n\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized client named "client", and it will be run.\nWrite code within this template:\n\n```\nasync function run(client) {\n // Fill this out\n}\n```\n\nYou will be returned anything that your function returns, plus the results of any console.log statements.\nIf any code triggers an error, the tool will return an error response, so you do not need to add error handling unless you want to output something more helpful than the raw error.\nIt is not necessary to add comments to code, unless by adding those comments you believe that you can generate better code.\nThis code will run in a container, and you will not be able to use fetch or otherwise interact with the network calls other than through the client you are given.\nAny variables you define won\'t live between successive uses of this call, so make sure to return or log any data you might need later.',
20
+ description: 'Runs JavaScript code to interact with the API.\n\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized SDK client and it will be run.\nWrite code within this template:\n\n```\nasync function run(client) {\n // Fill this out\n}\n```\n\nYou will be returned anything that your function returns, plus the results of any console.log statements.\nIf any code triggers an error, the tool will return an error response, so you do not need to add error handling unless you want to output something more helpful than the raw error.\nIt is not necessary to add comments to code, unless by adding those comments you believe that you can generate better code.\nThis code will run in a container, and you will not be able to use fetch or otherwise interact with the network calls other than through the client you are given.\nAny variables you define won\'t live between successive uses of this call, so make sure to return or log any data you might need later.',
54
21
  inputSchema: { type: 'object', properties: { code: { type: 'string' } } },
55
22
  };
56
- // Import dynamically to avoid failing at import time in cases where the environment is not well-supported.
57
- const { newDenoHTTPWorker } = await Promise.resolve().then(() => __importStar(require('@valtown/deno-http-worker')));
58
- const { workerPath } = await Promise.resolve().then(() => __importStar(require('./code-tool-paths.cjs')));
59
- const handler = async (client, args) => {
60
- const baseURLHostname = new URL(client.baseURL).hostname;
61
- const { code } = args;
62
- const worker = await newDenoHTTPWorker((0, node_url_1.pathToFileURL)(workerPath), {
63
- runFlags: [
64
- `--node-modules-dir=manual`,
65
- `--allow-read=code-tool-worker.mjs,${workerPath.replace(/([\/\\]node_modules)[\/\\].+$/, '$1')}/`,
66
- `--allow-net=${baseURLHostname}`,
67
- // Allow environment variables because instantiating the client will try to read from them,
68
- // even though they are not set.
69
- '--allow-env',
70
- ],
71
- printOutput: true,
72
- spawnOptions: {
73
- cwd: (0, node_path_1.dirname)(workerPath),
23
+ const handler = async (_, args) => {
24
+ const code = args.code;
25
+ // this is not required, but passing a Stainless API key for the matching project_name
26
+ // will allow you to run code-mode queries against non-published versions of your SDK.
27
+ const stainlessAPIKey = (0, server_1.readEnv)('STAINLESS_API_KEY');
28
+ const codeModeEndpoint = (0, server_1.readEnv)('CODE_MODE_ENDPOINT_URL') ?? 'https://api.stainless.com/api/ai/code-tool';
29
+ const res = await fetch(codeModeEndpoint, {
30
+ method: 'POST',
31
+ headers: {
32
+ ...(stainlessAPIKey && { Authorization: stainlessAPIKey }),
33
+ 'Content-Type': 'application/json',
34
+ client_envs: JSON.stringify({
35
+ HENRY_SDK_API_KEY: (0, server_1.readEnv)('HENRY_SDK_API_KEY'),
36
+ HENRY_SDK_BASE_URL: (0, server_1.readEnv)('HENRY_SDK_BASE_URL'),
37
+ }),
74
38
  },
39
+ body: JSON.stringify({
40
+ project_name: 'henry-sdk',
41
+ client_opts: { environment: ((0, server_1.readEnv)('HENRY_SDK_ENVIRONMENT') || undefined) },
42
+ code,
43
+ }),
75
44
  });
76
- try {
77
- const resp = await new Promise((resolve, reject) => {
78
- worker.addEventListener('exit', (exitCode) => {
79
- reject(new Error(`Worker exited with code ${exitCode}`));
80
- });
81
- const opts = {
82
- baseURL: client.baseURL,
83
- apiKey: client.apiKey,
84
- defaultHeaders: {
85
- 'X-Stainless-MCP': 'true',
86
- },
87
- };
88
- const req = worker.request('http://localhost', {
89
- headers: {
90
- 'content-type': 'application/json',
91
- },
92
- method: 'POST',
93
- }, (resp) => {
94
- const body = [];
95
- resp.on('error', (err) => {
96
- reject(err);
97
- });
98
- resp.on('data', (chunk) => {
99
- body.push(chunk);
100
- });
101
- resp.on('end', () => {
102
- resolve(new Response(Buffer.concat(body).toString(), {
103
- status: resp.statusCode ?? 200,
104
- headers: resp.headers,
105
- }));
106
- });
107
- });
108
- const body = JSON.stringify({
109
- opts,
110
- code,
111
- });
112
- req.write(body, (err) => {
113
- if (err != null) {
114
- reject(err);
115
- }
116
- });
117
- req.end();
118
- });
119
- if (resp.status === 200) {
120
- const { result, logLines, errLines } = (await resp.json());
121
- const returnOutput = result == null ? null : ({
122
- type: 'text',
123
- text: typeof result === 'string' ? result : JSON.stringify(result),
124
- });
125
- const logOutput = logLines.length === 0 ?
126
- null
127
- : {
128
- type: 'text',
129
- text: logLines.join('\n'),
130
- };
131
- const errOutput = errLines.length === 0 ?
132
- null
133
- : {
134
- type: 'text',
135
- text: 'Error output:\n' + errLines.join('\n'),
136
- };
137
- return {
138
- content: [returnOutput, logOutput, errOutput].filter((block) => block !== null),
139
- };
140
- }
141
- else {
142
- const { message } = (await resp.json());
143
- return {
144
- content: message == null ? [] : [{ type: 'text', text: message }],
145
- isError: true,
146
- };
147
- }
148
- }
149
- finally {
150
- worker.terminate();
45
+ if (!res.ok) {
46
+ throw new Error(`${res.status}: ${res.statusText} error when trying to contact Code Tool server. Details: ${await res.text()}`);
151
47
  }
48
+ return (0, types_1.asTextContentResult)((await res.json()));
152
49
  };
153
50
  return { metadata, tool, handler };
154
51
  }
package/code-tool.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"code-tool.js","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBtF,4BA8HC;AAhJD,yCAAoC;AACpC,uCAAyC;AAQzC;;;;;;;;GAQG;AACI,KAAK,UAAU,QAAQ;IAC5B,MAAM,QAAQ,GAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IAC7E,MAAM,IAAI,GAAS;QACjB,IAAI,EAAE,SAAS;QACf,WAAW,EACT,6iCAA6iC;QAC/iC,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;KAC1E,CAAC;IAEF,2GAA2G;IAC3G,MAAM,EAAE,iBAAiB,EAAE,GAAG,wDAAa,2BAA2B,GAAC,CAAC;IACxE,MAAM,EAAE,UAAU,EAAE,GAAG,wDAAa,uBAAuB,GAAC,CAAC;IAE7D,MAAM,OAAO,GAAG,KA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