@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.
- package/.env.example +4 -0
- package/README.md +18 -0
- package/package.json +7 -9
- package/src/auth/rsa-keys.js +12 -6
- package/src/auth/sandbox-setup.js +2 -0
- package/src/config/toolsets.js +104 -0
- package/src/core/auth/jwt-factory.js +4 -1
- package/src/core/auth/jwt-token.js +4 -0
- package/src/index.js +10 -6
- package/src/isv/data/index.js +15 -14
- package/src/isv/deep-links/delete-product-link.js +3 -2
- package/src/isv/deep-links/delete-transaction-link.js +3 -2
- package/src/isv/deep-links/get-product-link.js +8 -6
- package/src/isv/deep-links/get-transaction-link.js +8 -6
- package/src/isv/index.js +6 -0
- package/src/isv/invitations/index.js +5 -0
- package/src/isv/oauth2/get-token-info.js +3 -0
- package/src/isv/oauth2/obtain-token.js +3 -0
- package/src/isv/oauth2/token-helper.js +2 -0
- package/src/isv/poi/cancel-price.js +2 -0
- package/src/isv/poi/get-poi.js +2 -0
- package/src/isv/poi/get-qrcode.js +40 -9
- package/src/isv/poi/get-status.js +2 -0
- package/src/isv/poi/list-pois.js +2 -0
- package/src/isv/poi/set-price.js +2 -0
- package/src/isv/products/audios.js +8 -2
- package/src/isv/products/create-product.js +2 -0
- package/src/isv/products/delete-product.js +2 -0
- package/src/isv/products/get-product-image.js +2 -0
- package/src/isv/products/get-product.js +2 -0
- package/src/isv/products/list-products.js +2 -0
- package/src/isv/products/schedules.js +6 -0
- package/src/isv/products/update-product.js +2 -0
- package/src/isv/reference/index.js +2 -0
- package/src/isv/transactions/cancel-transaction.js +2 -0
- package/src/isv/transactions/create-transaction.js +14 -2
- package/src/isv/transactions/get-status.js +3 -1
- package/src/isv/transactions/process-transaction.js +14 -2
- package/src/isv/transactions/simulate-callback.js +2 -0
- package/src/isv/transactions/transaction-history.js +2 -0
- package/src/merchant/data/export-report.js +2 -0
- package/src/merchant/data/generate-report.js +2 -0
- package/src/merchant/data/get-export-list.js +2 -0
- package/src/merchant/data/get-report-requests.js +2 -0
- package/src/merchant/data/get-report-status.js +2 -0
- package/src/merchant/data/index.js +15 -10
- package/src/merchant/data/list-reports.js +2 -0
- package/src/merchant/deep-links/delete-product-link.js +3 -2
- package/src/merchant/deep-links/delete-transaction-link.js +3 -2
- package/src/merchant/deep-links/get-product-link.js +8 -6
- package/src/merchant/deep-links/get-transaction-link.js +8 -6
- package/src/merchant/index.js +7 -1
- package/src/merchant/logs/index.js +4 -0
- package/src/merchant/products/audios.js +15 -14
- package/src/merchant/products/create-product.js +3 -2
- package/src/merchant/products/delete-product.js +3 -2
- package/src/merchant/products/get-product-image.js +3 -2
- package/src/merchant/products/get-product.js +3 -2
- package/src/merchant/products/list-products.js +3 -2
- package/src/merchant/products/schedules.js +11 -10
- package/src/merchant/products/update-product.js +3 -2
- package/src/merchant/transactions/cancel-transaction.js +4 -3
- package/src/merchant/transactions/create-transaction.js +14 -2
- package/src/merchant/transactions/get-status.js +4 -3
- package/src/merchant/transactions/process-transaction.js +17 -6
- package/src/merchant/transactions/simulate-callback.js +3 -0
- package/src/merchant/transactions/transaction-history.js +5 -4
- package/src/payment-institution/data/index.js +15 -14
- package/src/payment-institution/deep-links/delete-transaction-link.js +3 -2
- package/src/payment-institution/deep-links/get-transaction-link.js +8 -6
- package/src/payment-institution/transactions/create-pi-transaction.js +15 -4
- package/src/payment-institution/transactions/finalize-transaction.js +7 -4
- package/src/payment-institution/transactions/get-transaction-history.js +7 -4
- package/src/payment-institution/transactions/get-transaction-status.js +15 -12
- package/src/payment-institution/transactions/process-pi-transaction.js +19 -8
- package/src/payment-institution/transactions/simulate-pi-callback.js +3 -0
- package/src/payment-institution/transactions/soundbite-transaction.js +5 -4
- package/src/proxy-server.js +25 -0
- package/src/shared/placements/api.js +51 -0
- package/src/shared/placements/tools.js +519 -0
- package/src/shared/poi/poi-create-api.js +3 -0
- package/src/shared/products/products-api.js +36 -25
- package/src/shared/shops/shops-api.js +2 -0
- package/src/shared/tool-annotations.js +53 -0
- package/src/tools/advanced-code-generator.js +3 -0
- package/src/utils/format-request.js +2 -0
- package/src/utils/json-formatter.js +2 -0
- package/src/utils/server-info.js +2 -0
- 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",
|
package/src/utils/server-info.js
CHANGED
|
@@ -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",
|