@pulsemcp/air-secrets-env 0.0.10

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.
@@ -0,0 +1,10 @@
1
+ import type { McpConfig, TransformContext } from "@pulsemcp/air-core";
2
+ /**
3
+ * Transform that resolves ${VAR} patterns from process.env.
4
+ *
5
+ * Recursively walks all string values in the MCP config and replaces
6
+ * ${VAR} patterns with the corresponding environment variable value.
7
+ * Unresolvable patterns (not in process.env) are left as-is.
8
+ */
9
+ export declare function envTransform(config: McpConfig, _context: TransformContext): Promise<McpConfig>;
10
+ //# sourceMappingURL=env-transform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-transform.d.ts","sourceRoot":"","sources":["../src/env-transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItE;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,SAAS,CAAC,CAKpB"}
@@ -0,0 +1,41 @@
1
+ const ENV_VAR_PATTERN = /\$\{([^}]+)\}/g;
2
+ /**
3
+ * Transform that resolves ${VAR} patterns from process.env.
4
+ *
5
+ * Recursively walks all string values in the MCP config and replaces
6
+ * ${VAR} patterns with the corresponding environment variable value.
7
+ * Unresolvable patterns (not in process.env) are left as-is.
8
+ */
9
+ export async function envTransform(config, _context) {
10
+ return {
11
+ ...config,
12
+ mcpServers: resolveObject(config.mcpServers),
13
+ };
14
+ }
15
+ function resolveObject(obj) {
16
+ const result = {};
17
+ for (const [key, value] of Object.entries(obj)) {
18
+ result[key] = resolveValue(value);
19
+ }
20
+ return result;
21
+ }
22
+ function resolveValue(value) {
23
+ if (typeof value === "string") {
24
+ return value.replace(ENV_VAR_PATTERN, (match, varName) => {
25
+ const envVal = process.env[varName];
26
+ return envVal !== undefined ? envVal : match;
27
+ });
28
+ }
29
+ if (Array.isArray(value)) {
30
+ return value.map(resolveValue);
31
+ }
32
+ if (value !== null && typeof value === "object") {
33
+ const resolved = {};
34
+ for (const [k, v] of Object.entries(value)) {
35
+ resolved[k] = resolveValue(v);
36
+ }
37
+ return resolved;
38
+ }
39
+ return value;
40
+ }
41
+ //# sourceMappingURL=env-transform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-transform.js","sourceRoot":"","sources":["../src/env-transform.ts"],"names":[],"mappings":"AAEA,MAAM,eAAe,GAAG,gBAAgB,CAAC;AAEzC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAiB,EACjB,QAA0B;IAE1B,OAAO;QACL,GAAG,MAAM;QACT,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC;KAC7C,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CACpB,GAA4C;IAE5C,MAAM,MAAM,GAA4C,EAAE,CAAC;IAC3D,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/C,MAAM,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,KAAK,CAA4B,CAAC;IAC/D,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YACvD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACpC,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACjC,CAAC;IACD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,MAAM,QAAQ,GAA4B,EAAE,CAAC;QAC7C,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;YACtE,QAAQ,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QAChC,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { AirExtension } from "@pulsemcp/air-core";
2
+ export { envTransform } from "./env-transform.js";
3
+ declare const extension: AirExtension;
4
+ export default extension;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,QAAA,MAAM,SAAS,EAAE,YAGhB,CAAC;AAEF,eAAe,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ import { envTransform } from "./env-transform.js";
2
+ export { envTransform } from "./env-transform.js";
3
+ const extension = {
4
+ name: "secrets-env",
5
+ transform: { transform: envTransform },
6
+ };
7
+ export default extension;
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,SAAS,GAAiB;IAC9B,IAAI,EAAE,aAAa;IACnB,SAAS,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE;CACvC,CAAC;AAEF,eAAe,SAAS,CAAC"}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@pulsemcp/air-secrets-env",
3
+ "version": "0.0.10",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/pulsemcp/air.git",
10
+ "directory": "packages/extensions/secrets-env"
11
+ },
12
+ "description": "AIR transform that resolves ${VAR} patterns from process.env in MCP configs",
13
+ "type": "module",
14
+ "main": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.js"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist/"
24
+ ],
25
+ "scripts": {
26
+ "build": "tsc",
27
+ "test": "vitest run",
28
+ "test:watch": "vitest",
29
+ "lint": "tsc --noEmit"
30
+ },
31
+ "dependencies": {
32
+ "@pulsemcp/air-core": "0.0.10"
33
+ },
34
+ "devDependencies": {
35
+ "@types/node": "^22.10.0",
36
+ "typescript": "^5.7.0",
37
+ "vitest": "^2.1.0"
38
+ },
39
+ "engines": {
40
+ "node": ">=18"
41
+ }
42
+ }