@jaypie/mcp 0.2.12 → 0.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaypie/mcp",
3
- "version": "0.2.12",
3
+ "version": "0.3.1",
4
4
  "description": "Jaypie MCP",
5
5
  "repository": {
6
6
  "type": "git",
@@ -106,7 +106,6 @@ For streaming responses (SSE, real-time updates), use `createLambdaStreamHandler
106
106
 
107
107
  ```typescript
108
108
  import { JaypieExpressLambda, JaypieDistribution } from "@jaypie/constructs";
109
- import * as lambda from "aws-cdk-lib/aws-lambda";
110
109
 
111
110
  // Create Lambda (handler uses createLambdaStreamHandler internally)
112
111
  const streamingApi = new JaypieExpressLambda(this, "StreamingApi", {
@@ -114,10 +113,10 @@ const streamingApi = new JaypieExpressLambda(this, "StreamingApi", {
114
113
  handler: "index.handler",
115
114
  });
116
115
 
117
- // Use with CloudFront and RESPONSE_STREAM invoke mode
116
+ // Use with CloudFront and streaming enabled
118
117
  new JaypieDistribution(this, "Distribution", {
119
118
  handler: streamingApi,
120
- invokeMode: lambda.InvokeMode.RESPONSE_STREAM,
119
+ streaming: true,
121
120
  host: "api.example.com",
122
121
  zone: "example.com",
123
122
  });
@@ -135,13 +134,13 @@ const streamingLambda = new JaypieLambda(this, "StreamingFunction", {
135
134
 
136
135
  const functionUrl = streamingLambda.addFunctionUrl({
137
136
  authType: FunctionUrlAuthType.NONE,
138
- invokeMode: InvokeMode.RESPONSE_STREAM,
137
+ invokeMode: InvokeMode.RESPONSE_STREAM, // Direct Function URL still uses InvokeMode
139
138
  });
140
139
 
141
140
  new cdk.CfnOutput(this, "StreamingUrl", { value: functionUrl.url });
142
141
  ```
143
142
 
144
- Note: Streaming requires Lambda Function URLs (not API Gateway). `JaypieDistribution` uses Function URLs by default.
143
+ Note: Streaming requires Lambda Function URLs (not API Gateway). `JaypieDistribution` uses Function URLs by default and accepts `streaming: true` for a cleaner API.
145
144
 
146
145
  ### Stack Types
147
146
 
@@ -6,6 +6,14 @@ description: conventions around deployment and environment variables, especially
6
6
 
7
7
  Reference for Jaypie CI/CD conventions. For setup instructions, see `Jaypie_Init_CICD_with_GitHub_Actions.md`.
8
8
 
9
+ ## Workspace Naming Conventions
10
+
11
+ | Directory | Purpose |
12
+ |-----------|---------|
13
+ | `packages/` | Default workspace for npm packages (preferred when only one namespace needed) |
14
+ | `stacks/` | CDK-deployed infrastructure and sites (as opposed to npm-published) |
15
+ | `workspaces/` | Generic workspace for other work |
16
+
9
17
  ## Jaypie Environments
10
18
 
11
19
  Jaypie assumes multiple deployed environments:
@@ -19,11 +27,21 @@ Jaypie assumes multiple deployed environments:
19
27
 
20
28
  ## Naming Conventions
21
29
 
22
- Workflow files lead with the most important keyword and end with the environment:
23
- - `deploy-personal-build.yml`
24
- - `deploy-sandbox.yml`
25
- - `deploy-production.yml`
26
- - `npm-deploy.yml`
30
+ ### Workflow File Naming
31
+
32
+ | Pattern | Purpose | Example |
33
+ |---------|---------|---------|
34
+ | `deploy-env-$ENV.yml` | Deploy all stacks to an environment | `deploy-env-sandbox.yml` |
35
+ | `deploy-$ENV.yml` | Legacy alias for environment deploy | `deploy-sandbox.yml` |
36
+ | `deploy-stack-$STACK.yml` | Deploy specific stack content | `deploy-stack-documentation.yml` |
37
+
38
+ ### Tag Naming
39
+
40
+ | Pattern | Purpose | Example |
41
+ |---------|---------|---------|
42
+ | `v*` | Production version release | `v1.2.3` |
43
+ | `$ENV-*` | Deploy to specific environment | `sandbox-hotfix` |
44
+ | `stack-$STACK-*` | Deploy specific stack | `stack-documentation-v1.0.0` |
27
45
 
28
46
  Always prefer full words for maximum clarity.
29
47
 
@@ -54,11 +72,17 @@ jobs: # alphabetical
54
72
 
55
73
  | Environment | Trigger |
56
74
  |-------------|---------|
57
- | production | tags: `v*` |
58
- | development | branches: `[main]` |
59
- | sandbox | branches: `[main, develop, sandbox, sandbox-*, sandbox/*]` |
75
+ | production | tags: `v*`, `production-*` |
76
+ | development | branches: `[main, development/*]`, tags: `development-*` |
77
+ | sandbox | branches: `[feat/*, sandbox/*]`, tags: `sandbox-*` |
60
78
  | personal | branches-ignore: `[main, develop, nobuild-*, nobuild/*, sandbox, sandbox-*, sandbox/*]` |
61
79
 
80
+ ### Stack Triggers
81
+
82
+ | Stack | Trigger |
83
+ |-------|---------|
84
+ | documentation | Push to `main` with path filter, tags: `stack-documentation-*` |
85
+
62
86
  ### Dependencies
63
87
 
64
88
  | Environment | Lint/Test Dependency |
@@ -74,14 +98,20 @@ Use `npm run lint` and `npm run test`. Verify the test script uses `vitest run`
74
98
 
75
99
  ## Concurrency
76
100
 
77
- New builds cancel in-progress builds. Environments run in parallel between each other but concurrently within an environment.
101
+ Use concurrency groups without `cancel-in-progress` to avoid stuck deployments. Environments run in parallel between each other but concurrently within an environment.
102
+
103
+ ### Environment Builds
104
+
105
+ ```yaml
106
+ concurrency:
107
+ group: deploy-env-production
108
+ ```
78
109
 
79
- ### Static Builds
110
+ ### Stack Builds
80
111
 
81
112
  ```yaml
82
113
  concurrency:
83
- group: deploy-production
84
- cancel-in-progress: true
114
+ group: deploy-stack-documentation-${{ github.event.inputs.environment || 'development' }}
85
115
  ```
86
116
 
87
117
  ### Personal Builds
@@ -89,7 +119,6 @@ concurrency:
89
119
  ```yaml
90
120
  concurrency:
91
121
  group: deploy-personal-build-${{ github.actor }}
92
- cancel-in-progress: true
93
122
  ```
94
123
 
95
124
  ## Personal Builds
@@ -122,6 +151,48 @@ Create GitHub environments matching deployment targets:
122
151
 
123
152
  Each environment contains variables and secrets specific to that deployment target.
124
153
 
154
+ ## GitHub Variable Scoping
155
+
156
+ Variables are configured at different levels in GitHub Settings:
157
+
158
+ ### Organization Level
159
+
160
+ | Variable | Description | Default |
161
+ |----------|-------------|---------|
162
+ | `AWS_REGION` | AWS region | `us-east-1` |
163
+ | `LOG_LEVEL` | Application log level | `debug` |
164
+ | `MODULE_LOG_LEVEL` | Module log level | `warn` |
165
+ | `PROJECT_SPONSOR` | Organization name | `finlaysonstudio` |
166
+
167
+ ### Repository Level
168
+
169
+ | Variable | Description | Default |
170
+ |----------|-------------|---------|
171
+ | `AWS_HOSTED_ZONE` | Route53 hosted zone | `example.com` |
172
+ | `PROJECT_KEY` | Project identifier | `myapp` |
173
+ | `PROJECT_SERVICE` | Service name | `stacks` |
174
+
175
+ ### Environment Level
176
+
177
+ | Variable | Description | Required |
178
+ |----------|-------------|----------|
179
+ | `AWS_ROLE_ARN` | IAM role ARN for OIDC | Yes |
180
+ | `DATADOG_API_KEY_ARN` | Datadog API key ARN in Secrets Manager | No |
181
+ | `PROJECT_ENV` | Environment identifier | Yes |
182
+ | `PROJECT_NONCE` | Unique resource identifier | No |
183
+
184
+ ### Auto-Generated Variables
185
+
186
+ These variables are set automatically from GitHub context:
187
+
188
+ | Variable | Source | Description |
189
+ |----------|--------|-------------|
190
+ | `CDK_DEFAULT_ACCOUNT` | `${{ github.repository_owner }}` | Repository owner |
191
+ | `CDK_DEFAULT_REGION` | `AWS_REGION` | Same as AWS region |
192
+ | `CDK_ENV_REPO` | `${{ github.repository }}` | Repository name (owner/repo) |
193
+ | `PROJECT_COMMIT` | `${{ github.sha }}` | Current commit SHA |
194
+ | `PROJECT_VERSION` | `package.json` | Version from package.json |
195
+
125
196
  ## Environment Variables Reference
126
197
 
127
198
  ### Application Variables
@@ -169,6 +240,8 @@ Follow naming from vendor documentation. If documentation does not reference env
169
240
 
170
241
  ## Secrets
171
242
 
243
+ By default, no secrets are required. Dependencies add secrets as needed.
244
+
172
245
  ### Secret Naming
173
246
 
174
247
  Secrets follow the same conventions as variables. Use `SECRET_` prefix for secrets that will be resolved at runtime:
@@ -177,6 +250,8 @@ Secrets follow the same conventions as variables. Use `SECRET_` prefix for secre
177
250
 
178
251
  ### Passing Secrets
179
252
 
253
+ Secrets are passed to CDK via `JaypieEnvSecret` construct and made available at runtime.
254
+
180
255
  Pass secrets only to steps that need them:
181
256
 
182
257
  ```yaml
@@ -190,6 +265,30 @@ Pass secrets only to steps that need them:
190
265
 
191
266
  Never expose secrets in logs or workflow outputs.
192
267
 
268
+ ### Adding Dependency Secrets
269
+
270
+ When adding dependencies that require secrets, update the workflow accordingly.
271
+
272
+ #### Example: Auth0 Integration
273
+
274
+ **Environment Variables:**
275
+ - `AUTH0_AUDIENCE` - API identifier
276
+ - `AUTH0_CLIENT_ID` - Application client ID
277
+ - `AUTH0_DOMAIN` - Auth0 tenant domain
278
+
279
+ **Environment Secrets:**
280
+ - `AUTH0_CLIENT_SECRET` - Application client secret
281
+
282
+ Add to workflow:
283
+ ```yaml
284
+ - name: Deploy CDK Stack
285
+ uses: ./.github/actions/cdk-deploy
286
+ with:
287
+ stack-name: AppStack
288
+ env:
289
+ AUTH0_CLIENT_SECRET: ${{ secrets.AUTH0_CLIENT_SECRET }}
290
+ ```
291
+
193
292
  ## CDK Stack Names
194
293
 
195
294
  The `stack-name` parameter in deploy workflows must match the stack ID defined in `packages/cdk/bin/cdk.ts`:
@@ -200,7 +299,7 @@ new AppStack(app, "AppStack"); // "AppStack" is the stack ID
200
299
  ```
201
300
 
202
301
  ```yaml
203
- # deploy-*.yml
302
+ # deploy-env-*.yml
204
303
  - name: Deploy CDK Stack
205
304
  uses: ./.github/actions/cdk-deploy
206
305
  with:
@@ -209,6 +308,34 @@ new AppStack(app, "AppStack"); // "AppStack" is the stack ID
209
308
 
210
309
  If you rename the stack ID (e.g., to "MyProjectAppStack" for clarity in AWS), update all deploy workflows to match. Mismatched names cause "No stacks match the name(s)" errors.
211
310
 
311
+ ## Environment-Aware Hostnames
312
+
313
+ Jaypie CDK constructs use `envHostname()` from `@jaypie/constructs` to determine deployment hostnames based on `PROJECT_ENV`:
314
+
315
+ | `PROJECT_ENV` | Example Hostname |
316
+ |---------------|------------------|
317
+ | `production` | `example.com` (apex domain) |
318
+ | `sandbox` | `sandbox.example.com` |
319
+ | `development` | `development.example.com` |
320
+ | `personal` | `personal.example.com` |
321
+
322
+ **CRITICAL**: If `PROJECT_ENV` is not set or is set incorrectly in the GitHub environment, deployments may target the wrong hostname (e.g., deploying sandbox changes to production apex).
323
+
324
+ ### How It Works
325
+
326
+ 1. The `setup-environment` action reads `${{ vars.PROJECT_ENV }}` from the GitHub environment
327
+ 2. This is exported as `PROJECT_ENV` to `$GITHUB_ENV`
328
+ 3. CDK constructs read `process.env.PROJECT_ENV` via `envHostname()`
329
+ 4. For production, the environment prefix is omitted (apex domain)
330
+ 5. For all other environments, the prefix is prepended
331
+
332
+ ### Troubleshooting Wrong Hostname
333
+
334
+ If deployment targets the wrong hostname:
335
+ 1. Go to GitHub Settings → Environments
336
+ 2. Select the environment (sandbox, development, production)
337
+ 3. Verify `PROJECT_ENV` variable matches the environment name exactly
338
+
212
339
  ## Integrations
213
340
 
214
341
  ### AWS