@suigar/mcp 0.1.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/README.md +164 -0
- package/dist/bin.cjs +11 -0
- package/dist/bin.d.cts +1 -0
- package/dist/bin.d.mts +1 -0
- package/dist/bin.mjs +12 -0
- package/dist/client.cjs +46 -0
- package/dist/client.d.cts +17 -0
- package/dist/client.d.mts +17 -0
- package/dist/client.mjs +43 -0
- package/dist/coin.cjs +86 -0
- package/dist/coin.d.cts +35 -0
- package/dist/coin.d.mts +35 -0
- package/dist/coin.mjs +86 -0
- package/dist/config.cjs +183 -0
- package/dist/config.d.cts +15 -0
- package/dist/config.d.mts +15 -0
- package/dist/config.mjs +174 -0
- package/dist/index.cjs +53 -0
- package/dist/index.d.cts +10 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.mjs +9 -0
- package/dist/mcp-support.cjs +62 -0
- package/dist/mcp-support.d.cts +16 -0
- package/dist/mcp-support.d.mts +16 -0
- package/dist/mcp-support.mjs +60 -0
- package/dist/metadata.cjs +51 -0
- package/dist/metadata.d.cts +52 -0
- package/dist/metadata.d.mts +52 -0
- package/dist/metadata.mjs +47 -0
- package/dist/server.cjs +433 -0
- package/dist/server.d.cts +73 -0
- package/dist/server.d.mts +73 -0
- package/dist/server.mjs +431 -0
- package/dist/tools.cjs +617 -0
- package/dist/tools.d.cts +158 -0
- package/dist/tools.d.mts +158 -0
- package/dist/tools.mjs +608 -0
- package/dist/transactions.cjs +294 -0
- package/dist/transactions.d.cts +40 -0
- package/dist/transactions.d.mts +40 -0
- package/dist/transactions.mjs +286 -0
- package/dist/types.d.cts +111 -0
- package/dist/types.d.mts +111 -0
- package/node_modules/@suigar/currency-registry/dist/index.cjs +121 -0
- package/node_modules/@suigar/currency-registry/dist/index.d.cts +50 -0
- package/node_modules/@suigar/currency-registry/dist/index.d.mts +50 -0
- package/node_modules/@suigar/currency-registry/dist/index.mjs +110 -0
- package/node_modules/@suigar/currency-registry/package.json +31 -0
- package/node_modules/@suigar/game-registry/dist/index.cjs +310 -0
- package/node_modules/@suigar/game-registry/dist/index.d.cts +65 -0
- package/node_modules/@suigar/game-registry/dist/index.d.mts +65 -0
- package/node_modules/@suigar/game-registry/dist/index.mjs +292 -0
- package/node_modules/@suigar/game-registry/package.json +31 -0
- package/node_modules/@suigar/sui-rpc-pool/dist/index.cjs +45590 -0
- package/node_modules/@suigar/sui-rpc-pool/dist/index.d.cts +465 -0
- package/node_modules/@suigar/sui-rpc-pool/dist/index.d.mts +465 -0
- package/node_modules/@suigar/sui-rpc-pool/dist/index.mjs +45570 -0
- package/node_modules/@suigar/sui-rpc-pool/package.json +31 -0
- package/package.json +62 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const require_mcp_support = require("./mcp-support.cjs");
|
|
2
|
+
const require_config = require("./config.cjs");
|
|
3
|
+
let _suigar_currency_registry = require("@suigar/currency-registry");
|
|
4
|
+
let _suigar_game_registry = require("@suigar/game-registry");
|
|
5
|
+
//#region src/metadata.ts
|
|
6
|
+
const listSupportedGames = ({ activeOnly = true } = {}) => (activeOnly ? (0, _suigar_game_registry.getActiveGames)() : (0, _suigar_game_registry.getActiveGames)()).map((game) => ({
|
|
7
|
+
...game,
|
|
8
|
+
mcpSupport: require_mcp_support.getMcpSupportForGame(game.id)
|
|
9
|
+
}));
|
|
10
|
+
const getGameMetadata = (game, configInput = {}) => {
|
|
11
|
+
const resolvedGame = (0, _suigar_game_registry.getGameById)(game) ?? (0, _suigar_game_registry.getGameByAlias)(game);
|
|
12
|
+
if (!resolvedGame) throw new Error(`Unsupported game: ${game}`);
|
|
13
|
+
const mcpSupport = require_mcp_support.getMcpSupportForGame(resolvedGame.id);
|
|
14
|
+
const supportedGameId = mcpSupport.toolSupported ? resolvedGame.id : null;
|
|
15
|
+
const packageId = supportedGameId ? require_config.resolveGamePackageId(supportedGameId, configInput) : null;
|
|
16
|
+
const settingsDefinition = (0, _suigar_game_registry.getOnchainGameSettingsDefinition)(resolvedGame.id);
|
|
17
|
+
const settingsId = supportedGameId ? require_config.resolveGameSettingsId(supportedGameId, configInput) : null;
|
|
18
|
+
return {
|
|
19
|
+
...resolvedGame,
|
|
20
|
+
mcpSupport,
|
|
21
|
+
packageId,
|
|
22
|
+
settingsId,
|
|
23
|
+
onchainSettings: packageId && settingsDefinition ? {
|
|
24
|
+
definition: settingsDefinition,
|
|
25
|
+
objectType: (0, _suigar_game_registry.buildOnchainGameSettingsObjectType)(packageId, settingsDefinition),
|
|
26
|
+
parametersTypePrefix: (0, _suigar_game_registry.buildOnchainGameParametersTypePrefix)(packageId, settingsDefinition)
|
|
27
|
+
} : null
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
const listConfiguredCurrencies = (configInput = {}) => {
|
|
31
|
+
const inspection = require_config.inspectResolvedConfig(configInput);
|
|
32
|
+
return (0, _suigar_currency_registry.buildConfiguredCurrencies)({
|
|
33
|
+
suiCoinType: inspection.config.suiCoinType,
|
|
34
|
+
usdcCoinType: inspection.config.usdcCoinType
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
const getCurrencyInfo = (coinType, configInput = {}) => {
|
|
38
|
+
const configuredCurrencies = listConfiguredCurrencies(configInput);
|
|
39
|
+
return {
|
|
40
|
+
coinType,
|
|
41
|
+
configuredCurrencies,
|
|
42
|
+
metadata: (0, _suigar_currency_registry.resolveCurrencyMetadata)(coinType, configuredCurrencies)
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
const readConfigMetadata = (configInput = {}) => require_config.inspectResolvedConfig(configInput);
|
|
46
|
+
//#endregion
|
|
47
|
+
exports.getCurrencyInfo = getCurrencyInfo;
|
|
48
|
+
exports.getGameMetadata = getGameMetadata;
|
|
49
|
+
exports.listConfiguredCurrencies = listConfiguredCurrencies;
|
|
50
|
+
exports.listSupportedGames = listSupportedGames;
|
|
51
|
+
exports.readConfigMetadata = readConfigMetadata;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { GameMcpSupport } from "./mcp-support.cjs";
|
|
2
|
+
import { ConfigInspection, SuigarConfigInput } from "./types.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/metadata.d.ts
|
|
5
|
+
declare const listSupportedGames: ({
|
|
6
|
+
activeOnly
|
|
7
|
+
}?: {
|
|
8
|
+
activeOnly?: boolean;
|
|
9
|
+
}) => {
|
|
10
|
+
mcpSupport: GameMcpSupport;
|
|
11
|
+
id: import("@suigar/game-registry").GameId;
|
|
12
|
+
name: string;
|
|
13
|
+
module: import("@suigar/game-registry").GameModule;
|
|
14
|
+
eventTypeName: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
aliases: string[];
|
|
17
|
+
tags?: string[];
|
|
18
|
+
status?: import("@suigar/game-registry").GameStatus;
|
|
19
|
+
updatedAt?: string;
|
|
20
|
+
}[];
|
|
21
|
+
declare const getGameMetadata: (game: string, configInput?: SuigarConfigInput) => {
|
|
22
|
+
mcpSupport: GameMcpSupport;
|
|
23
|
+
packageId: string | null;
|
|
24
|
+
settingsId: string | null;
|
|
25
|
+
onchainSettings: {
|
|
26
|
+
definition: import("@suigar/game-registry").OnchainGameSettingsDefinition;
|
|
27
|
+
objectType: string;
|
|
28
|
+
parametersTypePrefix: string;
|
|
29
|
+
} | null;
|
|
30
|
+
id: import("@suigar/game-registry").GameId;
|
|
31
|
+
name: string;
|
|
32
|
+
module: import("@suigar/game-registry").GameModule;
|
|
33
|
+
eventTypeName: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
aliases: string[];
|
|
36
|
+
tags?: string[];
|
|
37
|
+
status?: import("@suigar/game-registry").GameStatus;
|
|
38
|
+
updatedAt?: string;
|
|
39
|
+
};
|
|
40
|
+
declare const listConfiguredCurrencies: (configInput?: SuigarConfigInput) => import("@suigar/currency-registry").ConfiguredCurrencyEntry[];
|
|
41
|
+
declare const getCurrencyInfo: (coinType: string, configInput?: SuigarConfigInput) => {
|
|
42
|
+
coinType: string;
|
|
43
|
+
configuredCurrencies: import("@suigar/currency-registry").ConfiguredCurrencyEntry[];
|
|
44
|
+
metadata: {
|
|
45
|
+
symbol: string;
|
|
46
|
+
name: string;
|
|
47
|
+
decimals: number;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
declare const readConfigMetadata: (configInput?: SuigarConfigInput) => ConfigInspection;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { getCurrencyInfo, getGameMetadata, listConfiguredCurrencies, listSupportedGames, readConfigMetadata };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { GameMcpSupport } from "./mcp-support.mjs";
|
|
2
|
+
import { ConfigInspection, SuigarConfigInput } from "./types.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/metadata.d.ts
|
|
5
|
+
declare const listSupportedGames: ({
|
|
6
|
+
activeOnly
|
|
7
|
+
}?: {
|
|
8
|
+
activeOnly?: boolean;
|
|
9
|
+
}) => {
|
|
10
|
+
mcpSupport: GameMcpSupport;
|
|
11
|
+
id: import("@suigar/game-registry").GameId;
|
|
12
|
+
name: string;
|
|
13
|
+
module: import("@suigar/game-registry").GameModule;
|
|
14
|
+
eventTypeName: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
aliases: string[];
|
|
17
|
+
tags?: string[];
|
|
18
|
+
status?: import("@suigar/game-registry").GameStatus;
|
|
19
|
+
updatedAt?: string;
|
|
20
|
+
}[];
|
|
21
|
+
declare const getGameMetadata: (game: string, configInput?: SuigarConfigInput) => {
|
|
22
|
+
mcpSupport: GameMcpSupport;
|
|
23
|
+
packageId: string | null;
|
|
24
|
+
settingsId: string | null;
|
|
25
|
+
onchainSettings: {
|
|
26
|
+
definition: import("@suigar/game-registry").OnchainGameSettingsDefinition;
|
|
27
|
+
objectType: string;
|
|
28
|
+
parametersTypePrefix: string;
|
|
29
|
+
} | null;
|
|
30
|
+
id: import("@suigar/game-registry").GameId;
|
|
31
|
+
name: string;
|
|
32
|
+
module: import("@suigar/game-registry").GameModule;
|
|
33
|
+
eventTypeName: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
aliases: string[];
|
|
36
|
+
tags?: string[];
|
|
37
|
+
status?: import("@suigar/game-registry").GameStatus;
|
|
38
|
+
updatedAt?: string;
|
|
39
|
+
};
|
|
40
|
+
declare const listConfiguredCurrencies: (configInput?: SuigarConfigInput) => import("@suigar/currency-registry").ConfiguredCurrencyEntry[];
|
|
41
|
+
declare const getCurrencyInfo: (coinType: string, configInput?: SuigarConfigInput) => {
|
|
42
|
+
coinType: string;
|
|
43
|
+
configuredCurrencies: import("@suigar/currency-registry").ConfiguredCurrencyEntry[];
|
|
44
|
+
metadata: {
|
|
45
|
+
symbol: string;
|
|
46
|
+
name: string;
|
|
47
|
+
decimals: number;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
declare const readConfigMetadata: (configInput?: SuigarConfigInput) => ConfigInspection;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { getCurrencyInfo, getGameMetadata, listConfiguredCurrencies, listSupportedGames, readConfigMetadata };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { getMcpSupportForGame } from "./mcp-support.mjs";
|
|
2
|
+
import { inspectResolvedConfig, resolveGamePackageId, resolveGameSettingsId } from "./config.mjs";
|
|
3
|
+
import { buildConfiguredCurrencies, resolveCurrencyMetadata } from "@suigar/currency-registry";
|
|
4
|
+
import { buildOnchainGameParametersTypePrefix, buildOnchainGameSettingsObjectType, getActiveGames, getGameByAlias, getGameById, getOnchainGameSettingsDefinition } from "@suigar/game-registry";
|
|
5
|
+
//#region src/metadata.ts
|
|
6
|
+
const listSupportedGames = ({ activeOnly = true } = {}) => (activeOnly ? getActiveGames() : getActiveGames()).map((game) => ({
|
|
7
|
+
...game,
|
|
8
|
+
mcpSupport: getMcpSupportForGame(game.id)
|
|
9
|
+
}));
|
|
10
|
+
const getGameMetadata = (game, configInput = {}) => {
|
|
11
|
+
const resolvedGame = getGameById(game) ?? getGameByAlias(game);
|
|
12
|
+
if (!resolvedGame) throw new Error(`Unsupported game: ${game}`);
|
|
13
|
+
const mcpSupport = getMcpSupportForGame(resolvedGame.id);
|
|
14
|
+
const supportedGameId = mcpSupport.toolSupported ? resolvedGame.id : null;
|
|
15
|
+
const packageId = supportedGameId ? resolveGamePackageId(supportedGameId, configInput) : null;
|
|
16
|
+
const settingsDefinition = getOnchainGameSettingsDefinition(resolvedGame.id);
|
|
17
|
+
const settingsId = supportedGameId ? resolveGameSettingsId(supportedGameId, configInput) : null;
|
|
18
|
+
return {
|
|
19
|
+
...resolvedGame,
|
|
20
|
+
mcpSupport,
|
|
21
|
+
packageId,
|
|
22
|
+
settingsId,
|
|
23
|
+
onchainSettings: packageId && settingsDefinition ? {
|
|
24
|
+
definition: settingsDefinition,
|
|
25
|
+
objectType: buildOnchainGameSettingsObjectType(packageId, settingsDefinition),
|
|
26
|
+
parametersTypePrefix: buildOnchainGameParametersTypePrefix(packageId, settingsDefinition)
|
|
27
|
+
} : null
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
const listConfiguredCurrencies = (configInput = {}) => {
|
|
31
|
+
const inspection = inspectResolvedConfig(configInput);
|
|
32
|
+
return buildConfiguredCurrencies({
|
|
33
|
+
suiCoinType: inspection.config.suiCoinType,
|
|
34
|
+
usdcCoinType: inspection.config.usdcCoinType
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
const getCurrencyInfo = (coinType, configInput = {}) => {
|
|
38
|
+
const configuredCurrencies = listConfiguredCurrencies(configInput);
|
|
39
|
+
return {
|
|
40
|
+
coinType,
|
|
41
|
+
configuredCurrencies,
|
|
42
|
+
metadata: resolveCurrencyMetadata(coinType, configuredCurrencies)
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
const readConfigMetadata = (configInput = {}) => inspectResolvedConfig(configInput);
|
|
46
|
+
//#endregion
|
|
47
|
+
export { getCurrencyInfo, getGameMetadata, listConfiguredCurrencies, listSupportedGames, readConfigMetadata };
|
package/dist/server.cjs
ADDED
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_tools = require("./tools.cjs");
|
|
3
|
+
let _modelcontextprotocol_sdk_server_index_js = require("@modelcontextprotocol/sdk/server/index.js");
|
|
4
|
+
let _modelcontextprotocol_sdk_server_stdio_js = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
5
|
+
let _modelcontextprotocol_sdk_types_js = require("@modelcontextprotocol/sdk/types.js");
|
|
6
|
+
//#region src/server.ts
|
|
7
|
+
const json = (value) => JSON.stringify(value, null, 2);
|
|
8
|
+
const TOOL_DEFINITIONS = [
|
|
9
|
+
{
|
|
10
|
+
name: "read_config",
|
|
11
|
+
description: "Resolve Suigar config for the target network, defaulting to testnet.",
|
|
12
|
+
inputSchema: {
|
|
13
|
+
type: "object",
|
|
14
|
+
properties: {
|
|
15
|
+
network: {
|
|
16
|
+
type: "string",
|
|
17
|
+
default: "testnet"
|
|
18
|
+
},
|
|
19
|
+
providerUrl: { type: "string" },
|
|
20
|
+
graphqlUrl: { type: "string" },
|
|
21
|
+
config: {
|
|
22
|
+
type: "object",
|
|
23
|
+
additionalProperties: true
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
additionalProperties: true
|
|
27
|
+
},
|
|
28
|
+
handler: require_tools.readConfigTool
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "read_game_metadata",
|
|
32
|
+
description: "Read Suigar game metadata, on-chain settings metadata, and optional currency metadata.",
|
|
33
|
+
inputSchema: {
|
|
34
|
+
type: "object",
|
|
35
|
+
properties: {
|
|
36
|
+
game: { type: "string" },
|
|
37
|
+
coinType: { type: "string" },
|
|
38
|
+
network: {
|
|
39
|
+
type: "string",
|
|
40
|
+
default: "testnet"
|
|
41
|
+
},
|
|
42
|
+
config: {
|
|
43
|
+
type: "object",
|
|
44
|
+
additionalProperties: true
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
additionalProperties: true
|
|
48
|
+
},
|
|
49
|
+
handler: require_tools.readGameMetadataTool
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "build_coinflip_transaction",
|
|
53
|
+
description: "Build, dry-run, or inspect a Suigar coinflip transaction on testnet by default.",
|
|
54
|
+
inputSchema: {
|
|
55
|
+
type: "object",
|
|
56
|
+
properties: {
|
|
57
|
+
mode: {
|
|
58
|
+
type: "string",
|
|
59
|
+
enum: [
|
|
60
|
+
"build",
|
|
61
|
+
"dry-run",
|
|
62
|
+
"read-only"
|
|
63
|
+
],
|
|
64
|
+
default: "build"
|
|
65
|
+
},
|
|
66
|
+
network: {
|
|
67
|
+
type: "string",
|
|
68
|
+
default: "testnet"
|
|
69
|
+
},
|
|
70
|
+
owner: { type: "string" },
|
|
71
|
+
coinType: { type: "string" },
|
|
72
|
+
stake: { type: "number" },
|
|
73
|
+
cashStake: { type: "number" },
|
|
74
|
+
betCount: { type: "number" },
|
|
75
|
+
side: {
|
|
76
|
+
type: "string",
|
|
77
|
+
enum: ["heads", "tails"]
|
|
78
|
+
},
|
|
79
|
+
coinObjectIds: {
|
|
80
|
+
type: "array",
|
|
81
|
+
items: { type: "string" }
|
|
82
|
+
},
|
|
83
|
+
partner: { type: "string" },
|
|
84
|
+
metadata: {
|
|
85
|
+
type: "object",
|
|
86
|
+
additionalProperties: true
|
|
87
|
+
},
|
|
88
|
+
config: {
|
|
89
|
+
type: "object",
|
|
90
|
+
additionalProperties: true
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
additionalProperties: true
|
|
94
|
+
},
|
|
95
|
+
handler: require_tools.buildCoinflipTransactionTool
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "build_limbo_transaction",
|
|
99
|
+
description: "Build, dry-run, or inspect a Suigar limbo transaction.",
|
|
100
|
+
inputSchema: {
|
|
101
|
+
type: "object",
|
|
102
|
+
properties: {
|
|
103
|
+
mode: {
|
|
104
|
+
type: "string",
|
|
105
|
+
enum: [
|
|
106
|
+
"build",
|
|
107
|
+
"dry-run",
|
|
108
|
+
"read-only"
|
|
109
|
+
],
|
|
110
|
+
default: "build"
|
|
111
|
+
},
|
|
112
|
+
network: {
|
|
113
|
+
type: "string",
|
|
114
|
+
default: "testnet"
|
|
115
|
+
},
|
|
116
|
+
owner: { type: "string" },
|
|
117
|
+
coinType: { type: "string" },
|
|
118
|
+
stake: { type: "number" },
|
|
119
|
+
cashStake: { type: "number" },
|
|
120
|
+
betCount: { type: "number" },
|
|
121
|
+
targetMultiplier: { type: "number" },
|
|
122
|
+
coinObjectIds: {
|
|
123
|
+
type: "array",
|
|
124
|
+
items: { type: "string" }
|
|
125
|
+
},
|
|
126
|
+
partner: { type: "string" },
|
|
127
|
+
metadata: {
|
|
128
|
+
type: "object",
|
|
129
|
+
additionalProperties: true
|
|
130
|
+
},
|
|
131
|
+
config: {
|
|
132
|
+
type: "object",
|
|
133
|
+
additionalProperties: true
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
additionalProperties: true
|
|
137
|
+
},
|
|
138
|
+
handler: require_tools.buildLimboTransactionTool
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: "build_plinko_transaction",
|
|
142
|
+
description: "Build, dry-run, or inspect a Suigar plinko transaction.",
|
|
143
|
+
inputSchema: {
|
|
144
|
+
type: "object",
|
|
145
|
+
properties: {
|
|
146
|
+
mode: {
|
|
147
|
+
type: "string",
|
|
148
|
+
enum: [
|
|
149
|
+
"build",
|
|
150
|
+
"dry-run",
|
|
151
|
+
"read-only"
|
|
152
|
+
],
|
|
153
|
+
default: "build"
|
|
154
|
+
},
|
|
155
|
+
network: {
|
|
156
|
+
type: "string",
|
|
157
|
+
default: "testnet"
|
|
158
|
+
},
|
|
159
|
+
owner: { type: "string" },
|
|
160
|
+
coinType: { type: "string" },
|
|
161
|
+
stake: { type: "number" },
|
|
162
|
+
cashStake: { type: "number" },
|
|
163
|
+
betCount: { type: "number" },
|
|
164
|
+
configId: { type: "number" },
|
|
165
|
+
coinObjectIds: {
|
|
166
|
+
type: "array",
|
|
167
|
+
items: { type: "string" }
|
|
168
|
+
},
|
|
169
|
+
partner: { type: "string" },
|
|
170
|
+
metadata: {
|
|
171
|
+
type: "object",
|
|
172
|
+
additionalProperties: true
|
|
173
|
+
},
|
|
174
|
+
config: {
|
|
175
|
+
type: "object",
|
|
176
|
+
additionalProperties: true
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
additionalProperties: true
|
|
180
|
+
},
|
|
181
|
+
handler: require_tools.buildPlinkoTransactionTool
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: "build_wheel_transaction",
|
|
185
|
+
description: "Build, dry-run, or inspect a Suigar wheel transaction.",
|
|
186
|
+
inputSchema: {
|
|
187
|
+
type: "object",
|
|
188
|
+
properties: {
|
|
189
|
+
mode: {
|
|
190
|
+
type: "string",
|
|
191
|
+
enum: [
|
|
192
|
+
"build",
|
|
193
|
+
"dry-run",
|
|
194
|
+
"read-only"
|
|
195
|
+
],
|
|
196
|
+
default: "build"
|
|
197
|
+
},
|
|
198
|
+
network: {
|
|
199
|
+
type: "string",
|
|
200
|
+
default: "testnet"
|
|
201
|
+
},
|
|
202
|
+
owner: { type: "string" },
|
|
203
|
+
coinType: { type: "string" },
|
|
204
|
+
stake: { type: "number" },
|
|
205
|
+
cashStake: { type: "number" },
|
|
206
|
+
betCount: { type: "number" },
|
|
207
|
+
configId: { type: "number" },
|
|
208
|
+
coinObjectIds: {
|
|
209
|
+
type: "array",
|
|
210
|
+
items: { type: "string" }
|
|
211
|
+
},
|
|
212
|
+
partner: { type: "string" },
|
|
213
|
+
metadata: {
|
|
214
|
+
type: "object",
|
|
215
|
+
additionalProperties: true
|
|
216
|
+
},
|
|
217
|
+
config: {
|
|
218
|
+
type: "object",
|
|
219
|
+
additionalProperties: true
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
additionalProperties: true
|
|
223
|
+
},
|
|
224
|
+
handler: require_tools.buildWheelTransactionTool
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
name: "build_range_transaction",
|
|
228
|
+
description: "Build, dry-run, or inspect a Suigar range transaction.",
|
|
229
|
+
inputSchema: {
|
|
230
|
+
type: "object",
|
|
231
|
+
properties: {
|
|
232
|
+
mode: {
|
|
233
|
+
type: "string",
|
|
234
|
+
enum: [
|
|
235
|
+
"build",
|
|
236
|
+
"dry-run",
|
|
237
|
+
"read-only"
|
|
238
|
+
],
|
|
239
|
+
default: "build"
|
|
240
|
+
},
|
|
241
|
+
network: {
|
|
242
|
+
type: "string",
|
|
243
|
+
default: "testnet"
|
|
244
|
+
},
|
|
245
|
+
owner: { type: "string" },
|
|
246
|
+
coinType: { type: "string" },
|
|
247
|
+
stake: { type: "number" },
|
|
248
|
+
cashStake: { type: "number" },
|
|
249
|
+
betCount: { type: "number" },
|
|
250
|
+
leftPoint: { type: "number" },
|
|
251
|
+
rightPoint: { type: "number" },
|
|
252
|
+
outOfRange: { type: "boolean" },
|
|
253
|
+
coinObjectIds: {
|
|
254
|
+
type: "array",
|
|
255
|
+
items: { type: "string" }
|
|
256
|
+
},
|
|
257
|
+
partner: { type: "string" },
|
|
258
|
+
metadata: {
|
|
259
|
+
type: "object",
|
|
260
|
+
additionalProperties: true
|
|
261
|
+
},
|
|
262
|
+
config: {
|
|
263
|
+
type: "object",
|
|
264
|
+
additionalProperties: true
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
additionalProperties: true
|
|
268
|
+
},
|
|
269
|
+
handler: require_tools.buildRangeTransactionTool
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
name: "build_pvp_coinflip_create_transaction",
|
|
273
|
+
description: "Build, dry-run, or inspect a Suigar PvP coinflip create transaction.",
|
|
274
|
+
inputSchema: {
|
|
275
|
+
type: "object",
|
|
276
|
+
properties: {
|
|
277
|
+
mode: {
|
|
278
|
+
type: "string",
|
|
279
|
+
enum: [
|
|
280
|
+
"build",
|
|
281
|
+
"dry-run",
|
|
282
|
+
"read-only"
|
|
283
|
+
],
|
|
284
|
+
default: "build"
|
|
285
|
+
},
|
|
286
|
+
network: {
|
|
287
|
+
type: "string",
|
|
288
|
+
default: "testnet"
|
|
289
|
+
},
|
|
290
|
+
owner: { type: "string" },
|
|
291
|
+
coinType: { type: "string" },
|
|
292
|
+
stake: { type: "number" },
|
|
293
|
+
creatorSide: {
|
|
294
|
+
type: "string",
|
|
295
|
+
enum: ["heads", "tails"]
|
|
296
|
+
},
|
|
297
|
+
isPrivate: { type: "boolean" },
|
|
298
|
+
coinObjectIds: {
|
|
299
|
+
type: "array",
|
|
300
|
+
items: { type: "string" }
|
|
301
|
+
},
|
|
302
|
+
partner: { type: "string" },
|
|
303
|
+
metadata: {
|
|
304
|
+
type: "object",
|
|
305
|
+
additionalProperties: true
|
|
306
|
+
},
|
|
307
|
+
config: {
|
|
308
|
+
type: "object",
|
|
309
|
+
additionalProperties: true
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
additionalProperties: true
|
|
313
|
+
},
|
|
314
|
+
handler: require_tools.buildPvpCoinflipCreateTransactionTool
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
name: "build_pvp_coinflip_join_transaction",
|
|
318
|
+
description: "Build, dry-run, or inspect a Suigar PvP coinflip join transaction.",
|
|
319
|
+
inputSchema: {
|
|
320
|
+
type: "object",
|
|
321
|
+
properties: {
|
|
322
|
+
mode: {
|
|
323
|
+
type: "string",
|
|
324
|
+
enum: [
|
|
325
|
+
"build",
|
|
326
|
+
"dry-run",
|
|
327
|
+
"read-only"
|
|
328
|
+
],
|
|
329
|
+
default: "build"
|
|
330
|
+
},
|
|
331
|
+
network: {
|
|
332
|
+
type: "string",
|
|
333
|
+
default: "testnet"
|
|
334
|
+
},
|
|
335
|
+
owner: { type: "string" },
|
|
336
|
+
gameId: { type: "string" },
|
|
337
|
+
coinType: { type: "string" },
|
|
338
|
+
stake: { type: "number" },
|
|
339
|
+
coinObjectIds: {
|
|
340
|
+
type: "array",
|
|
341
|
+
items: { type: "string" }
|
|
342
|
+
},
|
|
343
|
+
partner: { type: "string" },
|
|
344
|
+
metadata: {
|
|
345
|
+
type: "object",
|
|
346
|
+
additionalProperties: true
|
|
347
|
+
},
|
|
348
|
+
config: {
|
|
349
|
+
type: "object",
|
|
350
|
+
additionalProperties: true
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
additionalProperties: true
|
|
354
|
+
},
|
|
355
|
+
handler: require_tools.buildPvpCoinflipJoinTransactionTool
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
name: "build_pvp_coinflip_cancel_transaction",
|
|
359
|
+
description: "Build, dry-run, or inspect a Suigar PvP coinflip cancel transaction.",
|
|
360
|
+
inputSchema: {
|
|
361
|
+
type: "object",
|
|
362
|
+
properties: {
|
|
363
|
+
mode: {
|
|
364
|
+
type: "string",
|
|
365
|
+
enum: [
|
|
366
|
+
"build",
|
|
367
|
+
"dry-run",
|
|
368
|
+
"read-only"
|
|
369
|
+
],
|
|
370
|
+
default: "build"
|
|
371
|
+
},
|
|
372
|
+
network: {
|
|
373
|
+
type: "string",
|
|
374
|
+
default: "testnet"
|
|
375
|
+
},
|
|
376
|
+
owner: { type: "string" },
|
|
377
|
+
gameId: { type: "string" },
|
|
378
|
+
coinType: { type: "string" },
|
|
379
|
+
config: {
|
|
380
|
+
type: "object",
|
|
381
|
+
additionalProperties: true
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
additionalProperties: true
|
|
385
|
+
},
|
|
386
|
+
handler: require_tools.buildPvpCoinflipCancelTransactionTool
|
|
387
|
+
}
|
|
388
|
+
];
|
|
389
|
+
const createSuigarMcpServer = () => {
|
|
390
|
+
const server = new _modelcontextprotocol_sdk_server_index_js.Server({
|
|
391
|
+
name: "suigar",
|
|
392
|
+
version: "0.0.0"
|
|
393
|
+
}, { capabilities: { tools: {} } });
|
|
394
|
+
server.setRequestHandler(_modelcontextprotocol_sdk_types_js.ListToolsRequestSchema, async () => ({ tools: TOOL_DEFINITIONS.map(({ name, description, inputSchema }) => ({
|
|
395
|
+
name,
|
|
396
|
+
description,
|
|
397
|
+
inputSchema
|
|
398
|
+
})) }));
|
|
399
|
+
server.setRequestHandler(_modelcontextprotocol_sdk_types_js.CallToolRequestSchema, async (request) => {
|
|
400
|
+
const tool = TOOL_DEFINITIONS.find((entry) => entry.name === request.params.name);
|
|
401
|
+
if (!tool) return {
|
|
402
|
+
isError: true,
|
|
403
|
+
content: [{
|
|
404
|
+
type: "text",
|
|
405
|
+
text: `Unknown tool: ${request.params.name}`
|
|
406
|
+
}]
|
|
407
|
+
};
|
|
408
|
+
try {
|
|
409
|
+
return { content: [{
|
|
410
|
+
type: "text",
|
|
411
|
+
text: json(await tool.handler(request.params.arguments ?? {}))
|
|
412
|
+
}] };
|
|
413
|
+
} catch (error) {
|
|
414
|
+
return {
|
|
415
|
+
isError: true,
|
|
416
|
+
content: [{
|
|
417
|
+
type: "text",
|
|
418
|
+
text: error instanceof Error ? error.message : String(error ?? "Unknown error")
|
|
419
|
+
}]
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
return server;
|
|
424
|
+
};
|
|
425
|
+
const startSuigarMcpServer = async () => {
|
|
426
|
+
const server = createSuigarMcpServer();
|
|
427
|
+
const transport = new _modelcontextprotocol_sdk_server_stdio_js.StdioServerTransport();
|
|
428
|
+
await server.connect(transport);
|
|
429
|
+
return server;
|
|
430
|
+
};
|
|
431
|
+
//#endregion
|
|
432
|
+
exports.createSuigarMcpServer = createSuigarMcpServer;
|
|
433
|
+
exports.startSuigarMcpServer = startSuigarMcpServer;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
2
|
+
|
|
3
|
+
//#region src/server.d.ts
|
|
4
|
+
declare const createSuigarMcpServer: () => Server<{
|
|
5
|
+
method: string;
|
|
6
|
+
params?: {
|
|
7
|
+
[x: string]: unknown;
|
|
8
|
+
_meta?: {
|
|
9
|
+
[x: string]: unknown;
|
|
10
|
+
progressToken?: string | number | undefined;
|
|
11
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
12
|
+
taskId: string;
|
|
13
|
+
} | undefined;
|
|
14
|
+
} | undefined;
|
|
15
|
+
} | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
method: string;
|
|
18
|
+
params?: {
|
|
19
|
+
[x: string]: unknown;
|
|
20
|
+
_meta?: {
|
|
21
|
+
[x: string]: unknown;
|
|
22
|
+
progressToken?: string | number | undefined;
|
|
23
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
24
|
+
taskId: string;
|
|
25
|
+
} | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
} | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
[x: string]: unknown;
|
|
30
|
+
_meta?: {
|
|
31
|
+
[x: string]: unknown;
|
|
32
|
+
progressToken?: string | number | undefined;
|
|
33
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
34
|
+
taskId: string;
|
|
35
|
+
} | undefined;
|
|
36
|
+
} | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
declare const startSuigarMcpServer: () => Promise<Server<{
|
|
39
|
+
method: string;
|
|
40
|
+
params?: {
|
|
41
|
+
[x: string]: unknown;
|
|
42
|
+
_meta?: {
|
|
43
|
+
[x: string]: unknown;
|
|
44
|
+
progressToken?: string | number | undefined;
|
|
45
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
46
|
+
taskId: string;
|
|
47
|
+
} | undefined;
|
|
48
|
+
} | undefined;
|
|
49
|
+
} | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
method: string;
|
|
52
|
+
params?: {
|
|
53
|
+
[x: string]: unknown;
|
|
54
|
+
_meta?: {
|
|
55
|
+
[x: string]: unknown;
|
|
56
|
+
progressToken?: string | number | undefined;
|
|
57
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
58
|
+
taskId: string;
|
|
59
|
+
} | undefined;
|
|
60
|
+
} | undefined;
|
|
61
|
+
} | undefined;
|
|
62
|
+
}, {
|
|
63
|
+
[x: string]: unknown;
|
|
64
|
+
_meta?: {
|
|
65
|
+
[x: string]: unknown;
|
|
66
|
+
progressToken?: string | number | undefined;
|
|
67
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
68
|
+
taskId: string;
|
|
69
|
+
} | undefined;
|
|
70
|
+
} | undefined;
|
|
71
|
+
}>>;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { createSuigarMcpServer, startSuigarMcpServer };
|