@jaypie/mcp 0.2.10 → 0.3.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.
@@ -1,27 +1,27 @@
1
1
  ---
2
- description: AWS Lambda integration with serviceHandler for event processing and callbacks
2
+ description: AWS Lambda integration with fabricService for event processing and callbacks
3
3
  include: "**/lambda/**"
4
4
  ---
5
5
 
6
- # Jaypie Vocabulary Lambda Adapter
6
+ # Jaypie Fabric Lambda Adapter
7
7
 
8
- The Lambda adapter (`@jaypie/vocabulary/lambda`) wraps Jaypie service handlers for use as AWS Lambda handlers, providing automatic event parsing, secrets management, and lifecycle hooks.
8
+ The Lambda adapter (`@jaypie/fabric/lambda`) wraps Jaypie service handlers for use as AWS Lambda handlers, providing automatic event parsing, secrets management, and lifecycle hooks.
9
9
 
10
- **See also:** [Jaypie_Vocabulary_Package.md](Jaypie_Vocabulary_Package.md) for core serviceHandler documentation.
10
+ **See also:** [Jaypie_Fabric_Package.md](Jaypie_Fabric_Package.md) for core fabricService documentation.
11
11
 
12
12
  ## Installation
13
13
 
14
14
  ```bash
15
- npm install @jaypie/vocabulary
15
+ npm install @jaypie/fabric
16
16
  ```
17
17
 
18
18
  ## Quick Start
19
19
 
20
20
  ```typescript
21
- import { serviceHandler } from "@jaypie/vocabulary";
22
- import { lambdaServiceHandler } from "@jaypie/vocabulary/lambda";
21
+ import { fabricService } from "@jaypie/fabric";
22
+ import { fabricLambda } from "@jaypie/fabric/lambda";
23
23
 
24
- const handler = serviceHandler({
24
+ const handler = fabricService({
25
25
  alias: "processOrder",
26
26
  input: { orderId: { type: String } },
27
27
  service: async ({ orderId }) => {
@@ -29,18 +29,18 @@ const handler = serviceHandler({
29
29
  },
30
30
  });
31
31
 
32
- export const lambdaHandler = lambdaServiceHandler({ handler });
32
+ export const lambdaHandler = fabricLambda({ service: handler });
33
33
  ```
34
34
 
35
- ## lambdaServiceHandler
35
+ ## fabricLambda
36
36
 
37
- Wraps a serviceHandler for use as an AWS Lambda handler.
37
+ Wraps a fabricService for use as an AWS Lambda handler.
38
38
 
39
39
  ### Options
40
40
 
41
41
  | Option | Type | Description |
42
42
  |--------|------|-------------|
43
- | `handler` | `ServiceHandlerFunction` | Required. The service handler to wrap |
43
+ | `service` | `Service` | Required. The service handler to wrap |
44
44
  | `chaos` | `string` | Chaos testing mode |
45
45
  | `name` | `string` | Override handler name for logging (default: handler.alias) |
46
46
  | `onComplete` | `OnCompleteCallback` | Called with handler's return value on success |
@@ -59,10 +59,10 @@ Wraps a serviceHandler for use as an AWS Lambda handler.
59
59
  Services can use context callbacks to report progress, errors, and completion:
60
60
 
61
61
  ```typescript
62
- import { serviceHandler } from "@jaypie/vocabulary";
63
- import { lambdaServiceHandler } from "@jaypie/vocabulary/lambda";
62
+ import { fabricService } from "@jaypie/fabric";
63
+ import { fabricLambda } from "@jaypie/fabric/lambda";
64
64
 
65
- const handler = serviceHandler({
65
+ const handler = fabricService({
66
66
  alias: "evaluate",
67
67
  input: { jobId: { type: String } },
68
68
  service: async ({ jobId }, context) => {
@@ -84,8 +84,8 @@ const handler = serviceHandler({
84
84
  },
85
85
  });
86
86
 
87
- export const lambdaHandler = lambdaServiceHandler({
88
- handler,
87
+ export const lambdaHandler = fabricLambda({
88
+ service: handler,
89
89
  onComplete: (response) => {
90
90
  console.log("Done:", JSON.stringify(response, null, 2));
91
91
  },
@@ -110,8 +110,8 @@ export const lambdaHandler = lambdaServiceHandler({
110
110
  Automatically loads AWS Secrets Manager values into `process.env`:
111
111
 
112
112
  ```typescript
113
- export const lambdaHandler = lambdaServiceHandler({
114
- handler,
113
+ export const lambdaHandler = fabricLambda({
114
+ service: handler,
115
115
  secrets: ["ANTHROPIC_API_KEY", "DATABASE_URL"],
116
116
  });
117
117
  // Before handler runs, secrets are fetched and available as:
@@ -126,8 +126,8 @@ export const lambdaHandler = lambdaServiceHandler({
126
126
  Functions to run before the handler:
127
127
 
128
128
  ```typescript
129
- export const lambdaHandler = lambdaServiceHandler({
130
- handler,
129
+ export const lambdaHandler = fabricLambda({
130
+ service: handler,
131
131
  setup: [
132
132
  async () => {
133
133
  await initializeDatabase();
@@ -144,8 +144,8 @@ export const lambdaHandler = lambdaServiceHandler({
144
144
  Functions to run after the handler (always runs, even on error):
145
145
 
146
146
  ```typescript
147
- export const lambdaHandler = lambdaServiceHandler({
148
- handler,
147
+ export const lambdaHandler = fabricLambda({
148
+ service: handler,
149
149
  teardown: [
150
150
  async () => {
151
151
  await closeConnections();
@@ -159,8 +159,8 @@ export const lambdaHandler = lambdaServiceHandler({
159
159
  Validation functions to run before handler. If any returns falsy or throws, handler is skipped:
160
160
 
161
161
  ```typescript
162
- export const lambdaHandler = lambdaServiceHandler({
163
- handler,
162
+ export const lambdaHandler = fabricLambda({
163
+ service: handler,
164
164
  validate: [
165
165
  (event) => event.headers?.authorization !== undefined,
166
166
  async (event) => {
@@ -197,11 +197,11 @@ const results = await lambdaHandler(sqsBatchEvent);
197
197
  ## Complete Example
198
198
 
199
199
  ```typescript
200
- import { serviceHandler } from "@jaypie/vocabulary";
201
- import { lambdaServiceHandler } from "@jaypie/vocabulary/lambda";
200
+ import { fabricService } from "@jaypie/fabric";
201
+ import { fabricLambda } from "@jaypie/fabric/lambda";
202
202
  import log from "@jaypie/logger";
203
203
 
204
- const processOrderHandler = serviceHandler({
204
+ const processOrderHandler = fabricService({
205
205
  alias: "processOrder",
206
206
  description: "Process an incoming order",
207
207
  input: {
@@ -224,8 +224,8 @@ const processOrderHandler = serviceHandler({
224
224
  },
225
225
  });
226
226
 
227
- export const handler = lambdaServiceHandler({
228
- handler: processOrderHandler,
227
+ export const handler = fabricLambda({
228
+ service: processOrderHandler,
229
229
  name: "order-processor",
230
230
  secrets: ["DATABASE_URL", "STRIPE_API_KEY"],
231
231
  setup: [
@@ -265,8 +265,8 @@ Errors are caught and returned as structured error responses:
265
265
  Set `throw: true` to re-throw errors (useful for SQS retry behavior):
266
266
 
267
267
  ```typescript
268
- export const lambdaHandler = lambdaServiceHandler({
269
- handler,
268
+ export const lambdaHandler = fabricLambda({
269
+ service: handler,
270
270
  throw: true, // Errors will propagate, triggering SQS retry
271
271
  });
272
272
  ```
@@ -275,28 +275,26 @@ export const lambdaHandler = lambdaServiceHandler({
275
275
 
276
276
  ```typescript
277
277
  import type {
278
+ FabricLambdaConfig,
279
+ FabricLambdaOptions,
278
280
  LambdaContext,
279
- LambdaServiceHandlerConfig,
280
- LambdaServiceHandlerOptions,
281
- LambdaServiceHandlerResult,
282
281
  OnCompleteCallback,
283
282
  OnErrorCallback,
284
283
  OnFatalCallback,
285
284
  OnMessageCallback,
286
- } from "@jaypie/vocabulary/lambda";
285
+ } from "@jaypie/fabric/lambda";
287
286
  ```
288
287
 
289
288
  ## Exports
290
289
 
291
290
  ```typescript
292
- // @jaypie/vocabulary/lambda
293
- export { lambdaServiceHandler } from "./lambdaServiceHandler.js";
291
+ // @jaypie/fabric/lambda
292
+ export { fabricLambda } from "./fabricLambda.js";
294
293
 
295
294
  export type {
295
+ FabricLambdaConfig,
296
+ FabricLambdaOptions,
296
297
  LambdaContext,
297
- LambdaServiceHandlerConfig,
298
- LambdaServiceHandlerOptions,
299
- LambdaServiceHandlerResult,
300
298
  OnCompleteCallback,
301
299
  OnErrorCallback,
302
300
  OnFatalCallback,
@@ -306,5 +304,5 @@ export type {
306
304
 
307
305
  ## Related
308
306
 
309
- - [Jaypie_Vocabulary_Package.md](Jaypie_Vocabulary_Package.md) - Core serviceHandler and type coercion
307
+ - [Jaypie_Fabric_Package.md](Jaypie_Fabric_Package.md) - Core fabricService and type conversion
310
308
  - [Jaypie_Init_Lambda_Package.md](Jaypie_Init_Lambda_Package.md) - Setting up Lambda projects
@@ -1,27 +1,27 @@
1
1
  ---
2
- description: MCP server tool registration from serviceHandler
2
+ description: MCP server tool registration from fabricService
3
3
  ---
4
4
 
5
- # Jaypie Vocabulary MCP Adapter
5
+ # Jaypie Fabric MCP Adapter
6
6
 
7
- The MCP adapter (`@jaypie/vocabulary/mcp`) registers Jaypie service handlers as MCP (Model Context Protocol) tools for use with MCP servers.
7
+ The MCP adapter (`@jaypie/fabric/mcp`) registers Jaypie service handlers as MCP (Model Context Protocol) tools for use with MCP servers.
8
8
 
9
- **See also:** [Jaypie_Vocabulary_Package.md](Jaypie_Vocabulary_Package.md) for core serviceHandler documentation.
9
+ **See also:** [Jaypie_Fabric_Package.md](Jaypie_Fabric_Package.md) for core fabricService documentation.
10
10
 
11
11
  ## Installation
12
12
 
13
13
  ```bash
14
- npm install @jaypie/vocabulary @modelcontextprotocol/sdk
14
+ npm install @jaypie/fabric @modelcontextprotocol/sdk
15
15
  ```
16
16
 
17
17
  ## Quick Start
18
18
 
19
19
  ```typescript
20
20
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
21
- import { serviceHandler } from "@jaypie/vocabulary";
22
- import { registerMcpTool } from "@jaypie/vocabulary/mcp";
21
+ import { fabricService } from "@jaypie/fabric";
22
+ import { fabricMcp } from "@jaypie/fabric/mcp";
23
23
 
24
- const handler = serviceHandler({
24
+ const handler = fabricService({
25
25
  alias: "greet",
26
26
  description: "Greet a user by name",
27
27
  input: {
@@ -35,18 +35,18 @@ const handler = serviceHandler({
35
35
  });
36
36
 
37
37
  const server = new McpServer({ name: "my-server", version: "1.0.0" });
38
- registerMcpTool({ handler, server });
38
+ fabricMcp({ service: handler, server });
39
39
  ```
40
40
 
41
- ## registerMcpTool
41
+ ## fabricMcp
42
42
 
43
- Registers a serviceHandler as an MCP tool.
43
+ Registers a fabricService as an MCP tool.
44
44
 
45
45
  ### Options
46
46
 
47
47
  | Option | Type | Description |
48
48
  |--------|------|-------------|
49
- | `handler` | `ServiceHandlerFunction` | Required. The service handler to adapt |
49
+ | `service` | `Service` | Required. The service handler to adapt |
50
50
  | `server` | `McpServer` | Required. The MCP server to register with |
51
51
  | `name` | `string` | Override tool name (defaults to handler.alias) |
52
52
  | `description` | `string` | Override tool description (defaults to handler.description) |
@@ -59,10 +59,10 @@ Registers a serviceHandler as an MCP tool.
59
59
 
60
60
  ```typescript
61
61
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
62
- import { serviceHandler } from "@jaypie/vocabulary";
63
- import { registerMcpTool } from "@jaypie/vocabulary/mcp";
62
+ import { fabricService } from "@jaypie/fabric";
63
+ import { fabricMcp } from "@jaypie/fabric/mcp";
64
64
 
65
- const calculateHandler = serviceHandler({
65
+ const calculateHandler = fabricService({
66
66
  alias: "calculate",
67
67
  description: "Perform a mathematical calculation",
68
68
  input: {
@@ -81,14 +81,14 @@ const calculateHandler = serviceHandler({
81
81
  });
82
82
 
83
83
  const server = new McpServer({ name: "calculator", version: "1.0.0" });
84
- registerMcpTool({ handler: calculateHandler, server });
84
+ fabricMcp({ service: calculateHandler, server });
85
85
  ```
86
86
 
87
87
  ### Overriding Name and Description
88
88
 
89
89
  ```typescript
90
- registerMcpTool({
91
- handler,
90
+ fabricMcp({
91
+ service: handler,
92
92
  server,
93
93
  name: "math_calculate",
94
94
  description: "A tool for performing basic math operations",
@@ -100,7 +100,7 @@ registerMcpTool({
100
100
  Services can use context callbacks to report progress, errors, and completion:
101
101
 
102
102
  ```typescript
103
- const handler = serviceHandler({
103
+ const handler = fabricService({
104
104
  alias: "evaluate",
105
105
  input: { jobId: { type: String } },
106
106
  service: async ({ jobId }, context) => {
@@ -116,8 +116,8 @@ const handler = serviceHandler({
116
116
  },
117
117
  });
118
118
 
119
- registerMcpTool({
120
- handler,
119
+ fabricMcp({
120
+ service: handler,
121
121
  server,
122
122
  onComplete: (result) => console.log("Tool completed:", result),
123
123
  onError: (error) => console.warn("Recoverable error:", error),
@@ -165,11 +165,11 @@ For string responses:
165
165
  ```typescript
166
166
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
167
167
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
168
- import { serviceHandler } from "@jaypie/vocabulary";
169
- import { registerMcpTool } from "@jaypie/vocabulary/mcp";
168
+ import { fabricService } from "@jaypie/fabric";
169
+ import { fabricMcp } from "@jaypie/fabric/mcp";
170
170
 
171
171
  // Define handlers
172
- const weatherHandler = serviceHandler({
172
+ const weatherHandler = fabricService({
173
173
  alias: "get_weather",
174
174
  description: "Get current weather for a location",
175
175
  input: {
@@ -187,7 +187,7 @@ const weatherHandler = serviceHandler({
187
187
  },
188
188
  });
189
189
 
190
- const searchHandler = serviceHandler({
190
+ const searchHandler = fabricService({
191
191
  alias: "search",
192
192
  description: "Search for information",
193
193
  input: {
@@ -205,8 +205,8 @@ const server = new McpServer({
205
205
  version: "1.0.0",
206
206
  });
207
207
 
208
- registerMcpTool({ handler: weatherHandler, server });
209
- registerMcpTool({ handler: searchHandler, server });
208
+ fabricMcp({ service: weatherHandler, server });
209
+ fabricMcp({ service: searchHandler, server });
210
210
 
211
211
  // Start server
212
212
  const transport = new StdioServerTransport();
@@ -233,15 +233,15 @@ input: {
233
233
 
234
234
  ```typescript
235
235
  import type {
236
+ FabricMcpConfig,
237
+ FabricMcpResult,
236
238
  McpToolContentItem,
237
239
  McpToolResponse,
238
240
  OnCompleteCallback,
239
241
  OnErrorCallback,
240
242
  OnFatalCallback,
241
243
  OnMessageCallback,
242
- RegisterMcpToolConfig,
243
- RegisterMcpToolResult,
244
- } from "@jaypie/vocabulary/mcp";
244
+ } from "@jaypie/fabric/mcp";
245
245
  ```
246
246
 
247
247
  ### Type Definitions
@@ -256,8 +256,8 @@ interface McpToolResponse {
256
256
  content: McpToolContentItem[];
257
257
  }
258
258
 
259
- interface RegisterMcpToolConfig {
260
- handler: ServiceHandlerFunction;
259
+ interface FabricMcpConfig {
260
+ service: Service;
261
261
  server: McpServer;
262
262
  name?: string;
263
263
  description?: string;
@@ -267,7 +267,7 @@ interface RegisterMcpToolConfig {
267
267
  onMessage?: OnMessageCallback;
268
268
  }
269
269
 
270
- interface RegisterMcpToolResult {
270
+ interface FabricMcpResult {
271
271
  name: string;
272
272
  }
273
273
  ```
@@ -275,22 +275,22 @@ interface RegisterMcpToolResult {
275
275
  ## Exports
276
276
 
277
277
  ```typescript
278
- // @jaypie/vocabulary/mcp
279
- export { registerMcpTool } from "./registerMcpTool.js";
278
+ // @jaypie/fabric/mcp
279
+ export { fabricMcp } from "./fabricMcp.js";
280
280
 
281
281
  export type {
282
+ FabricMcpConfig,
283
+ FabricMcpResult,
282
284
  McpToolContentItem,
283
285
  McpToolResponse,
284
286
  OnCompleteCallback,
285
287
  OnErrorCallback,
286
288
  OnFatalCallback,
287
289
  OnMessageCallback,
288
- RegisterMcpToolConfig,
289
- RegisterMcpToolResult,
290
290
  } from "./types.js";
291
291
  ```
292
292
 
293
293
  ## Related
294
294
 
295
- - [Jaypie_Vocabulary_Package.md](Jaypie_Vocabulary_Package.md) - Core serviceHandler and type coercion
296
- - [Jaypie_Vocabulary_LLM.md](Jaypie_Vocabulary_LLM.md) - LLM tool creation (similar pattern)
295
+ - [Jaypie_Fabric_Package.md](Jaypie_Fabric_Package.md) - Core fabricService and type conversion
296
+ - [Jaypie_Fabric_LLM.md](Jaypie_Fabric_LLM.md) - LLM tool creation (similar pattern)