epicmerch-mcp 1.1.1 → 1.2.0

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": "epicmerch-mcp",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "MCP server for EpicMerch — integrates e-commerce into Claude and ChatGPT",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: epicmerch-payments
3
+ description: Set up payments on an EpicMerch store — help the merchant pick between Razorpay (India, default) and Stripe (international), then route to the right setup skill.
4
+ ---
5
+
6
+ # EpicMerch Payments — the umbrella
7
+
8
+ This is the entry point for any "set up payments" / "configure checkout" / "add card payments" intent. Your job is to figure out **which processor the merchant should use**, then hand off to the matching detailed skill.
9
+
10
+ ## Step 1: Check what's already configured
11
+
12
+ Before asking anything, call `merchant_get_checkout_settings()`. The response tells you:
13
+
14
+ - `checkoutType` — current active flow (`"epicmerch"`, `"stripe"`, or `"shiprocket"`)
15
+ - `razorpayKeyId` (string or null) + `razorpayKeySecretIsSet` (bool)
16
+ - `stripePublishableKey` (string or null) + `stripeSecretKeyIsSet` (bool) + `stripeWebhookSecretIsSet` (bool)
17
+
18
+ Decide based on what's there:
19
+
20
+ | Current state | Suggested action |
21
+ |---|---|
22
+ | Nothing configured | Help the merchant pick + set up (continue to Step 2) |
23
+ | Razorpay configured, `checkoutType: epicmerch` | Tell them: "Razorpay is already live on your store. Want to add Stripe as a backup / switch to Stripe?" |
24
+ | Stripe configured, `checkoutType: stripe` | Tell them: "Stripe is already live. Want to switch back to Razorpay?" |
25
+ | Both configured, only one active | Tell them which is active + ask if they want to switch |
26
+
27
+ If something's clearly already set up and they didn't ask to change it, stop here. Don't redo configured work.
28
+
29
+ ## Step 2: Help them pick
30
+
31
+ If nothing is configured (or they want to add a new one), help them choose:
32
+
33
+ | Question | Razorpay | Stripe |
34
+ |---|---|---|
35
+ | Where are most of your customers? | India 🇮🇳 | International 🌍 |
36
+ | Currency you charge in? | INR primarily | USD, EUR, GBP, AUD, etc. |
37
+ | Payment methods you want? | UPI, netbanking, Indian cards, wallets | Cards, Apple Pay, Google Pay, Stripe Link |
38
+ | Compliance | RBI-compliant by default | Stripe handles PCI; you handle GDPR |
39
+ | Setup time | ~5 min if account exists | ~10 min (needs webhook config) |
40
+ | Account onboarding | KYC ~24h (already done usually) | Stripe activation can take a day |
41
+
42
+ Ask the merchant ONE question that disambiguates. Don't make them read the table. The best single question is usually:
43
+
44
+ > "Where are most of your customers — India, or international?"
45
+
46
+ - **India only** → Razorpay
47
+ - **International / mostly outside India** → Stripe
48
+ - **Both / not sure** → ask: "What currency do you want to charge in?" then route accordingly.
49
+
50
+ ## Step 3: Hand off to the specific skill
51
+
52
+ Once you know which one:
53
+
54
+ - **Razorpay** → hand off to `/epicmerch-razorpay`. Don't try to configure it inline; the specific skill has the right Razorpay-dashboard URLs, key format hints, and the activation step.
55
+ - **Stripe** → hand off to `/epicmerch-stripe`. Same reasoning — that skill has the webhook URL, the test recipe, and the activation step.
56
+
57
+ If you're running inside a client that doesn't support slash command handoff (e.g. **Codex**), invoke the same MCP tools yourself:
58
+
59
+ **For Razorpay inline:**
60
+ ```
61
+ merchant_configure_razorpay({ keyId: "rzp_live_...", keySecret: "..." })
62
+ merchant_set_checkout_type({ type: "epicmerch" })
63
+ merchant_get_checkout_settings() // verify
64
+ merchant_diagnose() // confirm readiness
65
+ ```
66
+
67
+ **For Stripe inline:**
68
+ ```
69
+ merchant_configure_stripe({ publishableKey: "pk_live_...", secretKey: "sk_live_...", webhookSecret: "whsec_..." })
70
+ merchant_test_stripe_connection()
71
+ merchant_set_checkout_type({ type: "stripe" })
72
+ ```
73
+
74
+ ## Step 4: After setup
75
+
76
+ Once whichever processor is live, suggest:
77
+
78
+ - "Want to test? Place a small test order on your storefront. With test keys, no real money moves; with live keys, you can refund it after."
79
+ - "Need to set up Shiprocket for shipping? Use `merchant_get_logistics_settings` first to see what's there."
80
+ - "Ready to launch? Run `merchant_diagnose()` — I'll check everything."
81
+
82
+ ## Style
83
+
84
+ - Don't ask "Razorpay or Stripe?" out of context. ALWAYS check current state first (Step 1) — if it's set up, just confirm.
85
+ - Don't pile up questions. One at a time.
86
+ - Never paste the merchant's secret back at them — refer to it as `"the secret you provided"`. Treat secrets as write-only.
@@ -0,0 +1,98 @@
1
+ ---
2
+ name: epicmerch-razorpay
3
+ description: Set up Razorpay payments for an EpicMerch store conversationally — get the Key ID + Secret from Razorpay's dashboard, save them, and activate the EpicMerch Checkout flow.
4
+ ---
5
+
6
+ # EpicMerch Razorpay Setup
7
+
8
+ You're helping a merchant configure Razorpay as their payment processor. This pairs Razorpay with EpicMerch's default checkout flow (Razorpay for payments + Shiprocket for shipping). Walk them through these steps.
9
+
10
+ ## Step 1: Confirm they have a Razorpay account
11
+
12
+ Ask: "Do you already have a Razorpay account at dashboard.razorpay.com? If not, sign up first — it's free and KYC takes ~24 hours."
13
+
14
+ If they're in India and just starting out, Razorpay is the most common choice. For international merchants, hand off to `/epicmerch-stripe` instead.
15
+
16
+ ## Step 2: Decide test vs live mode
17
+
18
+ Ask: "Are you setting up for testing (`rzp_test_...` keys), or going live with real customers (`rzp_live_...`)?"
19
+
20
+ Make sure they understand:
21
+ - **Test keys** — no real money. Use Razorpay's test card numbers from their docs. Switch to live before launching.
22
+ - **Live keys** — real money. Account must be activated (KYC complete + bank account linked).
23
+
24
+ ## Step 3: Collect their API keys
25
+
26
+ Tell them:
27
+
28
+ > "In a new browser tab, open https://dashboard.razorpay.com → Settings → API Keys → Generate Key (or Show, if you've generated one before).
29
+ >
30
+ > Copy these two values:
31
+ > - **Key ID** — looks like `rzp_live_XXXXX` or `rzp_test_XXXXX`
32
+ > - **Key Secret** — long random string. Razorpay only shows it ONCE when you generate. If you've already saved it somewhere safe, paste it now."
33
+
34
+ If the merchant lost their secret, tell them: "You'll need to regenerate the key pair in Razorpay's dashboard. The old Key ID stops working when you do this, so update both fields below."
35
+
36
+ ## Step 4: Save them
37
+
38
+ Call:
39
+
40
+ ```
41
+ merchant_configure_razorpay({
42
+ keyId: "rzp_live_XXXXX",
43
+ keySecret: "your_secret_here"
44
+ })
45
+ ```
46
+
47
+ The server encrypts the secret before storing. The response confirms the save with `razorpayKeyId` echoed back and `razorpayKeySecretIsSet: true`.
48
+
49
+ ## Step 5: Activate the checkout
50
+
51
+ Razorpay only powers payments under EpicMerch's default checkout flow. Activate it:
52
+
53
+ ```
54
+ merchant_set_checkout_type({ type: "epicmerch" })
55
+ ```
56
+
57
+ This sets the storefront to use EpicMerch Checkout (Razorpay payments + Shiprocket shipping). If the merchant was previously on Stripe or Shiprocket-managed checkout, this switches them over.
58
+
59
+ ## Step 6: Verify it took effect
60
+
61
+ Call `merchant_get_checkout_settings()` and confirm the response includes:
62
+ - `checkoutType: "epicmerch"`
63
+ - `razorpayKeyId` matching what you just set
64
+ - `razorpayKeySecretIsSet: true`
65
+
66
+ If those line up, you're done.
67
+
68
+ ## Step 7: Smoke test (optional but recommended)
69
+
70
+ Tell the merchant: "Want me to do a quick health check? I'll look at your full store readiness, including payment config."
71
+
72
+ Then call `merchant_diagnose()`. Read off the `payment.razorpayConfigured` value — should be `true` — and the `readinessScore`.
73
+
74
+ ## Step 8: Done
75
+
76
+ Say:
77
+
78
+ > "Razorpay is now live on your storefront. Customers will see Razorpay's payment widget at checkout — cards, UPI, netbanking, wallets. **Make sure you're using live keys before launch** — test keys won't charge real money."
79
+
80
+ If they're on test keys, remind them again: "When you're ready to launch, repeat Steps 3–4 with live keys."
81
+
82
+ ## Style
83
+
84
+ - Ask one question at a time. Don't dump all the steps at once.
85
+ - After each `merchant_*` call, read back the relevant field so the merchant sees progress.
86
+ - If a save fails (e.g. validation error from the server), surface the error message verbatim — don't paraphrase.
87
+
88
+ ## Troubleshooting
89
+
90
+ If `merchant_get_checkout_settings` shows `razorpayKeySecretIsSet: false` after Step 4, the secret didn't persist. Causes:
91
+ - Empty string passed (Razorpay secrets are 30+ chars; if the merchant pasted nothing, the field stays empty)
92
+ - Encryption key mismatch on the server side (rare; tell the merchant to check with support)
93
+
94
+ If Step 5 errors with "must be one of: ...", you typed the wrong checkout type. Use exactly `"epicmerch"` (lowercase).
95
+
96
+ ## Handoff
97
+
98
+ If the merchant says "actually I want Stripe instead" — switch to `/epicmerch-stripe`. If "what's the difference between Razorpay and Stripe?" — use `/epicmerch-payments` to compare.
@@ -317,6 +317,13 @@ export const TOOL_EXAMPLES = {
317
317
  'Is Stripe configured correctly?',
318
318
  'Verify my Stripe keys work',
319
319
  ],
320
+
321
+ // --- Razorpay ---
322
+ merchant_configure_razorpay: [
323
+ 'Set up Razorpay for my store',
324
+ 'Add my Razorpay keys',
325
+ 'Configure Razorpay payments',
326
+ ],
320
327
  merchant_set_checkout_type: [
321
328
  'Switch my checkout to Stripe',
322
329
  'Change checkout to Razorpay',
@@ -362,6 +362,18 @@ export function merchantTools(client, session) {
362
362
  return ok(await client.authGet('/users/stripe/test'));
363
363
  },
364
364
 
365
+ // --- RAZORPAY CONFIGURATION ---
366
+ async merchant_configure_razorpay({ keyId, keySecret }) {
367
+ requireAuth();
368
+ if (!keyId && !keySecret) {
369
+ throw new Error('At least one of `keyId` or `keySecret` must be provided.');
370
+ }
371
+ const body = {};
372
+ if (keyId !== undefined) body.razorpayKeyId = keyId;
373
+ if (keySecret !== undefined) body.razorpayKeySecret = keySecret;
374
+ return ok(await client.authPut('/users/checkout-settings', body));
375
+ },
376
+
365
377
  async merchant_set_checkout_type({ type }) {
366
378
  requireAuth();
367
379
  const valid = ['epicmerch', 'stripe', 'shiprocket'];
@@ -603,6 +615,14 @@ const _baseMerchantToolDefs = [
603
615
  description: 'Verify the merchant\'s Stripe keys work by fetching their Stripe account. Returns accountId, country, and charges-enabled status.',
604
616
  schema: {},
605
617
  },
618
+ {
619
+ name: 'merchant_configure_razorpay',
620
+ description: 'Configure Razorpay payment processing for the merchant: stores Key ID + Key Secret. Pair with merchant_set_checkout_type({type:"epicmerch"}) to activate the EpicMerch Checkout flow that uses Razorpay. Both fields are optional individually so you can update one at a time (e.g. rotating the secret without re-entering the key id).',
621
+ schema: {
622
+ keyId: { type: 'string', description: 'Razorpay Key ID, e.g. rzp_live_... or rzp_test_...' },
623
+ keySecret: { type: 'string', description: 'Razorpay Key Secret. Stored encrypted server-side.' },
624
+ },
625
+ },
606
626
  {
607
627
  name: 'merchant_set_checkout_type',
608
628
  description: 'Set which checkout flow the merchant\'s storefront uses. Must be one of: "epicmerch" (Razorpay + Shiprocket), "stripe" (Stripe + Shiprocket), or "shiprocket" (full SR Checkout).',