Skip to content

Commit 1041324

Browse files
fix: env-prefix overwrite in pnpm
1 parent a51a26f commit 1041324

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

typescript/packages/ampersend-sdk/src/mcp/proxy/cli.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ function parseOptions(args: Array<string>, envPrefix = "TS__MCP_PROXY__"): Proxy
110110
* Main entry point for the MCP x402 proxy CLI
111111
*/
112112
async function main(): Promise<void> {
113-
const options = parseOptions(process.argv.slice(2))
113+
// Strip leading '--' that pnpm passes through when using `pnpm script -- args`
114+
const args = process.argv.slice(2)
115+
const cleanedArgs = args[0] === "--" ? args.slice(1) : args
116+
const options = parseOptions(cleanedArgs)
114117

115118
const treasurerType = options.treasurer.constructor.name
116119
console.log(`[MCP-PROXY] Starting MCP proxy (${treasurerType})...`)

typescript/packages/ampersend-sdk/src/mcp/proxy/env.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@ export function createEnvSchema(envPrefix = "") {
2323
BUYER_PRIVATE_KEY: z
2424
.string()
2525
.refine((val) => val.startsWith("0x"), {
26-
message: "Must start with 0x",
26+
message: `${envPrefix}BUYER_PRIVATE_KEY must start with 0x`,
2727
})
2828
.optional(),
2929
BUYER_SMART_ACCOUNT_ADDRESS: z
3030
.string()
3131
.refine((val) => val.startsWith("0x"), {
32-
message: "Must start with 0x",
32+
message: `${envPrefix}BUYER_SMART_ACCOUNT_ADDRESS must start with 0x`,
3333
})
3434
.optional(),
3535
BUYER_SMART_ACCOUNT_KEY_PRIVATE_KEY: z
3636
.string()
3737
.refine((val) => val.startsWith("0x"), {
38-
message: "Must start with 0x",
38+
message: `${envPrefix}BUYER_SMART_ACCOUNT_KEY_PRIVATE_KEY must start with 0x`,
3939
})
4040
.optional(),
4141
BUYER_SMART_ACCOUNT_VALIDATOR_ADDRESS: z
4242
.string()
4343
.refine((val) => val.startsWith("0x"), {
44-
message: "Must start with 0x",
44+
message: `${envPrefix}BUYER_SMART_ACCOUNT_VALIDATOR_ADDRESS must start with 0x`,
4545
})
4646
.optional()
4747
.default(OWNABLE_VALIDATOR),

0 commit comments

Comments
 (0)