@payware/mcp-server 1.3.3 → 1.5.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.
Files changed (89) hide show
  1. package/.env.example +4 -0
  2. package/README.md +18 -0
  3. package/package.json +7 -9
  4. package/src/auth/rsa-keys.js +12 -6
  5. package/src/auth/sandbox-setup.js +2 -0
  6. package/src/config/toolsets.js +104 -0
  7. package/src/core/auth/jwt-factory.js +4 -1
  8. package/src/core/auth/jwt-token.js +4 -0
  9. package/src/index.js +10 -6
  10. package/src/isv/data/index.js +15 -14
  11. package/src/isv/deep-links/delete-product-link.js +3 -2
  12. package/src/isv/deep-links/delete-transaction-link.js +3 -2
  13. package/src/isv/deep-links/get-product-link.js +8 -6
  14. package/src/isv/deep-links/get-transaction-link.js +8 -6
  15. package/src/isv/index.js +6 -0
  16. package/src/isv/invitations/index.js +5 -0
  17. package/src/isv/oauth2/get-token-info.js +3 -0
  18. package/src/isv/oauth2/obtain-token.js +3 -0
  19. package/src/isv/oauth2/token-helper.js +2 -0
  20. package/src/isv/poi/cancel-price.js +2 -0
  21. package/src/isv/poi/get-poi.js +2 -0
  22. package/src/isv/poi/get-qrcode.js +40 -9
  23. package/src/isv/poi/get-status.js +2 -0
  24. package/src/isv/poi/list-pois.js +2 -0
  25. package/src/isv/poi/set-price.js +2 -0
  26. package/src/isv/products/audios.js +8 -2
  27. package/src/isv/products/create-product.js +2 -0
  28. package/src/isv/products/delete-product.js +2 -0
  29. package/src/isv/products/get-product-image.js +2 -0
  30. package/src/isv/products/get-product.js +2 -0
  31. package/src/isv/products/list-products.js +2 -0
  32. package/src/isv/products/schedules.js +6 -0
  33. package/src/isv/products/update-product.js +2 -0
  34. package/src/isv/reference/index.js +2 -0
  35. package/src/isv/transactions/cancel-transaction.js +2 -0
  36. package/src/isv/transactions/create-transaction.js +14 -2
  37. package/src/isv/transactions/get-status.js +3 -1
  38. package/src/isv/transactions/process-transaction.js +14 -2
  39. package/src/isv/transactions/simulate-callback.js +2 -0
  40. package/src/isv/transactions/transaction-history.js +2 -0
  41. package/src/merchant/data/export-report.js +2 -0
  42. package/src/merchant/data/generate-report.js +2 -0
  43. package/src/merchant/data/get-export-list.js +2 -0
  44. package/src/merchant/data/get-report-requests.js +2 -0
  45. package/src/merchant/data/get-report-status.js +2 -0
  46. package/src/merchant/data/index.js +15 -10
  47. package/src/merchant/data/list-reports.js +2 -0
  48. package/src/merchant/deep-links/delete-product-link.js +3 -2
  49. package/src/merchant/deep-links/delete-transaction-link.js +3 -2
  50. package/src/merchant/deep-links/get-product-link.js +8 -6
  51. package/src/merchant/deep-links/get-transaction-link.js +8 -6
  52. package/src/merchant/index.js +7 -1
  53. package/src/merchant/logs/index.js +4 -0
  54. package/src/merchant/products/audios.js +15 -14
  55. package/src/merchant/products/create-product.js +3 -2
  56. package/src/merchant/products/delete-product.js +3 -2
  57. package/src/merchant/products/get-product-image.js +3 -2
  58. package/src/merchant/products/get-product.js +3 -2
  59. package/src/merchant/products/list-products.js +3 -2
  60. package/src/merchant/products/schedules.js +11 -10
  61. package/src/merchant/products/update-product.js +3 -2
  62. package/src/merchant/transactions/cancel-transaction.js +4 -3
  63. package/src/merchant/transactions/create-transaction.js +14 -2
  64. package/src/merchant/transactions/get-status.js +4 -3
  65. package/src/merchant/transactions/process-transaction.js +17 -6
  66. package/src/merchant/transactions/simulate-callback.js +3 -0
  67. package/src/merchant/transactions/transaction-history.js +5 -4
  68. package/src/payment-institution/data/index.js +15 -14
  69. package/src/payment-institution/deep-links/delete-transaction-link.js +3 -2
  70. package/src/payment-institution/deep-links/get-transaction-link.js +8 -6
  71. package/src/payment-institution/transactions/create-pi-transaction.js +15 -4
  72. package/src/payment-institution/transactions/finalize-transaction.js +7 -4
  73. package/src/payment-institution/transactions/get-transaction-history.js +7 -4
  74. package/src/payment-institution/transactions/get-transaction-status.js +15 -12
  75. package/src/payment-institution/transactions/process-pi-transaction.js +19 -8
  76. package/src/payment-institution/transactions/simulate-pi-callback.js +3 -0
  77. package/src/payment-institution/transactions/soundbite-transaction.js +5 -4
  78. package/src/proxy-server.js +25 -0
  79. package/src/shared/placements/api.js +51 -0
  80. package/src/shared/placements/tools.js +519 -0
  81. package/src/shared/poi/poi-create-api.js +3 -0
  82. package/src/shared/products/products-api.js +36 -25
  83. package/src/shared/shops/shops-api.js +2 -0
  84. package/src/shared/tool-annotations.js +53 -0
  85. package/src/tools/advanced-code-generator.js +3 -0
  86. package/src/utils/format-request.js +2 -0
  87. package/src/utils/json-formatter.js +2 -0
  88. package/src/utils/server-info.js +2 -0
  89. package/src/utils/code-examples.js +0 -646
@@ -0,0 +1,53 @@
1
+ /**
2
+ * MCP tool annotations, as the six combinations this server's tools actually fall into.
3
+ *
4
+ * Annotations are hints a client uses to decide how much to ask the user before running a tool: a
5
+ * read can run unattended, a destructive call should be confirmed, a non-idempotent one should not
6
+ * be retried blindly after a timeout. Every tool declares one of these as `annotations`, and
7
+ * tests/tool-contract.test.js fails on a tool that does not. tests/tool-routes.test.js checks the
8
+ * choice against the route the tool calls, so a GET cannot be declared destructive or a DELETE
9
+ * read-only.
10
+ *
11
+ * All four hints are always set. The protocol defaults are the cautious ones (not read-only,
12
+ * destructive, open world), so a tool that left them out would be presented as more dangerous than
13
+ * it is, and a directory that lists servers requires them to be explicit.
14
+ *
15
+ * "Open world" means the tool reaches the payware API, and through it real payers, merchants and
16
+ * money. The local tools - keys, tokens, code samples, formatting, callback simulation - do not.
17
+ */
18
+
19
+ /** Computes something locally and calls nothing. */
20
+ export const LOCAL = Object.freeze({
21
+ readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false
22
+ });
23
+
24
+ /** Reads from the payware API and changes nothing. */
25
+ export const READS = Object.freeze({
26
+ readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true
27
+ });
28
+
29
+ /**
30
+ * Adds something that a repeat call returns rather than adds again: a shareable link, which the
31
+ * server mints on first request and records on the transaction, or a downloaded file saved locally.
32
+ */
33
+ export const ADDS = Object.freeze({
34
+ readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true
35
+ });
36
+
37
+ /** Creates something new each time it is called: a transaction, a product, a report run. */
38
+ export const CREATES = Object.freeze({
39
+ readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true
40
+ });
41
+
42
+ /** Overwrites, cancels or deletes. Repeating it changes nothing further. */
43
+ export const CHANGES = Object.freeze({
44
+ readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: true
45
+ });
46
+
47
+ /**
48
+ * Moves a payment forward irreversibly: processing it as the payer, or finalizing it as the
49
+ * institution. A retry after a timeout must not be automatic - the first call may have landed.
50
+ */
51
+ export const COMMITS = Object.freeze({
52
+ readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true
53
+ });
@@ -19,6 +19,7 @@
19
19
  import { CommonTemplates } from '../utils/code-examples/common/helpers.js';
20
20
  import { AuthGenerators } from '../utils/code-examples/common/auth-examples.js';
21
21
  import { createDeterministicJSON } from '../core/utils/json-serializer.js';
22
+ import { LOCAL } from '../shared/tool-annotations.js';
22
23
 
23
24
  /**
24
25
  * Advanced payware Code Generator
@@ -1735,6 +1736,7 @@ export const advancedCodeGenerator = new AdvancedCodeGenerator();
1735
1736
  */
1736
1737
  export const generateCodeExampleTool = {
1737
1738
  name: 'payware_generate_code_example',
1739
+ annotations: LOCAL,
1738
1740
  description: 'Generate production-ready payware API integration code examples with authentication, error handling, and environment configuration for any operation across 16 supported operations and 6 programming languages.',
1739
1741
 
1740
1742
  inputSchema: {
@@ -1875,6 +1877,7 @@ Use different parameters to explore all available options!
1875
1877
  */
1876
1878
  export const generateDocumentationTool = {
1877
1879
  name: 'payware_generate_documentation',
1880
+ annotations: LOCAL,
1878
1881
  description: 'Generate comprehensive documentation for payware API integration with quick start instructions, authentication flows, operation examples, error handling patterns, and language-specific integration guides.',
1879
1882
 
1880
1883
  inputSchema: {
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import { createMinimizedJSON } from '../core/utils/json-serializer.js';
6
+ import { LOCAL } from '../shared/tool-annotations.js';
6
7
 
7
8
  /**
8
9
  * Format transaction request data
@@ -165,6 +166,7 @@ export function formatCurlCommand(method, endpoint, headers, body = null) {
165
166
  */
166
167
  export const formatRequestTool = {
167
168
  name: "payware_utils_format_request",
169
+ annotations: LOCAL,
168
170
  description: "Format and validate payware API requests with proper structure and headers",
169
171
  inputSchema: {
170
172
  type: "object",
@@ -5,12 +5,14 @@
5
5
 
6
6
  import { createDeterministicJSON, validateJSONConsistency } from '../core/utils/json-serializer.js';
7
7
  import { generateContentSha256 } from '../core/auth/jwt-token.js';
8
+ import { LOCAL } from '../shared/tool-annotations.js';
8
9
 
9
10
  /**
10
11
  * Format JSON with deterministic serialization tool
11
12
  */
12
13
  export const formatJSONDeterministicTool = {
13
14
  name: "payware_utils_format_json_deterministic",
15
+ annotations: LOCAL,
14
16
  description: "Format JSON payload with deterministic key sorting for consistent SHA-256 calculation and payware API compliance",
15
17
  inputSchema: {
16
18
  type: "object",
@@ -5,12 +5,14 @@
5
5
  import { readFileSync } from 'fs';
6
6
  import { getPartnerTypeSafe, getSandboxUrl, getProductionUrl } from '../config/env.js';
7
7
  import { getPartnerDisplayInfo, getPartnerConfig } from '../config/partner-types.js';
8
+ import { LOCAL } from '../shared/tool-annotations.js';
8
9
 
9
10
  /**
10
11
  * Get server information tool implementation
11
12
  */
12
13
  export const getServerInfoTool = {
13
14
  name: "payware_utils_server_info",
15
+ annotations: LOCAL,
14
16
  description: "Get MCP server version, status, and environment information",
15
17
  inputSchema: {
16
18
  type: "object",