@rapay/mcp-server 1.2.0 → 1.2.2
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/dist/handlers.js +28 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/handlers.js
CHANGED
|
@@ -399,9 +399,33 @@ function parseCliError(error) {
|
|
|
399
399
|
*/
|
|
400
400
|
async function executeCliCommand(args, timeoutMs = 30000) {
|
|
401
401
|
return new Promise((resolve, reject) => {
|
|
402
|
+
// Security: Only pass necessary environment variables to CLI subprocess
|
|
403
|
+
// This prevents leaking secrets from MCP server environment to CLI
|
|
404
|
+
// CLI needs: PATH (to find executables), HOME/USERPROFILE (for config files),
|
|
405
|
+
// RAPAY_* (explicit Ra Pay configuration), and keyring-related vars
|
|
406
|
+
const safeEnv = {
|
|
407
|
+
PATH: process.env.PATH,
|
|
408
|
+
HOME: process.env.HOME,
|
|
409
|
+
USERPROFILE: process.env.USERPROFILE, // Windows equivalent of HOME
|
|
410
|
+
TMPDIR: process.env.TMPDIR,
|
|
411
|
+
TEMP: process.env.TEMP,
|
|
412
|
+
TMP: process.env.TMP,
|
|
413
|
+
// Allow explicit Ra Pay config overrides
|
|
414
|
+
RAPAY_API_URL: process.env.RAPAY_API_URL,
|
|
415
|
+
RAPAY_CONFIG_DIR: process.env.RAPAY_CONFIG_DIR,
|
|
416
|
+
// Keyring access (Linux)
|
|
417
|
+
DBUS_SESSION_BUS_ADDRESS: process.env.DBUS_SESSION_BUS_ADDRESS,
|
|
418
|
+
XDG_RUNTIME_DIR: process.env.XDG_RUNTIME_DIR,
|
|
419
|
+
// Windows credential manager
|
|
420
|
+
APPDATA: process.env.APPDATA,
|
|
421
|
+
LOCALAPPDATA: process.env.LOCALAPPDATA,
|
|
422
|
+
// Windows system variables (required by libuv for spawn)
|
|
423
|
+
SYSTEMROOT: process.env.SYSTEMROOT,
|
|
424
|
+
WINDIR: process.env.WINDIR,
|
|
425
|
+
};
|
|
402
426
|
const child = spawn(CLI_PATH, args, {
|
|
403
427
|
stdio: ["pipe", "pipe", "pipe"],
|
|
404
|
-
env:
|
|
428
|
+
env: safeEnv,
|
|
405
429
|
// cross-spawn handles Windows .cmd wrappers automatically
|
|
406
430
|
});
|
|
407
431
|
let stdout = "";
|
|
@@ -474,9 +498,9 @@ async function executeSend(args) {
|
|
|
474
498
|
validateSendArgs(args);
|
|
475
499
|
// Convert cents to dollars for CLI (CLI expects dollar amount)
|
|
476
500
|
const amountDollars = args.amount / 100;
|
|
477
|
-
// Calculate fee breakdown using integer math to avoid floating point errors
|
|
478
|
-
// 2% Ra Pay application fee:
|
|
479
|
-
const rapayFeeCents = Math.
|
|
501
|
+
// Calculate fee breakdown using true integer math to avoid floating point errors
|
|
502
|
+
// 2% Ra Pay application fee: integer ceiling of (amount_cents * 2 / 100)
|
|
503
|
+
const rapayFeeCents = Math.floor((args.amount * 2 + 99) / 100);
|
|
480
504
|
const recipientReceivesCents = args.amount - rapayFeeCents;
|
|
481
505
|
// Convert to dollars for display (after integer calculation)
|
|
482
506
|
const rapayFee = rapayFeeCents / 100;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED