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