@payware/mcp-server 1.0.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 +92 -0
- package/MCP-SETUP.md +190 -0
- package/README.md +483 -0
- package/check-keys.js +52 -0
- package/keys/README.md +112 -0
- package/mcp-config.json +9 -0
- package/package.json +66 -0
- package/payware-mcp-config.json +12 -0
- package/src/auth/rsa-keys.js +82 -0
- package/src/auth/sandbox-setup.js +187 -0
- package/src/config/env.js +229 -0
- package/src/config/partner-types.js +143 -0
- package/src/core/auth/jwt-factory.js +182 -0
- package/src/core/auth/jwt-token.js +735 -0
- package/src/core/utils/json-serializer.js +100 -0
- package/src/core/utils/key-utils.js +133 -0
- package/src/index.js +237 -0
- package/src/isv/data/index.js +291 -0
- package/src/isv/deep-links/delete-product-link.js +154 -0
- package/src/isv/deep-links/delete-transaction-link.js +154 -0
- package/src/isv/deep-links/get-product-link.js +167 -0
- package/src/isv/deep-links/get-transaction-link.js +167 -0
- package/src/isv/deep-links/index.js +23 -0
- package/src/isv/index.js +103 -0
- package/src/isv/oauth2/create-token-simple.js +46 -0
- package/src/isv/oauth2/get-token-info.js +157 -0
- package/src/isv/oauth2/obtain-token.js +189 -0
- package/src/isv/oauth2/token-helper.js +151 -0
- package/src/isv/products/audios.js +470 -0
- package/src/isv/products/create-product.js +314 -0
- package/src/isv/products/delete-product.js +119 -0
- package/src/isv/products/get-product-image.js +247 -0
- package/src/isv/products/get-product.js +168 -0
- package/src/isv/products/index.js +65 -0
- package/src/isv/products/list-products.js +136 -0
- package/src/isv/products/schedules.js +522 -0
- package/src/isv/products/update-product.js +265 -0
- package/src/isv/transactions/cancel-transaction.js +129 -0
- package/src/isv/transactions/create-transaction.js +361 -0
- package/src/isv/transactions/get-status.js +217 -0
- package/src/isv/transactions/process-transaction.js +145 -0
- package/src/isv/transactions/simulate-callback.js +146 -0
- package/src/isv/transactions/transaction-history.js +186 -0
- package/src/isv/utils/auth.js +159 -0
- package/src/mcp-proxy.js +150 -0
- package/src/merchant/data/export-report.js +108 -0
- package/src/merchant/data/generate-report.js +151 -0
- package/src/merchant/data/get-report-status.js +120 -0
- package/src/merchant/data/index.js +351 -0
- package/src/merchant/deep-links/delete-product-link.js +121 -0
- package/src/merchant/deep-links/delete-transaction-link.js +121 -0
- package/src/merchant/deep-links/get-product-link.js +134 -0
- package/src/merchant/deep-links/get-transaction-link.js +134 -0
- package/src/merchant/deep-links/index.js +23 -0
- package/src/merchant/index.js +92 -0
- package/src/merchant/products/audios.js +606 -0
- package/src/merchant/products/create-product.js +288 -0
- package/src/merchant/products/delete-product.js +111 -0
- package/src/merchant/products/get-product-image.js +252 -0
- package/src/merchant/products/get-product.js +144 -0
- package/src/merchant/products/index.js +65 -0
- package/src/merchant/products/list-products.js +112 -0
- package/src/merchant/products/schedules.js +646 -0
- package/src/merchant/products/update-product.js +282 -0
- package/src/merchant/transactions/cancel-transaction.js +241 -0
- package/src/merchant/transactions/create-transaction.js +482 -0
- package/src/merchant/transactions/get-status.js +196 -0
- package/src/merchant/transactions/process-transaction.js +349 -0
- package/src/merchant/transactions/simulate-callback.js +246 -0
- package/src/merchant/transactions/transaction-history.js +258 -0
- package/src/payment-institution/data/index.js +280 -0
- package/src/payment-institution/deep-links/delete-transaction-link.js +128 -0
- package/src/payment-institution/deep-links/get-transaction-link.js +141 -0
- package/src/payment-institution/deep-links/index.js +17 -0
- package/src/payment-institution/index.js +92 -0
- package/src/payment-institution/transactions/create-pi-transaction.js +484 -0
- package/src/payment-institution/transactions/finalize-transaction.js +340 -0
- package/src/payment-institution/transactions/get-transaction-history.js +269 -0
- package/src/payment-institution/transactions/get-transaction-status.js +234 -0
- package/src/payment-institution/transactions/process-pi-transaction.js +421 -0
- package/src/payment-institution/transactions/simulate-pi-callback.js +326 -0
- package/src/payment-institution/transactions/soundbite-transaction.js +269 -0
- package/src/proxy-server.js +205 -0
- package/src/shared/data/data-api.js +372 -0
- package/src/shared/deep-links/api.js +214 -0
- package/src/shared/index.js +44 -0
- package/src/shared/products/products-api.js +872 -0
- package/src/tools/advanced-code-generator.js +2247 -0
- package/src/utils/code-examples/common/auth-examples.js +1482 -0
- package/src/utils/code-examples/common/helpers.js +416 -0
- package/src/utils/code-examples/common/utils-examples.js +591 -0
- package/src/utils/code-examples/frameworks/examples.js +859 -0
- package/src/utils/code-examples/index.js +441 -0
- package/src/utils/code-examples/isv/oauth2.js +600 -0
- package/src/utils/code-examples/isv/products.js +666 -0
- package/src/utils/code-examples/isv/transactions.js +813 -0
- package/src/utils/code-examples/merchant/products.js +497 -0
- package/src/utils/code-examples/merchant/transactions.js +623 -0
- package/src/utils/code-examples/payment-institution/transactions.js +388 -0
- package/src/utils/code-examples/shared/data.js +607 -0
- package/src/utils/code-examples/shared/deep-links.js +662 -0
- package/src/utils/code-examples/shared/soundbites.js +808 -0
- package/src/utils/code-examples.js +646 -0
- package/src/utils/format-request.js +363 -0
- package/src/utils/json-formatter.js +249 -0
- package/src/utils/server-info.js +132 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server information and version tool
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { readFileSync } from 'fs';
|
|
6
|
+
import { getPartnerTypeSafe, getSandboxUrl, getProductionUrl } from '../config/env.js';
|
|
7
|
+
import { getPartnerDisplayInfo, getPartnerConfig } from '../config/partner-types.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Get server information tool implementation
|
|
11
|
+
*/
|
|
12
|
+
export const getServerInfoTool = {
|
|
13
|
+
name: "payware_utils_server_info",
|
|
14
|
+
description: "Get MCP server version, status, and environment information",
|
|
15
|
+
inputSchema: {
|
|
16
|
+
type: "object",
|
|
17
|
+
properties: {
|
|
18
|
+
includeEnvironment: {
|
|
19
|
+
type: "boolean",
|
|
20
|
+
description: "Include environment details (default: true)"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
additionalProperties: false
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
async handler(args) {
|
|
27
|
+
const { includeEnvironment = true } = args;
|
|
28
|
+
const timestamp = new Date().toISOString();
|
|
29
|
+
|
|
30
|
+
// Get actual partner type information
|
|
31
|
+
const partnerType = getPartnerTypeSafe();
|
|
32
|
+
const partnerInfo = getPartnerDisplayInfo(partnerType);
|
|
33
|
+
const partnerConfig = getPartnerConfig(partnerType);
|
|
34
|
+
|
|
35
|
+
// Read actual package.json for version info
|
|
36
|
+
let packageInfo = { name: "payware-mcp-server", version: "1.0.0" };
|
|
37
|
+
try {
|
|
38
|
+
const packageJson = readFileSync('./package.json', 'utf8');
|
|
39
|
+
packageInfo = JSON.parse(packageJson);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
// Fallback to defaults if package.json not accessible
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Detect actual environment
|
|
45
|
+
const detectEnvironment = () => {
|
|
46
|
+
if (process.env.WSL_DISTRO_NAME) {
|
|
47
|
+
return `WSL (${process.env.WSL_DISTRO_NAME})`;
|
|
48
|
+
} else if (process.platform === 'linux' && process.env.container) {
|
|
49
|
+
return 'Container/Docker';
|
|
50
|
+
} else if (process.platform === 'darwin') {
|
|
51
|
+
return 'macOS';
|
|
52
|
+
} else if (process.platform === 'win32') {
|
|
53
|
+
return 'Windows';
|
|
54
|
+
} else {
|
|
55
|
+
return `${process.platform} (${process.arch})`;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const serverInfo = {
|
|
60
|
+
name: packageInfo.name,
|
|
61
|
+
version: packageInfo.version,
|
|
62
|
+
description: packageInfo.description || "payware MCP Server with Partner Type Support",
|
|
63
|
+
environment: detectEnvironment(),
|
|
64
|
+
nodeVersion: process.version,
|
|
65
|
+
platform: process.platform,
|
|
66
|
+
architecture: process.arch,
|
|
67
|
+
processId: process.pid,
|
|
68
|
+
uptime: Math.floor(process.uptime()),
|
|
69
|
+
timestamp: timestamp,
|
|
70
|
+
workingDirectory: process.cwd(),
|
|
71
|
+
memoryUsage: process.memoryUsage(),
|
|
72
|
+
// Partner-specific information
|
|
73
|
+
partnerType: partnerType,
|
|
74
|
+
partnerName: partnerInfo.name,
|
|
75
|
+
partnerDescription: partnerInfo.description,
|
|
76
|
+
authType: partnerConfig.authType,
|
|
77
|
+
capabilities: partnerConfig.capabilities,
|
|
78
|
+
sandboxUrl: getSandboxUrl(),
|
|
79
|
+
productionUrl: getProductionUrl()
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
content: [{
|
|
84
|
+
type: "text",
|
|
85
|
+
text: `🚀 **${serverInfo.name} v${serverInfo.version}**
|
|
86
|
+
|
|
87
|
+
${serverInfo.description}
|
|
88
|
+
|
|
89
|
+
**Partner Configuration:**
|
|
90
|
+
- 📋 Type: ${serverInfo.partnerName} (${serverInfo.partnerType})
|
|
91
|
+
- 📝 Description: ${serverInfo.partnerDescription}
|
|
92
|
+
- 🔐 Authentication: ${serverInfo.authType}
|
|
93
|
+
- ⚡ Capabilities: ${serverInfo.capabilities.length} (${serverInfo.capabilities.slice(0, 3).join(', ')}${serverInfo.capabilities.length > 3 ? '...' : ''})
|
|
94
|
+
- 🌐 Sandbox URL: ${serverInfo.sandboxUrl}
|
|
95
|
+
|
|
96
|
+
**Runtime Information:**
|
|
97
|
+
- 🖥️ Environment: ${serverInfo.environment}
|
|
98
|
+
- 📦 Node.js: ${serverInfo.nodeVersion}
|
|
99
|
+
- 🏗️ Platform: ${serverInfo.platform}/${serverInfo.architecture}
|
|
100
|
+
- 🔢 Process ID: ${serverInfo.processId}
|
|
101
|
+
- ⏱️ Uptime: ${serverInfo.uptime} seconds
|
|
102
|
+
- 📁 Working Directory: ${serverInfo.workingDirectory}
|
|
103
|
+
|
|
104
|
+
**Memory Usage:**
|
|
105
|
+
- RSS: ${Math.round(serverInfo.memoryUsage.rss / 1024 / 1024)} MB
|
|
106
|
+
- Heap Used: ${Math.round(serverInfo.memoryUsage.heapUsed / 1024 / 1024)} MB
|
|
107
|
+
- Heap Total: ${Math.round(serverInfo.memoryUsage.heapTotal / 1024 / 1024)} MB
|
|
108
|
+
- External: ${Math.round(serverInfo.memoryUsage.external / 1024 / 1024)} MB
|
|
109
|
+
|
|
110
|
+
**Connection Status:**
|
|
111
|
+
- ✅ MCP Server is running and responding
|
|
112
|
+
- ✅ Partner type configured correctly
|
|
113
|
+
- ✅ Tools loaded successfully
|
|
114
|
+
- 🔗 This response confirms active connection
|
|
115
|
+
|
|
116
|
+
**Generated:** ${serverInfo.timestamp}
|
|
117
|
+
|
|
118
|
+
${includeEnvironment ? `
|
|
119
|
+
**Environment Variables:**
|
|
120
|
+
- NODE_ENV: ${process.env.NODE_ENV || 'development'}
|
|
121
|
+
- HOME: ${process.env.HOME || 'N/A'}
|
|
122
|
+
- USER: ${process.env.USER || 'N/A'}
|
|
123
|
+
- PWD: ${process.env.PWD || 'N/A'}
|
|
124
|
+
${process.env.WSL_DISTRO_NAME ? `- WSL_DISTRO_NAME: ${process.env.WSL_DISTRO_NAME}` : ''}
|
|
125
|
+
${process.env.container ? `- CONTAINER: ${process.env.container}` : ''}
|
|
126
|
+
` : ''}
|
|
127
|
+
|
|
128
|
+
**📝 Note:** If you can see this response, your payware MCP server is working correctly!`
|
|
129
|
+
}]
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
};
|