@cmdoss/suipay-mcp 0.2.2 → 0.3.0-dev.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.
@@ -0,0 +1,53 @@
1
+ import {
2
+ createServer,
3
+ loadLocalSigner,
4
+ loadLocalSigningKeyRecord,
5
+ loadMcpConfig,
6
+ loadPaymentProfile,
7
+ logError
8
+ } from "./chunk-FKDC22O6.js";
9
+
10
+ // src/index.ts
11
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
12
+ function loadBootProfile(load = loadPaymentProfile) {
13
+ try {
14
+ return { profile: load(), unreadable: false };
15
+ } catch {
16
+ return { profile: null, unreadable: true };
17
+ }
18
+ }
19
+ async function main() {
20
+ const argv = process.argv.slice(2);
21
+ const cfg = loadMcpConfig(process.env, argv);
22
+ const target = cfg.target ?? "dev";
23
+ const server = createServer(cfg, void 0, void 0, { transport: "stdio" });
24
+ await server.connect(new StdioServerTransport());
25
+ try {
26
+ const boundGateway = loadLocalSigningKeyRecord()?.gatewayUrl ?? cfg.gatewayUrl;
27
+ const local = loadLocalSigner();
28
+ if (local) {
29
+ process.stderr.write(`[suipay-mcp] ${target} ${boundGateway} \xB7 delegate ${local.address} \xB7 stdio ready
30
+ `);
31
+ } else {
32
+ process.stderr.write(`[suipay-mcp] ${target} ${boundGateway} \xB7 not connected \xB7 run suipay_login \xB7 stdio ready
33
+ `);
34
+ }
35
+ } catch (error) {
36
+ logError(
37
+ {
38
+ scope: "suipay-mcp",
39
+ code: "client.local_credentials_invalid",
40
+ level: "warn",
41
+ msg: "local credentials are unreadable; run suipay_login or suipay_logout force=true"
42
+ },
43
+ error
44
+ );
45
+ process.stderr.write(`[suipay-mcp] ${target} ${cfg.gatewayUrl} \xB7 credentials unreadable \xB7 stdio ready
46
+ `);
47
+ }
48
+ }
49
+
50
+ export {
51
+ loadBootProfile,
52
+ main
53
+ };