Model Context Protocol server for PayHere — Sri Lanka's payment gateway. Lets developers retrieve payments, issue refunds, generate checkout payloads, and compute PayHere signatures from any MCP-aware client (Claude Code, etc).
PayHere MCP has well-structured tool definitions with complete schemas and descriptions. All 5 tools have clear verb-noun naming (create_, get_, issue_, generate_, verify_) and descriptions ranging 80 - 250 chars. Input schemas are fully typed with Zod validation. However, output schemas are not documented in the tool definitions themselves, responses are inferred from code comments and API contracts rather than explicit schema declarations. Error handling is present but lacks recovery guidance (e.g., 'if refund fails, try X'). Tool composition is sound: create_checkout_payload and generate_signature work together; get_payment feeds into issue_refund. Security is strong: secrets injected via env vars, never exposed as parameters. Minor gaps: no pagination support (get_payment returns all records), no batch operations, and output field naming could be more consistent with input parameter naming conventions.
Generates the form data needed to POST a checkout request to PayHere, including the MD5 hash. Returns action URL, form fields, and an HTML snippet. Uses the merchant secret from the server's environment — never include the secret in tool arguments.
Computes a PayHere MD5 hash for either checkout submission (mode='checkout') or notify URL validation (mode='notify'). For notify mode, pass `expectedMd5Sig` to verify an incoming signature in one shot. Uses the merchant secret from the server's environment — never include the secret in tool arguments.
Returns all payment attempts (success, refunded, chargedback) associated with the given order_id. PayHere does not support listing by date range or status — only by order_id.
Refunds a payment by payment_id. Omit `amount` for a full refund, or set it for a partial refund. Returns the PayHere refund status.
Health check that confirms env vars are loaded and that the App credentials can fetch an OAuth token. Useful first call when setting up an integration.
Output schemas not documented in tool definitions. Responses are inferred from code comments and API contracts (PaymentRecord, RefundResult interfaces exist in api.ts but not exposed in tool registration). LLMs cannot plan downstream calls without knowing return field names and types.
get_payment lacks pagination. Description states 'PayHere does not support listing by date range or status, only by order_id' but does not mention result limits or pagination. If an order has many payment attempts, all are returned, risking context window exhaustion.
Error handling lacks recovery guidance. Errors are returned but do not tell the LLM what to do next (e.g., 'Refund failed: payment not found. Try get_payment() to verify the payment_id exists.').
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | D | 59 | 2026-07-28+ | v2 |
generate_signature has complex conditional parameter requirements (mode='checkout' requires amount+currency; mode='notify' requires payhereAmount+payhereCurrency+statusCode). Dependencies are documented but not enforced, LLMs may pass incomplete sets.
verify_credentials has empty input schema (no parameters). Description is brief (75 chars). Tool purpose is clear but lacks context on when to call it or what success/failure means for downstream operations.