@jaypie/mcp 0.8.152 → 0.8.153

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 (39) hide show
  1. package/README.md +34 -0
  2. package/dist/createMcpServer.d.ts +5 -0
  3. package/dist/createMcpServer.js +3 -2
  4. package/dist/createMcpServer.js.map +1 -1
  5. package/dist/http/index.d.ts +92 -0
  6. package/dist/http/index.js +3 -0
  7. package/dist/http/index.js.map +1 -0
  8. package/dist/http/mcpHttpHandler.d.ts +35 -0
  9. package/dist/http/mcpHttpHandler.js +99 -0
  10. package/dist/http/mcpHttpHandler.js.map +1 -0
  11. package/dist/http/rpc.d.ts +70 -0
  12. package/dist/http/rpc.js +262 -0
  13. package/dist/http/rpc.js.map +1 -0
  14. package/dist/http/tools.d.ts +16 -0
  15. package/dist/http/tools.js +23 -0
  16. package/dist/http/tools.js.map +1 -0
  17. package/dist/index.d.ts +10 -0
  18. package/dist/mcpExpressHandler.d.ts +5 -0
  19. package/dist/mcpExpressHandler.js +2 -2
  20. package/dist/mcpExpressHandler.js.map +1 -1
  21. package/dist/suites/docs/index.js +1 -1
  22. package/package.json +27 -3
  23. package/release-notes/constructs/1.2.82.md +16 -0
  24. package/release-notes/datadog/1.2.8.md +19 -0
  25. package/release-notes/dynamodb/0.6.11.md +13 -0
  26. package/release-notes/express/1.2.37.md +34 -0
  27. package/release-notes/fabric/0.3.12.md +20 -0
  28. package/release-notes/jaypie/1.2.101.md +12 -0
  29. package/release-notes/mcp/0.8.153.md +37 -0
  30. package/release-notes/testkit/1.2.73.md +15 -0
  31. package/skills/aws.md +2 -1
  32. package/skills/cdk.md +5 -5
  33. package/skills/datadog.md +15 -2
  34. package/skills/dynamodb.md +3 -7
  35. package/skills/express.md +56 -2
  36. package/skills/fabric.md +14 -1
  37. package/skills/lambda.md +3 -3
  38. package/skills/mcp.md +79 -1
  39. package/skills/streaming.md +3 -1
package/skills/lambda.md CHANGED
@@ -159,13 +159,13 @@ Deploy with `@jaypie/constructs`:
159
159
  import { JaypieLambda } from "@jaypie/constructs";
160
160
 
161
161
  new JaypieLambda(this, "Handler", {
162
- entry: "src/handler.ts",
163
- handler: "handler",
162
+ code: "../api/dist",
163
+ handler: "index.handler",
164
164
  secrets: ["MY_SECRET"],
165
165
  });
166
166
  ```
167
167
 
168
- **Build order**: When using `code: "../package/dist"` instead of `entry`, ensure the package has a `build` script and builds before CDK synth in CI/CD. New packages need to be added to `build:core-deps` in root `package.json` if they're build-time dependencies. See `skill("cicd")` for details.
168
+ **Build order**: When using `code: "../package/dist"`, ensure the package has a `build` script and builds before CDK synth in CI/CD. New packages need to be added to `build:core-deps` in root `package.json` if they're build-time dependencies. See `skill("cicd")` for details.
169
169
 
170
170
  ## ESM Deployment
171
171
 
package/skills/mcp.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: Jaypie MCP server tools reference
3
- related: mcp-datadog, debugging
3
+ related: mcp-datadog, debugging, express, fabric, streaming
4
4
  ---
5
5
 
6
6
  # Jaypie MCP
@@ -53,6 +53,84 @@ datadog("monitors", { status: ["Alert", "Warn"] })
53
53
  | `metrics` | Query timeseries metrics |
54
54
  | `rum` | Search RUM events |
55
55
 
56
+ ## Serving MCP over HTTP
57
+
58
+ ### Streamable HTTP without the SDK (`@jaypie/mcp/http`)
59
+
60
+ `mcpHttpHandler` serves a fabric `ServiceSuite` as MCP streamable HTTP from an Express route or a Jaypie Lambda. It implements stateless JSON-RPC 2.0 directly and never loads `@modelcontextprotocol/sdk`, whose Node transport fails against `LambdaRequest`.
61
+
62
+ ```typescript
63
+ import express from "express";
64
+ import { createLambdaStreamHandler } from "@jaypie/express";
65
+ import { mcpHttpHandler } from "@jaypie/mcp/http";
66
+
67
+ const app = express();
68
+ app.use(express.json());
69
+ app.all(
70
+ "/mcp",
71
+ mcpHttpHandler({
72
+ secrets: ["PROJECT_API_KEY"],
73
+ services: ["skill", "version", "release_notes"],
74
+ setup: requireApiKey,
75
+ }),
76
+ );
77
+
78
+ export const handler = createLambdaStreamHandler(app);
79
+ ```
80
+
81
+ | Request | Response |
82
+ |---------|----------|
83
+ | POST, `Accept` absent or prefers `application/json` | 200 JSON (one response, or an array for a batch) |
84
+ | POST, `Accept` prefers `text/event-stream` | 200 SSE via `expressStreamHandler({ format: "sse" })`, one `event: message` per response |
85
+ | POST carrying only notifications | 202, no body |
86
+ | GET, DELETE, any other method | 405 with `Allow: POST` |
87
+
88
+ Methods: `initialize` (echoes a supported `protocolVersion`, else `2025-06-18`), `notifications/initialized`, `notifications/cancelled`, `ping`, `tools/list`, `tools/call`. Errors: `-32700` unparseable body, `-32600` invalid request or empty batch, `-32601` unknown method, `-32602` unknown tool or non-object arguments. A tool that throws answers `isError: true`; a Jaypie error surfaces its message, any other error answers "The tool call failed".
89
+
90
+ | Option | Default | Description |
91
+ |--------|---------|-------------|
92
+ | `suite` | Jaypie MCP suite (loaded on first request) | `ServiceSuite` served as tools |
93
+ | `services` | all | Allowlist of service aliases exposed as tools |
94
+ | `name` | `suite.name` | `serverInfo.name` reported by `initialize` |
95
+ | `version` | `suite.version` | `serverInfo.version` reported by `initialize` |
96
+ | `chaos`, `locals`, `secrets`, `setup`, `teardown`, `unavailable`, `validate`, ... | | Passed to `expressHandler` and `expressStreamHandler` |
97
+
98
+ `handleMcpRpcBody(body, options)` and `handleMcpRpc(request, options)` expose the JSON-RPC layer for other transports. `@jaypie/express` and `@jaypie/logger` are optional peer dependencies required by this entry point; `jaypie` provides both.
99
+
100
+ #### Lambda Deployment
101
+
102
+ - **Streaming**: `createLambdaStreamHandler(app)` behind a Function URL with `RESPONSE_STREAM` invoke mode (for example `JaypieDistribution` with `streaming: true`). Both JSON and SSE responses work.
103
+ - **Buffered**: `createLambdaHandler(app)` behind API Gateway or a buffered Function URL. JSON responses work; SSE responses arrive when the request completes.
104
+ - The endpoint is stateless: no sessions, no `Mcp-Session-Id`, no server-initiated GET stream. Every POST stands alone, which suits Lambda.
105
+ - Put authentication in `setup` or `validate` so it runs for both JSON and SSE requests.
106
+
107
+ ### SDK Transport (`mcpExpressHandler`)
108
+
109
+ `mcpExpressHandler` from `@jaypie/mcp` wraps the SDK's `StreamableHTTPServerTransport` with optional sessions. It suits a long-running Express server, not Lambda.
110
+
111
+ ```typescript
112
+ import express from "express";
113
+ import { mcpExpressHandler } from "@jaypie/mcp";
114
+
115
+ const app = express();
116
+ app.use(express.json());
117
+ app.use("/mcp", await mcpExpressHandler({ services: ["skill"], version: "1.0.0" }));
118
+ ```
119
+
120
+ ## Filtering Tools
121
+
122
+ Every server factory accepts `services`, an allowlist of service aliases. Omit it to expose every tool; an empty array exposes none; unknown aliases are ignored. All share `selectServiceFunctions` from `@jaypie/fabric`.
123
+
124
+ ```typescript
125
+ import { createMcpServer } from "@jaypie/mcp";
126
+ import { mcpHttpHandler } from "@jaypie/mcp/http";
127
+ import { createMcpServerFromSuite } from "@jaypie/fabric/mcp";
128
+
129
+ createMcpServer({ services: ["skill", "version"] }); // stdio / SDK
130
+ createMcpServerFromSuite(suite, { services: ["greet"] }); // any suite, SDK
131
+ mcpHttpHandler({ services: ["skill", "release_notes"] }); // no SDK
132
+ ```
133
+
56
134
  ## Environment Variables
57
135
 
58
136
  ### Datadog Tools
@@ -14,6 +14,7 @@ Jaypie provides response streaming for real-time data delivery. Three handler pa
14
14
  | `lambdaStreamHandler` | `@jaypie/lambda` | Pure Lambda Function URL streaming |
15
15
  | `expressStreamHandler` | `@jaypie/express` | Express routes with SSE |
16
16
  | `createLambdaStreamHandler` | `@jaypie/express` | Express app on Lambda with streaming |
17
+ | `mcpHttpHandler` | `@jaypie/mcp/http` | MCP streamable HTTP (JSON or SSE) over a `ServiceSuite`; see `skill("mcp")` |
17
18
 
18
19
  ## Stream Formats
19
20
 
@@ -82,7 +83,8 @@ export const handler = lambdaStreamHandler(async (event, context) => {
82
83
  import { JaypieLambda, JaypieDistribution } from "@jaypie/constructs";
83
84
 
84
85
  const streamingLambda = new JaypieLambda(this, "Stream", {
85
- entry: "src/stream.ts",
86
+ code: "../api/dist",
87
+ handler: "index.handler",
86
88
  });
87
89
 
88
90
  new JaypieDistribution(this, "Api", {