@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.
- package/README.md +62 -0
- package/dist/aws.d.ts +197 -0
- package/dist/index.js +1179 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/prompts/Jaypie_CDK_Constructs_and_Patterns.md +23 -28
- package/prompts/Jaypie_CICD_with_GitHub_Actions.md +141 -14
- package/prompts/Jaypie_DynamoDB_Package.md +55 -55
- package/prompts/Jaypie_Express_Package.md +0 -44
- package/prompts/{Jaypie_Vocabulary_Commander.md → Jaypie_Fabric_Commander.md} +38 -38
- package/prompts/{Jaypie_Vocabulary_LLM.md → Jaypie_Fabric_LLM.md} +45 -45
- package/prompts/{Jaypie_Vocabulary_Lambda.md → Jaypie_Fabric_Lambda.md} +40 -42
- package/prompts/{Jaypie_Vocabulary_MCP.md → Jaypie_Fabric_MCP.md} +39 -39
- package/prompts/{Jaypie_Vocabulary_Package.md → Jaypie_Fabric_Package.md} +151 -142
- package/prompts/Jaypie_Init_CICD_with_GitHub_Actions.md +151 -104
- package/prompts/Jaypie_MCP_Package.md +249 -0
- package/prompts/Jaypie_Streaming.md +408 -0
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: AWS Lambda integration with
|
|
2
|
+
description: AWS Lambda integration with fabricService for event processing and callbacks
|
|
3
3
|
include: "**/lambda/**"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Jaypie
|
|
6
|
+
# Jaypie Fabric Lambda Adapter
|
|
7
7
|
|
|
8
|
-
The Lambda adapter (`@jaypie/
|
|
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:** [
|
|
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/
|
|
15
|
+
npm install @jaypie/fabric
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Quick Start
|
|
19
19
|
|
|
20
20
|
```typescript
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
21
|
+
import { fabricService } from "@jaypie/fabric";
|
|
22
|
+
import { fabricLambda } from "@jaypie/fabric/lambda";
|
|
23
23
|
|
|
24
|
-
const handler =
|
|
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 =
|
|
32
|
+
export const lambdaHandler = fabricLambda({ service: handler });
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
##
|
|
35
|
+
## fabricLambda
|
|
36
36
|
|
|
37
|
-
Wraps a
|
|
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
|
-
| `
|
|
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 {
|
|
63
|
-
import {
|
|
62
|
+
import { fabricService } from "@jaypie/fabric";
|
|
63
|
+
import { fabricLambda } from "@jaypie/fabric/lambda";
|
|
64
64
|
|
|
65
|
-
const handler =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 {
|
|
201
|
-
import {
|
|
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 =
|
|
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 =
|
|
228
|
-
|
|
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 =
|
|
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/
|
|
285
|
+
} from "@jaypie/fabric/lambda";
|
|
287
286
|
```
|
|
288
287
|
|
|
289
288
|
## Exports
|
|
290
289
|
|
|
291
290
|
```typescript
|
|
292
|
-
// @jaypie/
|
|
293
|
-
export {
|
|
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
|
-
- [
|
|
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
|
|
2
|
+
description: MCP server tool registration from fabricService
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
# Jaypie
|
|
5
|
+
# Jaypie Fabric MCP Adapter
|
|
6
6
|
|
|
7
|
-
The MCP adapter (`@jaypie/
|
|
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:** [
|
|
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/
|
|
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 {
|
|
22
|
-
import {
|
|
21
|
+
import { fabricService } from "@jaypie/fabric";
|
|
22
|
+
import { fabricMcp } from "@jaypie/fabric/mcp";
|
|
23
23
|
|
|
24
|
-
const handler =
|
|
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
|
-
|
|
38
|
+
fabricMcp({ service: handler, server });
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## fabricMcp
|
|
42
42
|
|
|
43
|
-
Registers a
|
|
43
|
+
Registers a fabricService as an MCP tool.
|
|
44
44
|
|
|
45
45
|
### Options
|
|
46
46
|
|
|
47
47
|
| Option | Type | Description |
|
|
48
48
|
|--------|------|-------------|
|
|
49
|
-
| `
|
|
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 {
|
|
63
|
-
import {
|
|
62
|
+
import { fabricService } from "@jaypie/fabric";
|
|
63
|
+
import { fabricMcp } from "@jaypie/fabric/mcp";
|
|
64
64
|
|
|
65
|
-
const calculateHandler =
|
|
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
|
-
|
|
84
|
+
fabricMcp({ service: calculateHandler, server });
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
### Overriding Name and Description
|
|
88
88
|
|
|
89
89
|
```typescript
|
|
90
|
-
|
|
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 =
|
|
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
|
-
|
|
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 {
|
|
169
|
-
import {
|
|
168
|
+
import { fabricService } from "@jaypie/fabric";
|
|
169
|
+
import { fabricMcp } from "@jaypie/fabric/mcp";
|
|
170
170
|
|
|
171
171
|
// Define handlers
|
|
172
|
-
const weatherHandler =
|
|
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 =
|
|
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
|
-
|
|
209
|
-
|
|
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
|
-
|
|
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
|
|
260
|
-
|
|
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
|
|
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/
|
|
279
|
-
export {
|
|
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
|
-
- [
|
|
296
|
-
- [
|
|
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)
|