@trinaryex/mcp 3.3.1

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 (47) hide show
  1. package/README.md +146 -0
  2. package/dist/capture.d.ts +38 -0
  3. package/dist/capture.js +58 -0
  4. package/dist/capture.js.map +1 -0
  5. package/dist/context.d.ts +25 -0
  6. package/dist/context.js +44 -0
  7. package/dist/context.js.map +1 -0
  8. package/dist/env.d.ts +27 -0
  9. package/dist/env.js +40 -0
  10. package/dist/env.js.map +1 -0
  11. package/dist/http.d.ts +5 -0
  12. package/dist/http.js +120 -0
  13. package/dist/http.js.map +1 -0
  14. package/dist/index.d.ts +2 -0
  15. package/dist/index.js +33 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/logging.d.ts +10 -0
  18. package/dist/logging.js +43 -0
  19. package/dist/logging.js.map +1 -0
  20. package/dist/prepare.d.ts +71 -0
  21. package/dist/prepare.js +79 -0
  22. package/dist/prepare.js.map +1 -0
  23. package/dist/registry.d.ts +18 -0
  24. package/dist/registry.js +24 -0
  25. package/dist/registry.js.map +1 -0
  26. package/dist/result.d.ts +16 -0
  27. package/dist/result.js +32 -0
  28. package/dist/result.js.map +1 -0
  29. package/dist/schemas.d.ts +31 -0
  30. package/dist/schemas.js +37 -0
  31. package/dist/schemas.js.map +1 -0
  32. package/dist/server.d.ts +10 -0
  33. package/dist/server.js +41 -0
  34. package/dist/server.js.map +1 -0
  35. package/dist/tools/prepare.d.ts +2 -0
  36. package/dist/tools/prepare.js +297 -0
  37. package/dist/tools/prepare.js.map +1 -0
  38. package/dist/tools/read.d.ts +7 -0
  39. package/dist/tools/read.js +152 -0
  40. package/dist/tools/read.js.map +1 -0
  41. package/dist/tools/types.d.ts +20 -0
  42. package/dist/tools/types.js +2 -0
  43. package/dist/tools/types.js.map +1 -0
  44. package/dist/version.d.ts +7 -0
  45. package/dist/version.js +20 -0
  46. package/dist/version.js.map +1 -0
  47. package/package.json +98 -0
@@ -0,0 +1,297 @@
1
+ import { z } from 'zod';
2
+ import { NothingToPrepare, captureTransaction } from '../capture.js';
3
+ import { toPrepared } from '../prepare.js';
4
+ import { ok } from '../result.js';
5
+ import { big, bigOpt, hubAssetShape, objectId, orderSide, senderShape, u64, } from '../schemas.js';
6
+ /**
7
+ * Run an SDK write call with the capture executor and serialize the built
8
+ * transaction. Nothing is signed and nothing is submitted.
9
+ */
10
+ async function prepared(ctx, sender, intent, run) {
11
+ try {
12
+ const tx = await captureTransaction(run);
13
+ return ok(await toPrepared(tx, sender, ctx.suiClient(), intent));
14
+ }
15
+ catch (e) {
16
+ if (e instanceof NothingToPrepare) {
17
+ return ok({
18
+ prepared: false,
19
+ reason: 'No transaction is needed for this action in its current state.',
20
+ detail: e.result ?? null,
21
+ });
22
+ }
23
+ throw e;
24
+ }
25
+ }
26
+ const spend = (asset, amount, kind = 'currency') => ({ asset, amount, kind });
27
+ const PREPARE_SUFFIX = ' Returns unsigned transaction bytes — this server never signs or submits. Verify the returned intent against the bytes, then sponsor, sign and submit with your own key.';
28
+ export const prepareTools = [
29
+ {
30
+ name: 'prepare_create_account',
31
+ title: 'Prepare: create trading account',
32
+ description: 'Build the transaction that creates a BalanceManager (trading account) for an address. Returns prepared:false when one already exists.' +
33
+ PREPARE_SUFFIX,
34
+ kind: 'prepare',
35
+ sdkPath: 'account.ensure',
36
+ inputShape: { ...senderShape },
37
+ handler: (ctx, args) => prepared(ctx, args.sender, { action: 'create_account', params: { sender: args.sender } }, () => ctx.writeClient(args.sender).account.ensure()),
38
+ },
39
+ {
40
+ name: 'prepare_deposit_currency',
41
+ title: 'Prepare: deposit CRED',
42
+ description: 'Build a deposit of CRED from the wallet into the trading account.' +
43
+ PREPARE_SUFFIX,
44
+ kind: 'prepare',
45
+ sdkPath: 'account.depositCurrency',
46
+ inputShape: {
47
+ ...senderShape,
48
+ amount: u64.describe('CRED in base units (6 decimals).'),
49
+ },
50
+ handler: (ctx, args) => prepared(ctx, args.sender, {
51
+ action: 'deposit_currency',
52
+ params: { amount: args.amount },
53
+ worstCaseSpend: spend('CRED', args.amount),
54
+ }, () => ctx
55
+ .writeClient(args.sender)
56
+ .account.depositCurrency({ amount: big(args.amount) })),
57
+ },
58
+ {
59
+ name: 'prepare_deposit_items',
60
+ title: 'Prepare: deposit items',
61
+ description: 'Build a deposit of EVE Frontier items from receipts or the hangar into the trading account as warehouse receipts.' +
62
+ PREPARE_SUFFIX,
63
+ kind: 'prepare',
64
+ sdkPath: 'account.depositItems',
65
+ inputShape: {
66
+ ...senderShape,
67
+ storageUnitId: objectId,
68
+ items: z
69
+ .array(z.object({ assetId: z.string(), amount: u64 }))
70
+ .min(1)
71
+ .describe('Items to deposit, by asset id and whole-unit amount.'),
72
+ },
73
+ handler: (ctx, args) => prepared(ctx, args.sender, {
74
+ action: 'deposit_items',
75
+ params: { storageUnitId: args.storageUnitId, items: args.items },
76
+ }, () => ctx.writeClient(args.sender).account.depositItems({
77
+ storageUnitId: args.storageUnitId,
78
+ items: args.items.map((i) => ({
79
+ assetId: i.assetId,
80
+ amount: big(i.amount),
81
+ })),
82
+ })),
83
+ },
84
+ {
85
+ name: 'prepare_withdraw_currency',
86
+ title: 'Prepare: withdraw CRED',
87
+ description: 'Build a withdrawal of CRED from the trading account back to the wallet. Omit amount to withdraw the full balance.' +
88
+ PREPARE_SUFFIX,
89
+ kind: 'prepare',
90
+ sdkPath: 'account.withdrawCurrency',
91
+ inputShape: { ...senderShape, amount: u64.optional() },
92
+ handler: (ctx, args) => prepared(ctx, args.sender, {
93
+ action: 'withdraw_currency',
94
+ params: { amount: args.amount ?? 'full balance' },
95
+ }, () => ctx
96
+ .writeClient(args.sender)
97
+ .account.withdrawCurrency({ amount: bigOpt(args.amount) })),
98
+ },
99
+ {
100
+ name: 'prepare_withdraw_items',
101
+ title: 'Prepare: withdraw items',
102
+ description: 'Build a full withdrawal of the listed items from the trading account, redeeming them into the hangar at the hub.' +
103
+ PREPARE_SUFFIX,
104
+ kind: 'prepare',
105
+ sdkPath: 'account.withdrawItems',
106
+ inputShape: {
107
+ ...senderShape,
108
+ storageUnitId: objectId,
109
+ items: z.array(z.object({ assetId: z.string() })).min(1),
110
+ characterId: objectId.optional(),
111
+ },
112
+ handler: (ctx, args) => prepared(ctx, args.sender, {
113
+ action: 'withdraw_items',
114
+ params: { storageUnitId: args.storageUnitId, items: args.items },
115
+ }, () => ctx.writeClient(args.sender).account.withdrawItems({
116
+ storageUnitId: args.storageUnitId,
117
+ items: args.items,
118
+ ...(args.characterId ? { characterId: args.characterId } : {}),
119
+ })),
120
+ },
121
+ {
122
+ name: 'prepare_claim_settled',
123
+ title: 'Prepare: claim proceeds',
124
+ description: 'Build a claim of unclaimed proceeds from filled orders. Defaults to every pool the sweepable read reports.' +
125
+ PREPARE_SUFFIX,
126
+ kind: 'prepare',
127
+ sdkPath: 'account.claimSettled',
128
+ inputShape: {
129
+ ...senderShape,
130
+ poolIds: z.array(objectId).optional(),
131
+ },
132
+ handler: (ctx, args) => prepared(ctx, args.sender, { action: 'claim_settled', params: { poolIds: args.poolIds ?? 'all' } }, () => ctx
133
+ .writeClient(args.sender)
134
+ .account.claimSettled(args.poolIds ? { poolIds: args.poolIds } : undefined)),
135
+ },
136
+ {
137
+ name: 'prepare_limit_order',
138
+ title: 'Prepare: limit order',
139
+ description: 'Build a limit order: creates the trading account if missing, deposits only the deficit, and places the order — one atomic transaction.' +
140
+ PREPARE_SUFFIX,
141
+ kind: 'prepare',
142
+ sdkPath: 'orders.limit',
143
+ inputShape: {
144
+ ...senderShape,
145
+ ...hubAssetShape,
146
+ side: orderSide,
147
+ price: u64.describe('CRED base units per item.'),
148
+ quantity: u64.describe('Whole item units; must be a multiple of lot size.'),
149
+ expireAt: u64
150
+ .optional()
151
+ .describe('Unix ms; omit for good-til-cancelled.'),
152
+ orderType: z
153
+ .number()
154
+ .int()
155
+ .min(0)
156
+ .max(3)
157
+ .optional()
158
+ .describe('0=LIMIT, 1=IOC, 2=FOK, 3=POST_ONLY.'),
159
+ selfMatchingOption: z.number().int().min(0).max(2).optional(),
160
+ quoteDeposit: u64
161
+ .optional()
162
+ .describe('Override the computed CRED deposit for a bid.'),
163
+ },
164
+ handler: (ctx, args) => prepared(ctx, args.sender, {
165
+ action: 'limit_order',
166
+ params: {
167
+ storageUnitId: args.storageUnitId,
168
+ assetId: args.assetId,
169
+ side: args.side,
170
+ price: args.price,
171
+ quantity: args.quantity,
172
+ expireAt: args.expireAt ?? 'good-til-cancelled',
173
+ },
174
+ ...(args.side === 'buy'
175
+ ? {
176
+ worstCaseSpend: spend('CRED', args.quoteDeposit ??
177
+ (big(args.price) * big(args.quantity)).toString()),
178
+ }
179
+ : {
180
+ worstCaseSpend: spend(args.assetId, args.quantity, 'item'),
181
+ }),
182
+ }, () => ctx.writeClient(args.sender).orders.limit({
183
+ storageUnitId: args.storageUnitId,
184
+ assetId: args.assetId,
185
+ side: args.side,
186
+ price: big(args.price),
187
+ quantity: big(args.quantity),
188
+ ...(args.expireAt ? { expireAt: big(args.expireAt) } : {}),
189
+ ...(args.orderType !== undefined
190
+ ? { orderType: args.orderType }
191
+ : {}),
192
+ ...(args.selfMatchingOption !== undefined
193
+ ? { selfMatchingOption: args.selfMatchingOption }
194
+ : {}),
195
+ ...(args.quoteDeposit
196
+ ? { quoteDeposit: big(args.quoteDeposit) }
197
+ : {}),
198
+ })),
199
+ },
200
+ {
201
+ name: 'prepare_market_order',
202
+ title: 'Prepare: market order',
203
+ description: 'Build a market order. Buys require quoteBudget — the worst-case CRED cost including fees; derive it from market_orderbook.' +
204
+ PREPARE_SUFFIX,
205
+ kind: 'prepare',
206
+ sdkPath: 'orders.market',
207
+ inputShape: {
208
+ ...senderShape,
209
+ ...hubAssetShape,
210
+ side: orderSide,
211
+ quantity: u64,
212
+ quoteBudget: u64
213
+ .optional()
214
+ .describe('Required for buys: worst-case CRED spend including fees.'),
215
+ selfMatchingOption: z.number().int().min(0).max(2).optional(),
216
+ },
217
+ handler: (ctx, args) => prepared(ctx, args.sender, {
218
+ action: 'market_order',
219
+ params: {
220
+ storageUnitId: args.storageUnitId,
221
+ assetId: args.assetId,
222
+ side: args.side,
223
+ quantity: args.quantity,
224
+ },
225
+ ...(args.side === 'buy'
226
+ ? args.quoteBudget
227
+ ? { worstCaseSpend: spend('CRED', args.quoteBudget) }
228
+ : {}
229
+ : { worstCaseSpend: spend(args.assetId, args.quantity, 'item') }),
230
+ }, () => ctx.writeClient(args.sender).orders.market({
231
+ storageUnitId: args.storageUnitId,
232
+ assetId: args.assetId,
233
+ side: args.side,
234
+ quantity: big(args.quantity),
235
+ ...(args.quoteBudget ? { quoteBudget: big(args.quoteBudget) } : {}),
236
+ ...(args.selfMatchingOption !== undefined
237
+ ? { selfMatchingOption: args.selfMatchingOption }
238
+ : {}),
239
+ })),
240
+ },
241
+ {
242
+ name: 'prepare_cancel_order',
243
+ title: 'Prepare: cancel order',
244
+ description: 'Build a cancellation of one resting order.' + PREPARE_SUFFIX,
245
+ kind: 'prepare',
246
+ sdkPath: 'orders.cancel',
247
+ inputShape: { ...senderShape, ...hubAssetShape, orderId: z.string() },
248
+ handler: (ctx, args) => prepared(ctx, args.sender, { action: 'cancel_order', params: { orderId: args.orderId } }, () => ctx.writeClient(args.sender).orders.cancel({
249
+ storageUnitId: args.storageUnitId,
250
+ assetId: args.assetId,
251
+ orderId: args.orderId,
252
+ })),
253
+ },
254
+ {
255
+ name: 'prepare_cancel_all_orders',
256
+ title: 'Prepare: cancel all orders',
257
+ description: 'Build a cancellation of every resting order for one item at one hub.' +
258
+ PREPARE_SUFFIX,
259
+ kind: 'prepare',
260
+ sdkPath: 'orders.cancelAll',
261
+ inputShape: { ...senderShape, ...hubAssetShape },
262
+ handler: (ctx, args) => prepared(ctx, args.sender, {
263
+ action: 'cancel_all_orders',
264
+ params: {
265
+ storageUnitId: args.storageUnitId,
266
+ assetId: args.assetId,
267
+ },
268
+ }, () => ctx.writeClient(args.sender).orders.cancelAll({
269
+ storageUnitId: args.storageUnitId,
270
+ assetId: args.assetId,
271
+ })),
272
+ },
273
+ {
274
+ name: 'prepare_modify_order',
275
+ title: 'Prepare: resize order',
276
+ description: 'Build a resize of a resting order. The new quantity must be below the original and above the filled amount.' +
277
+ PREPARE_SUFFIX,
278
+ kind: 'prepare',
279
+ sdkPath: 'orders.modify',
280
+ inputShape: {
281
+ ...senderShape,
282
+ ...hubAssetShape,
283
+ orderId: z.string(),
284
+ newQuantity: u64,
285
+ },
286
+ handler: (ctx, args) => prepared(ctx, args.sender, {
287
+ action: 'modify_order',
288
+ params: { orderId: args.orderId, newQuantity: args.newQuantity },
289
+ }, () => ctx.writeClient(args.sender).orders.modify({
290
+ storageUnitId: args.storageUnitId,
291
+ assetId: args.assetId,
292
+ orderId: args.orderId,
293
+ newQuantity: big(args.newQuantity),
294
+ })),
295
+ },
296
+ ];
297
+ //# sourceMappingURL=prepare.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepare.js","sourceRoot":"","sources":["../../src/tools/prepare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAG1C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AAEjC,OAAO,EACL,GAAG,EACH,MAAM,EACN,aAAa,EACb,QAAQ,EACR,SAAS,EACT,WAAW,EACX,GAAG,GACJ,MAAM,eAAe,CAAA;AAGtB;;;GAGG;AACH,KAAK,UAAU,QAAQ,CACrB,GAAmB,EACnB,MAAc,EACd,MAAuC,EACvC,GAA2B;IAE3B,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,MAAM,kBAAkB,CAAC,GAAG,CAAC,CAAA;QACxC,OAAO,EAAE,CAAC,MAAM,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,SAAS,EAAE,EAAE,MAAM,CAAC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AM,CAAC;YACzC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC;SACnC,CAAC,CACL;KACJ;CACF,CAAA"}
@@ -0,0 +1,7 @@
1
+ import type { ToolDef } from './types.js';
2
+ /**
3
+ * Read tools. Every one of these is a thin delegation to the SDK's read
4
+ * surface, authenticated by the caller's own API key. No key material, no
5
+ * writes, nothing cached across tenants.
6
+ */
7
+ export declare const readTools: ToolDef[];
@@ -0,0 +1,152 @@
1
+ import { z } from 'zod';
2
+ import { ok } from '../result.js';
3
+ import { objectId, pagingShape, suiAddress } from '../schemas.js';
4
+ /**
5
+ * Read tools. Every one of these is a thin delegation to the SDK's read
6
+ * surface, authenticated by the caller's own API key. No key material, no
7
+ * writes, nothing cached across tenants.
8
+ */
9
+ export const readTools = [
10
+ {
11
+ name: 'market_discover',
12
+ title: 'Discover markets',
13
+ description: 'List active orders across trade hubs, optionally filtered. Use this to find where an item is trading.',
14
+ kind: 'read',
15
+ sdkPath: 'market.discover',
16
+ inputShape: {
17
+ assetId: z.string().optional(),
18
+ hubId: objectId.optional(),
19
+ ...pagingShape,
20
+ },
21
+ handler: async (ctx, args) => ok(await ctx.readClient().discover(args)),
22
+ },
23
+ {
24
+ name: 'market_search_items',
25
+ title: 'Search items',
26
+ description: 'Resolve an EVE Frontier item name to its asset id, with fuzzy matching.',
27
+ kind: 'read',
28
+ sdkPath: 'market.searchItems',
29
+ inputShape: {
30
+ query: z.string().min(1).describe('Item name or partial name.'),
31
+ ...pagingShape,
32
+ },
33
+ handler: async (ctx, args) => {
34
+ const { query, ...rest } = args;
35
+ return ok(await ctx.readClient().searchItems(query, rest));
36
+ },
37
+ },
38
+ {
39
+ name: 'market_hub',
40
+ title: 'Get trade hub',
41
+ description: 'Detail for one trade hub: vault configuration, collection, and location when public.',
42
+ kind: 'read',
43
+ sdkPath: 'market.hub',
44
+ inputShape: { hubId: objectId },
45
+ handler: async (ctx, args) => ok(await ctx.readClient().hub(args.hubId)),
46
+ },
47
+ {
48
+ name: 'market_items_at_hub',
49
+ title: 'List items at a hub',
50
+ description: 'Every item with a market at a given trade hub.',
51
+ kind: 'read',
52
+ sdkPath: 'market.itemsAtHub',
53
+ inputShape: { hubId: objectId },
54
+ handler: async (ctx, args) => ok(await ctx.readClient().itemsAtHub(args.hubId)),
55
+ },
56
+ {
57
+ name: 'market_orderbook',
58
+ title: 'Read the order book',
59
+ description: 'Live resting bids and asks for an item at a hub. Use before sizing a market order.',
60
+ kind: 'read',
61
+ sdkPath: 'market.orderbook',
62
+ inputShape: {
63
+ storageUnitId: objectId,
64
+ assetId: z.string(),
65
+ depth: z.number().int().positive().max(200).optional(),
66
+ },
67
+ handler: async (ctx, args) => ok(await ctx.readClient().orderbook(args)),
68
+ },
69
+ {
70
+ name: 'market_pool_metadata',
71
+ title: 'Get pool metadata',
72
+ description: 'Pool parameters: lot size, tick size, minimum size, and the fee rate used to compute worst-case costs.',
73
+ kind: 'read',
74
+ sdkPath: 'market.poolMetadata',
75
+ inputShape: { poolId: objectId },
76
+ handler: async (ctx, args) => ok(await ctx.readClient().poolMetadata(args.poolId)),
77
+ },
78
+ {
79
+ name: 'account_resolve',
80
+ title: 'Resolve a trading account',
81
+ description: 'Return the BalanceManager object id for an address, or null when the address has no trading account yet. Pair with prepare_create_account.',
82
+ kind: 'read',
83
+ sdkPath: 'account.get',
84
+ inputShape: { address: suiAddress },
85
+ handler: async (ctx, args) => {
86
+ const id = await ctx
87
+ .writeClient(args.address)
88
+ .resolveBalanceManagerId(args.address);
89
+ return ok({ address: args.address, balanceManagerId: id, exists: !!id });
90
+ },
91
+ },
92
+ {
93
+ name: 'account_balances_at_hub',
94
+ title: 'Check balances at a hub',
95
+ description: 'Item and currency balances for a trading account at one hub, across wallet, trading account, and hangar.',
96
+ kind: 'read',
97
+ sdkPath: 'balances.atHub',
98
+ inputShape: {
99
+ balanceManagerId: objectId,
100
+ storageUnitId: objectId,
101
+ },
102
+ handler: async (ctx, args) => ok(await ctx
103
+ .readClient()
104
+ .balancesAtHub(args.balanceManagerId, args.storageUnitId)),
105
+ },
106
+ {
107
+ name: 'account_sweepable',
108
+ title: 'List claimable proceeds',
109
+ description: 'Unclaimed proceeds and settled balances that can be claimed or withdrawn.',
110
+ kind: 'read',
111
+ sdkPath: 'account.sweepable',
112
+ inputShape: { balanceManagerId: objectId },
113
+ handler: async (ctx, args) => ok(await ctx.readClient().sweepable(args.balanceManagerId)),
114
+ },
115
+ {
116
+ name: 'orders_open',
117
+ title: 'List open orders',
118
+ description: 'Resting orders for a trading account.',
119
+ kind: 'read',
120
+ sdkPath: 'orders.openOrders',
121
+ inputShape: { balanceManagerId: objectId, ...pagingShape },
122
+ handler: async (ctx, args) => {
123
+ const { balanceManagerId, ...rest } = args;
124
+ return ok(await ctx.readClient().openOrders(balanceManagerId, rest));
125
+ },
126
+ },
127
+ {
128
+ name: 'orders_fills',
129
+ title: 'List fills',
130
+ description: "This account's side of each match, most recent first.",
131
+ kind: 'read',
132
+ sdkPath: 'orders.fills',
133
+ inputShape: { balanceManagerId: objectId, ...pagingShape },
134
+ handler: async (ctx, args) => {
135
+ const { balanceManagerId, ...rest } = args;
136
+ return ok(await ctx.readClient().fills(balanceManagerId, rest));
137
+ },
138
+ },
139
+ {
140
+ name: 'orders_trades',
141
+ title: 'List trades',
142
+ description: 'Completed trades for a trading account.',
143
+ kind: 'read',
144
+ sdkPath: 'orders.trades',
145
+ inputShape: { balanceManagerId: objectId, ...pagingShape },
146
+ handler: async (ctx, args) => {
147
+ const { balanceManagerId, ...rest } = args;
148
+ return ok(await ctx.readClient().trades(balanceManagerId, rest));
149
+ },
150
+ },
151
+ ];
152
+ //# sourceMappingURL=read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":"A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;KACF;IACD;QACE,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,yCAAyC;QACtD,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,eAAe;QACxB,UAAU,EAAE,EAAE,gBAAgB,EAAE,QAAQ,EAAE,GAAG,WAAW,EAAE;QAC1D,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YAC3B,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAA;YAC1C,OAAO,EAAE,CAAC,MAAM,GAAG,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC,CAAA;QAClE,CAAC;KACF;CACF,CAAA"}
@@ -0,0 +1,20 @@
1
+ import type { ZodRawShape } from 'zod';
2
+ import type { RequestContext } from '../context.js';
3
+ import type { ToolResponse } from '../result.js';
4
+ export type ToolKind = 'read' | 'prepare';
5
+ /**
6
+ * One MCP tool. The `sdkPath` field is load-bearing: the parity test walks the
7
+ * SDK's public client surface and fails when a method has no tool here and no
8
+ * entry in the exclusion list, so the MCP surface cannot silently fall behind
9
+ * the SDK it wraps.
10
+ */
11
+ export interface ToolDef {
12
+ name: string;
13
+ title: string;
14
+ description: string;
15
+ kind: ToolKind;
16
+ /** Dotted path of the SDK method this delegates to, e.g. `orders.limit`. */
17
+ sdkPath: string;
18
+ inputShape: ZodRawShape;
19
+ handler: (ctx: RequestContext, args: any) => Promise<ToolResponse>;
20
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Package version, read from the manifest at startup.
3
+ *
4
+ * This mirrors `@trinaryex/sdk` exactly: releases are cut from the SDK's
5
+ * version, so an MCP version always names the SDK it wraps.
6
+ */
7
+ export declare function packageVersion(): string;
@@ -0,0 +1,20 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { dirname, join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ /**
5
+ * Package version, read from the manifest at startup.
6
+ *
7
+ * This mirrors `@trinaryex/sdk` exactly: releases are cut from the SDK's
8
+ * version, so an MCP version always names the SDK it wraps.
9
+ */
10
+ export function packageVersion() {
11
+ try {
12
+ const here = dirname(fileURLToPath(import.meta.url));
13
+ const manifest = readFileSync(join(here, '..', 'package.json'), 'utf8');
14
+ return JSON.parse(manifest).version ?? '0.0.0';
15
+ }
16
+ catch {
17
+ return '0.0.0';
18
+ }
19
+ }
20
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC;;;;;GAKG;AACH,MAAM,UAAU,cAAc;IAC5B,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;QACpD,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAA;QACvE,OAAQ,IAAI,CAAC,KAAK,CAAC,QAAQ,CAA0B,CAAC,OAAO,IAAI,OAAO,CAAA;IAC1E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAA;IAChB,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,98 @@
1
+ {
2
+ "name": "@trinaryex/mcp",
3
+ "version": "3.3.1",
4
+ "description": "Keyless, multi-tenant MCP server for Trinary Exchange — market reads and unsigned transaction preparation for EVE Frontier trading agents.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/loash-industries/sdk.git",
8
+ "directory": "mcp"
9
+ },
10
+ "type": "module",
11
+ "main": "dist/index.js",
12
+ "types": "dist/index.d.ts",
13
+ "bin": {
14
+ "triex-mcp": "dist/index.js"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc -p tsconfig.build.json",
22
+ "check:parity": "npm run build && node scripts/check-parity.mjs",
23
+ "start": "node dist/index.js",
24
+ "test": "node --experimental-vm-modules node_modules/.bin/jest",
25
+ "test:cov": "node --experimental-vm-modules node_modules/.bin/jest --ci --coverage --reporters=default --reporters=jest-junit",
26
+ "prettier": "prettier --write '{src,test}/**/*.ts'",
27
+ "prettier:check": "prettier --check '{src,test}/**/*.ts'",
28
+ "lint": "eslint --cache '{src,test}/**/*.ts'",
29
+ "lint:check": "eslint --cache '{src,test}/**/*.ts'",
30
+ "lint:fix": "eslint --cache --fix '{src,test}/**/*.ts'",
31
+ "tscheck": "tsc --noEmit"
32
+ },
33
+ "author": "@blurpesec",
34
+ "license": "MIT",
35
+ "publishConfig": {
36
+ "registry": "https://registry.npmjs.org",
37
+ "access": "public"
38
+ },
39
+ "engines": {
40
+ "node": ">=22"
41
+ },
42
+ "dependencies": {
43
+ "@modelcontextprotocol/sdk": "^1.30.0",
44
+ "@mysten/sui": "^2.16.0",
45
+ "@trinaryex/sdk": "3.3.1",
46
+ "express": "^5.2.1",
47
+ "zod": "^4.4.3"
48
+ },
49
+ "devDependencies": {
50
+ "@types/express": "^5.0.0",
51
+ "@types/jest": "^29.0.0",
52
+ "@types/node": "^22.0.0",
53
+ "@typescript-eslint/eslint-plugin": "^7.0.0",
54
+ "@typescript-eslint/parser": "^7.0.0",
55
+ "eslint": "^8.57.0",
56
+ "eslint-config-prettier": "^9.0.0",
57
+ "eslint-plugin-prettier": "^5.0.0",
58
+ "jest": "^29.7.0",
59
+ "jest-junit": "^16.0.0",
60
+ "prettier": "^3.3.0",
61
+ "ts-jest": "^29.1.2",
62
+ "typescript": "^5.4.2"
63
+ },
64
+ "jest": {
65
+ "preset": "ts-jest/presets/default-esm",
66
+ "moduleFileExtensions": [
67
+ "js",
68
+ "mjs",
69
+ "json",
70
+ "ts"
71
+ ],
72
+ "testRegex": ".test.ts$",
73
+ "transform": {
74
+ "^.+\\.ts$": [
75
+ "ts-jest",
76
+ {
77
+ "useESM": true,
78
+ "diagnostics": false
79
+ }
80
+ ]
81
+ },
82
+ "extensionsToTreatAsEsm": [
83
+ ".ts"
84
+ ],
85
+ "moduleNameMapper": {
86
+ "^(\\.{1,2}/.*)\\.js$": "$1"
87
+ },
88
+ "collectCoverageFrom": [
89
+ "src/**/*.{ts,js}"
90
+ ],
91
+ "testEnvironment": "node",
92
+ "coverageDirectory": "./coverage"
93
+ },
94
+ "jest-junit": {
95
+ "outputDirectory": ".",
96
+ "outputName": "junit.xml"
97
+ }
98
+ }