@suigar/mcp 0.1.0 → 0.2.0-beta.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 (77) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/LICENSE +201 -0
  3. package/README.md +79 -110
  4. package/dist/app/index.html +181 -0
  5. package/dist/bin.mjs +3 -7
  6. package/dist/bin.mjs.map +1 -0
  7. package/dist/client.d.mts +41 -11
  8. package/dist/client.d.mts.map +1 -0
  9. package/dist/client.mjs +107 -34
  10. package/dist/client.mjs.map +1 -0
  11. package/dist/dry-run.mjs +163 -0
  12. package/dist/dry-run.mjs.map +1 -0
  13. package/dist/format.mjs +24 -0
  14. package/dist/format.mjs.map +1 -0
  15. package/dist/index.d.mts +5 -9
  16. package/dist/index.mjs +4 -8
  17. package/dist/schemas.d.mts +642 -0
  18. package/dist/schemas.d.mts.map +1 -0
  19. package/dist/schemas.mjs +113 -0
  20. package/dist/schemas.mjs.map +1 -0
  21. package/dist/server.d.mts +21 -69
  22. package/dist/server.d.mts.map +1 -0
  23. package/dist/server.mjs +172 -411
  24. package/dist/server.mjs.map +1 -0
  25. package/dist/tools.d.mts +14 -155
  26. package/dist/tools.d.mts.map +1 -0
  27. package/dist/tools.mjs +297 -553
  28. package/dist/tools.mjs.map +1 -0
  29. package/dist/types.d.mts +109 -83
  30. package/dist/types.d.mts.map +1 -0
  31. package/package.json +83 -61
  32. package/dist/bin.cjs +0 -11
  33. package/dist/bin.d.cts +0 -1
  34. package/dist/client.cjs +0 -46
  35. package/dist/client.d.cts +0 -17
  36. package/dist/coin.cjs +0 -86
  37. package/dist/coin.d.cts +0 -35
  38. package/dist/coin.d.mts +0 -35
  39. package/dist/coin.mjs +0 -86
  40. package/dist/config.cjs +0 -183
  41. package/dist/config.d.cts +0 -15
  42. package/dist/config.d.mts +0 -15
  43. package/dist/config.mjs +0 -174
  44. package/dist/index.cjs +0 -53
  45. package/dist/index.d.cts +0 -10
  46. package/dist/mcp-support.cjs +0 -62
  47. package/dist/mcp-support.d.cts +0 -16
  48. package/dist/mcp-support.d.mts +0 -16
  49. package/dist/mcp-support.mjs +0 -60
  50. package/dist/metadata.cjs +0 -51
  51. package/dist/metadata.d.cts +0 -52
  52. package/dist/metadata.d.mts +0 -52
  53. package/dist/metadata.mjs +0 -47
  54. package/dist/server.cjs +0 -433
  55. package/dist/server.d.cts +0 -73
  56. package/dist/tools.cjs +0 -617
  57. package/dist/tools.d.cts +0 -158
  58. package/dist/transactions.cjs +0 -294
  59. package/dist/transactions.d.cts +0 -40
  60. package/dist/transactions.d.mts +0 -40
  61. package/dist/transactions.mjs +0 -286
  62. package/dist/types.d.cts +0 -111
  63. package/node_modules/@suigar/currency-registry/dist/index.cjs +0 -121
  64. package/node_modules/@suigar/currency-registry/dist/index.d.cts +0 -50
  65. package/node_modules/@suigar/currency-registry/dist/index.d.mts +0 -50
  66. package/node_modules/@suigar/currency-registry/dist/index.mjs +0 -110
  67. package/node_modules/@suigar/currency-registry/package.json +0 -31
  68. package/node_modules/@suigar/game-registry/dist/index.cjs +0 -310
  69. package/node_modules/@suigar/game-registry/dist/index.d.cts +0 -65
  70. package/node_modules/@suigar/game-registry/dist/index.d.mts +0 -65
  71. package/node_modules/@suigar/game-registry/dist/index.mjs +0 -292
  72. package/node_modules/@suigar/game-registry/package.json +0 -31
  73. package/node_modules/@suigar/sui-rpc-pool/dist/index.cjs +0 -45590
  74. package/node_modules/@suigar/sui-rpc-pool/dist/index.d.cts +0 -465
  75. package/node_modules/@suigar/sui-rpc-pool/dist/index.d.mts +0 -465
  76. package/node_modules/@suigar/sui-rpc-pool/dist/index.mjs +0 -45570
  77. package/node_modules/@suigar/sui-rpc-pool/package.json +0 -31
@@ -1,16 +0,0 @@
1
- //#region src/mcp-support.d.ts
2
- type SuigarMcpToolName = 'read_config' | 'read_game_metadata' | 'build_coinflip_transaction' | 'build_limbo_transaction' | 'build_plinko_transaction' | 'build_wheel_transaction' | 'build_range_transaction' | 'build_pvp_coinflip_create_transaction' | 'build_pvp_coinflip_join_transaction' | 'build_pvp_coinflip_cancel_transaction';
3
- type McpExecutionSurface = 'onchain' | 'backend';
4
- type GameMcpSupport = {
5
- executionSurface: McpExecutionSurface;
6
- toolSupported: boolean;
7
- primaryToolName: SuigarMcpToolName | null;
8
- };
9
- declare const SUPPORTED_MCP_TOOL_NAMES: SuigarMcpToolName[];
10
- declare const getMcpSupportForGame: (gameId: string) => GameMcpSupport;
11
- declare const buildMcpSupportCatalog: () => Readonly<{
12
- serverName: "suigar";
13
- supportedToolNames: SuigarMcpToolName[];
14
- }>;
15
- //#endregion
16
- export { GameMcpSupport, McpExecutionSurface, SUPPORTED_MCP_TOOL_NAMES, SuigarMcpToolName, buildMcpSupportCatalog, getMcpSupportForGame };
@@ -1,16 +0,0 @@
1
- //#region src/mcp-support.d.ts
2
- type SuigarMcpToolName = 'read_config' | 'read_game_metadata' | 'build_coinflip_transaction' | 'build_limbo_transaction' | 'build_plinko_transaction' | 'build_wheel_transaction' | 'build_range_transaction' | 'build_pvp_coinflip_create_transaction' | 'build_pvp_coinflip_join_transaction' | 'build_pvp_coinflip_cancel_transaction';
3
- type McpExecutionSurface = 'onchain' | 'backend';
4
- type GameMcpSupport = {
5
- executionSurface: McpExecutionSurface;
6
- toolSupported: boolean;
7
- primaryToolName: SuigarMcpToolName | null;
8
- };
9
- declare const SUPPORTED_MCP_TOOL_NAMES: SuigarMcpToolName[];
10
- declare const getMcpSupportForGame: (gameId: string) => GameMcpSupport;
11
- declare const buildMcpSupportCatalog: () => Readonly<{
12
- serverName: "suigar";
13
- supportedToolNames: SuigarMcpToolName[];
14
- }>;
15
- //#endregion
16
- export { GameMcpSupport, McpExecutionSurface, SUPPORTED_MCP_TOOL_NAMES, SuigarMcpToolName, buildMcpSupportCatalog, getMcpSupportForGame };
@@ -1,60 +0,0 @@
1
- //#region src/mcp-support.ts
2
- const SUPPORTED_MCP_TOOL_NAMES = [
3
- "read_config",
4
- "read_game_metadata",
5
- "build_coinflip_transaction",
6
- "build_limbo_transaction",
7
- "build_plinko_transaction",
8
- "build_wheel_transaction",
9
- "build_range_transaction",
10
- "build_pvp_coinflip_create_transaction",
11
- "build_pvp_coinflip_join_transaction",
12
- "build_pvp_coinflip_cancel_transaction"
13
- ];
14
- const GAME_MCP_SUPPORT_BY_ID = {
15
- coinflip: {
16
- executionSurface: "onchain",
17
- toolSupported: true,
18
- primaryToolName: "build_coinflip_transaction"
19
- },
20
- limbo: {
21
- executionSurface: "onchain",
22
- toolSupported: true,
23
- primaryToolName: "build_limbo_transaction"
24
- },
25
- plinko: {
26
- executionSurface: "onchain",
27
- toolSupported: true,
28
- primaryToolName: "build_plinko_transaction"
29
- },
30
- wheel: {
31
- executionSurface: "onchain",
32
- toolSupported: true,
33
- primaryToolName: "build_wheel_transaction"
34
- },
35
- range: {
36
- executionSurface: "onchain",
37
- toolSupported: true,
38
- primaryToolName: "build_range_transaction"
39
- },
40
- "pvp-coinflip": {
41
- executionSurface: "onchain",
42
- toolSupported: true,
43
- primaryToolName: "build_pvp_coinflip_create_transaction"
44
- }
45
- };
46
- const getMcpSupportForGame = (gameId) => {
47
- const support = GAME_MCP_SUPPORT_BY_ID[gameId];
48
- if (support) return support;
49
- return {
50
- executionSurface: gameId === "slots" ? "backend" : "onchain",
51
- toolSupported: false,
52
- primaryToolName: null
53
- };
54
- };
55
- const buildMcpSupportCatalog = () => Object.freeze({
56
- serverName: "suigar",
57
- supportedToolNames: [...SUPPORTED_MCP_TOOL_NAMES]
58
- });
59
- //#endregion
60
- export { SUPPORTED_MCP_TOOL_NAMES, buildMcpSupportCatalog, getMcpSupportForGame };
package/dist/metadata.cjs DELETED
@@ -1,51 +0,0 @@
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;
@@ -1,52 +0,0 @@
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 };
@@ -1,52 +0,0 @@
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 };
package/dist/metadata.mjs DELETED
@@ -1,47 +0,0 @@
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 };