@jaypie/mcp 0.7.6 → 0.7.7

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.
@@ -9,7 +9,7 @@ import { gt } from 'semver';
9
9
  /**
10
10
  * Docs Suite - Documentation services (skill, version, release_notes)
11
11
  */
12
- const BUILD_VERSION_STRING = "@jaypie/mcp@0.7.6#2f4ca154"
12
+ const BUILD_VERSION_STRING = "@jaypie/mcp@0.7.7#7d7a0427"
13
13
  ;
14
14
  const __filename$1 = fileURLToPath(import.meta.url);
15
15
  const __dirname$1 = path.dirname(__filename$1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaypie/mcp",
3
- "version": "0.7.6",
3
+ "version": "0.7.7",
4
4
  "description": "Jaypie MCP",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,12 @@
1
+ ---
2
+ version: 1.2.28
3
+ date: 2025-02-01
4
+ summary: Expand JaypieGitHubDeployRole permissions for CDK context lookups
5
+ ---
6
+
7
+ ## Changes
8
+
9
+ - Use `ec2:Describe*` wildcard for all EC2 describe operations (VPCs, subnets, VPN gateways, etc.)
10
+ - Use `cloudformation:Describe*` wildcard for CloudFormation lookups
11
+ - Add `cdk-hnb659fds-lookup-role-*` to assumable roles for CDK context provider
12
+ - Include SSM parameter read permissions (`ssm:GetParameter`, `ssm:GetParameters`)
@@ -0,0 +1,34 @@
1
+ ---
2
+ version: 1.2.8
3
+ date: 2025-02-01
4
+ summary: Fix CORS OPTIONS by calling flushHeaders() before res.end()
5
+ ---
6
+
7
+ ## Bug Fix
8
+
9
+ Fixed CORS OPTIONS preflight requests still hanging with Lambda streaming by calling `flushHeaders()` before `res.end()`.
10
+
11
+ ### Problem
12
+
13
+ The fix in v1.2.7 called `res.end()` for OPTIONS requests but didn't explicitly flush headers first. In Lambda streaming mode:
14
+
15
+ 1. `LambdaResponseStreaming._final()` closes the stream via `_wrappedStream.end()`
16
+ 2. `_wrappedStream` is only created when `flushHeaders()` is called
17
+ 3. Without explicit `flushHeaders()`, `_wrappedStream` could be null
18
+ 4. The Lambda stream never closes, causing the response to hang
19
+
20
+ ### Solution
21
+
22
+ Added explicit `res.flushHeaders()` call before `res.end()` in the CORS OPTIONS handler to ensure the Lambda stream wrapper is initialized before ending the response.
23
+
24
+ ```typescript
25
+ res.statusCode = 204;
26
+ res.setHeader("Content-Length", "0");
27
+ res.flushHeaders(); // Initialize _wrappedStream before ending
28
+ res.end();
29
+ ```
30
+
31
+ ### Related
32
+
33
+ - GitHub Issue: [#178](https://github.com/finlaysonstudio/jaypie/issues/178)
34
+ - Follow-up to: [#174](https://github.com/finlaysonstudio/jaypie/issues/174)
package/skills/agents.md CHANGED
@@ -24,12 +24,16 @@ Complete stack styles, techniques, and traditions.
24
24
  - Check ~tools (`mcp__jaypie__skill("tools")`) for all tools or ~tools-aws, ~tools-datadog, and ~tools-dynamodb individually
25
25
  - File bugs, documentation, features, and other issues with `mcp__jaypie__skill("issues")`
26
26
 
27
+ ### Code
28
+
29
+ - `log.trace` happy path, `log.debug` things that should stand out. Avoid info. Use warn when recoverable. Use error when unrecoverable or "really bad"
30
+
27
31
  ### Skills
28
32
 
29
33
  `mcp__jaypie__skill(alias: String)`
30
34
 
31
35
  Contents: index, releasenotes
32
- Development: documentation, errors, logs, mocks, monorepo, style, subpackages, tests
36
+ Development: documentation, errors, llm, logs, mocks, monorepo, style, subpackages, tests
33
37
  Infrastructure: aws, cdk, cicd, datadog, dns, dynamodb, express, lambda, secrets, streaming, variables, websockets
34
38
  Patterns: fabric, handlers, models, services, vocabulary
35
39
  Meta: issues, jaypie, skills, tools
package/skills/secrets.md CHANGED
@@ -5,190 +5,188 @@ related: aws, cdk, variables
5
5
 
6
6
  # Secret Management
7
7
 
8
- Jaypie uses AWS Secrets Manager for secure credential storage, with environment-aware resolution that works seamlessly in both local development and Lambda.
8
+ Jaypie uses AWS Secrets Manager for secure credential storage. The `JaypieEnvSecret` construct creates secrets at deploy time from environment variables, and `getEnvSecret` retrieves them at runtime.
9
9
 
10
- ## Basic Usage
10
+ ## The Pattern
11
11
 
12
- Use `getEnvSecret` for environment-aware secret resolution:
12
+ 1. **Deploy time**: Set environment variables in CI/CD (e.g., `MONGODB_URI=mongodb+srv://...`)
13
+ 2. **CDK**: `JaypieEnvSecret` reads the env var and creates/updates an AWS secret
14
+ 3. **Runtime**: `getEnvSecret("MONGODB_URI")` fetches from Secrets Manager
15
+
16
+ This keeps secrets out of code and config files while enabling environment-specific values.
17
+
18
+ ## CDK: Creating Secrets with JaypieEnvSecret
19
+
20
+ The simplest pattern uses the environment variable name as the construct ID:
13
21
 
14
22
  ```typescript
15
- import { getEnvSecret } from "jaypie";
23
+ import { JaypieEnvSecret, JaypieLambda } from "@jaypie/constructs";
16
24
 
17
- const apiKey = await getEnvSecret("ANTHROPIC_API_KEY");
18
- const dbUri = await getEnvSecret("MONGODB_URI");
25
+ // Creates secret from process.env.MONGODB_URI at deploy time
26
+ const mongoSecret = new JaypieEnvSecret(this, "MONGODB_URI");
27
+ const anthropicSecret = new JaypieEnvSecret(this, "ANTHROPIC_API_KEY");
28
+
29
+ // Lambda with secrets array (auto-creates JaypieEnvSecret instances)
30
+ new JaypieLambda(this, "Handler", {
31
+ code: "dist/lambda",
32
+ handler: "index.handler",
33
+ secrets: ["MONGODB_URI", "ANTHROPIC_API_KEY"],
34
+ });
19
35
  ```
20
36
 
21
- ### How getEnvSecret Works
37
+ When the construct ID matches an environment variable name, `JaypieEnvSecret` automatically:
38
+ - Uses that env var's value as the secret content
39
+ - Sets `envKey` to the ID for later reference
22
40
 
23
- `getEnvSecret` checks environment variables in order:
41
+ ### CI/CD Setup
24
42
 
25
- 1. `SECRET_{name}` - If found, fetches from AWS Secrets Manager
26
- 2. `{name}_SECRET` - If found, fetches from AWS Secrets Manager
27
- 3. `{name}` - Returns direct value without AWS call
43
+ Set secrets as environment variables in your deployment pipeline:
28
44
 
29
- This allows the same code to work locally (with direct env values) and in Lambda (with secret references).
45
+ ```yaml
46
+ # GitHub Actions example
47
+ jobs:
48
+ deploy:
49
+ env:
50
+ MONGODB_URI: ${{ secrets.MONGODB_URI }}
51
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
52
+ steps:
53
+ - run: npx cdk deploy
54
+ ```
30
55
 
31
- ## Loading Multiple Secrets
56
+ ## Runtime: Retrieving Secrets
32
57
 
33
- Use `loadEnvSecrets` during handler initialization:
58
+ Use `getEnvSecret` to fetch secrets in Lambda:
34
59
 
35
60
  ```typescript
36
- import { loadEnvSecrets } from "jaypie";
37
-
38
- // Load secrets and set in process.env
39
- await loadEnvSecrets("ANTHROPIC_API_KEY", "OPENAI_API_KEY", "MONGODB_URI");
61
+ import { getEnvSecret } from "jaypie";
40
62
 
41
- // Now available as process.env.ANTHROPIC_API_KEY, etc.
63
+ const mongoUri = await getEnvSecret("MONGODB_URI");
64
+ const apiKey = await getEnvSecret("ANTHROPIC_API_KEY");
42
65
  ```
43
66
 
44
- ## CDK Configuration
67
+ ### Loading Multiple Secrets
45
68
 
46
- Reference secrets via environment variables in CDK:
69
+ Use `loadEnvSecrets` during handler initialization to populate `process.env`:
47
70
 
48
71
  ```typescript
49
- const handler = new JaypieLambda(this, "Handler", {
50
- environment: {
51
- // SECRET_ prefix triggers AWS Secrets Manager fetch
52
- SECRET_MONGODB_URI: "my-project/mongodb-uri",
53
- SECRET_API_KEY: "my-project/third-party-api-key",
54
- },
55
- });
56
- ```
72
+ import { loadEnvSecrets } from "jaypie";
57
73
 
58
- In code:
74
+ await loadEnvSecrets("ANTHROPIC_API_KEY", "OPENAI_API_KEY", "MONGODB_URI");
59
75
 
60
- ```typescript
61
- // getEnvSecret sees SECRET_MONGODB_URI and fetches from Secrets Manager
62
- const mongoUri = await getEnvSecret("MONGODB_URI");
76
+ // Now available as process.env.ANTHROPIC_API_KEY, etc.
63
77
  ```
64
78
 
65
- ## Direct Secret Access
79
+ ## Provider/Consumer Pattern
66
80
 
67
- Use `getSecret` when you need to fetch by exact AWS secret name:
81
+ For shared secrets across environments (e.g., sandbox providing to personal builds):
68
82
 
69
83
  ```typescript
70
- import { getSecret } from "jaypie";
84
+ // Sandbox stack (provider) - exports the secret name
85
+ new JaypieEnvSecret(this, "SHARED_API_KEY", { provider: true });
71
86
 
72
- // Fetch by exact AWS secret name
73
- const secret = await getSecret("my-project/production/api-key");
87
+ // Personal build (consumer) - imports from sandbox
88
+ new JaypieEnvSecret(this, "SHARED_API_KEY"); // consumer auto-detected
74
89
  ```
75
90
 
76
- Note: `getSecret` requires `AWS_SESSION_TOKEN` and always calls Secrets Manager. Prefer `getEnvSecret` for typical use cases.
91
+ The construct auto-detects consumer mode for personal/ephemeral environments (`PROJECT_ENV=personal` or `CDK_ENV_PERSONAL=true`).
77
92
 
78
- ## Creating Secrets
93
+ ## Generated Secrets
79
94
 
80
- ### Via CDK
95
+ For secrets without a source value (e.g., database passwords):
81
96
 
82
97
  ```typescript
83
- import { Secret } from "aws-cdk-lib/aws-secretsmanager";
84
-
85
- const secret = new Secret(this, "ApiKey", {
86
- secretName: `${projectKey}/api-key`,
87
- description: "Third-party API key",
98
+ new JaypieEnvSecret(this, "DB_PASSWORD", {
99
+ generateSecretString: {
100
+ excludePunctuation: true,
101
+ passwordLength: 32,
102
+ },
88
103
  });
89
-
90
- // Grant read access
91
- secret.grantRead(lambdaFunction);
92
104
  ```
93
105
 
94
- ### Via AWS CLI
106
+ ## Tagging
95
107
 
96
- ```bash
97
- aws secretsmanager create-secret \
98
- --name "my-project/api-key" \
99
- --secret-string "sk_live_abc123"
108
+ Apply standard tags for organization:
109
+
110
+ ```typescript
111
+ new JaypieEnvSecret(this, "STRIPE_KEY", {
112
+ roleTag: CDK.ROLE.PAYMENT,
113
+ vendorTag: CDK.VENDOR.STRIPE,
114
+ });
100
115
  ```
101
116
 
102
- ## Secret Naming Convention
117
+ ## Local Development
103
118
 
104
- Use project-prefixed names:
119
+ For local development, set environment variables directly in `.env.local`:
105
120
 
121
+ ```bash
122
+ # .env.local (not committed)
123
+ ANTHROPIC_API_KEY=sk-ant-test123
124
+ MONGODB_URI=mongodb://localhost:27017/dev
106
125
  ```
107
- {project-key}/{secret-name}
108
126
 
109
- Examples:
110
- - my-api/mongodb-uri
111
- - my-api/stripe-key
112
- - my-api/auth0-secret
113
- ```
127
+ `getEnvSecret` returns these values directly without AWS calls when no `SECRET_` prefix is present.
114
128
 
115
- ## JSON Secrets
129
+ ## Alternative Approaches
116
130
 
117
- Store structured data:
131
+ ### Explicit Value
118
132
 
119
- ```bash
120
- aws secretsmanager create-secret \
121
- --name "my-project/db-credentials" \
122
- --secret-string '{"username":"admin","password":"secret123"}'
133
+ Pass a value directly instead of reading from environment:
134
+
135
+ ```typescript
136
+ new JaypieEnvSecret(this, "ApiKey", {
137
+ value: "sk_live_abc123", // Not recommended - prefer env vars
138
+ });
123
139
  ```
124
140
 
125
- Retrieve in code:
141
+ ### Manual SECRET_ Linking
142
+
143
+ For non-JaypieEnvSecret secrets, manually set the `SECRET_` prefix:
126
144
 
127
145
  ```typescript
128
- const credentialsJson = await getEnvSecret("DB_CREDENTIALS");
129
- const credentials = JSON.parse(credentialsJson);
146
+ new JaypieLambda(this, "Handler", {
147
+ environment: {
148
+ SECRET_MONGODB_URI: "my-project/mongodb-uri", // AWS secret name
149
+ },
150
+ });
130
151
  ```
131
152
 
132
- ## Caching
153
+ At runtime, `getEnvSecret("MONGODB_URI")` sees `SECRET_MONGODB_URI` and fetches from that AWS secret name.
133
154
 
134
- Secrets are cached by default to reduce API calls:
155
+ The `_SECRET` suffix also works:
135
156
 
136
157
  ```typescript
137
- // First call: fetches from Secrets Manager
138
- const key1 = await getEnvSecret("API_KEY");
139
-
140
- // Second call: returns cached value
141
- const key2 = await getEnvSecret("API_KEY");
158
+ environment: {
159
+ MONGODB_URI_SECRET: "my-project/mongodb-uri",
160
+ }
142
161
  ```
143
162
 
144
- Cache is scoped to Lambda execution context (warm starts reuse cache).
163
+ ### Direct Secret Access
145
164
 
146
- ## Rotation
147
-
148
- Configure automatic rotation for supported secrets:
165
+ Use `getSecret` when you need to fetch by exact AWS secret name:
149
166
 
150
167
  ```typescript
151
- const secret = new Secret(this, "DbPassword", {
152
- secretName: "my-project/db-password",
153
- generateSecretString: {
154
- excludePunctuation: true,
155
- passwordLength: 32,
156
- },
157
- });
168
+ import { getSecret } from "jaypie";
158
169
 
159
- secret.addRotationSchedule("Rotation", {
160
- automaticallyAfter: Duration.days(30),
161
- rotationLambda: rotationFunction,
162
- });
170
+ const secret = await getSecret("my-project/production/api-key");
163
171
  ```
164
172
 
165
- ## Local Development
166
-
167
- For local development, set environment variables directly:
173
+ Note: `getSecret` requires `AWS_SESSION_TOKEN` and always calls Secrets Manager.
168
174
 
169
- ```bash
170
- # .env.local (not committed)
171
- ANTHROPIC_API_KEY=sk-ant-test123
172
- MONGODB_URI=mongodb://localhost:27017/dev
173
- API_KEY=test_key_123
174
- ```
175
+ ## Caching
175
176
 
176
- `getEnvSecret` automatically returns these values without AWS calls since there's no `SECRET_` prefix.
177
+ Secrets are cached by default to reduce API calls. Cache is scoped to Lambda execution context (warm starts reuse cache).
177
178
 
178
179
  ## IAM Permissions
179
180
 
180
- Lambda needs `secretsmanager:GetSecretValue`:
181
+ `JaypieEnvSecret` implements `ISecret`, so grant access directly:
181
182
 
182
183
  ```typescript
184
+ const secret = new JaypieEnvSecret(this, "API_KEY");
183
185
  secret.grantRead(lambdaFunction);
184
-
185
- // Or via policy
186
- lambdaFunction.addToRolePolicy(new PolicyStatement({
187
- actions: ["secretsmanager:GetSecretValue"],
188
- resources: [secret.secretArn],
189
- }));
190
186
  ```
191
187
 
188
+ Or use the `secrets` array on `JaypieLambda`, which handles permissions automatically.
189
+
192
190
  ## Testing
193
191
 
194
192
  Mock secret functions in tests:
package/skills/skills.md CHANGED
@@ -16,7 +16,7 @@ Look up skills by alias: `mcp__jaypie__skill(alias)`
16
16
  | Category | Skills |
17
17
  |----------|--------|
18
18
  | contents | index, releasenotes |
19
- | development | documentation, errors, logs, mocks, monorepo, style, subpackages, tests |
19
+ | development | documentation, errors, llm, logs, mocks, monorepo, style, subpackages, tests |
20
20
  | infrastructure | aws, cdk, cicd, datadog, dns, dynamodb, express, lambda, secrets, streaming, variables, websockets |
21
21
  | patterns | fabric, handlers, models, services, vocabulary |
22
22
  | meta | issues, jaypie, skills, tools |