@trinaryex/mcp 3.4.0 → 3.6.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/dist/context.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { ClientWithCoreApi } from '@mysten/sui/client';
2
+ import { ReadOnlyAclClient } from '@trinaryex/keyspace';
2
3
  import { ReadOnlyClient, TriexClient } from '@trinaryex/sdk';
3
4
  import type { ServerConfig } from './env.js';
4
5
  /**
@@ -16,6 +17,14 @@ export interface RequestContext {
16
17
  * capture executor, so it can build but never submit.
17
18
  */
18
19
  writeClient(sender: string): TriexClient;
20
+ /**
21
+ * A Keyspace lookup client bound to this caller's key.
22
+ *
23
+ * Read-only by construction: it carries no `sealClient`, `executor` or
24
+ * `storageAdapter`, so the write and decrypt surfaces are unreachable.
25
+ * Decryption needs a wallet signature and belongs with whoever holds the key.
26
+ */
27
+ keyspaceClient(): ReadOnlyAclClient;
19
28
  /** The shared, credential-free Sui client used for PTB resolution. */
20
29
  suiClient(): ClientWithCoreApi;
21
30
  }
package/dist/context.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { SuiGrpcClient } from '@mysten/sui/grpc';
2
+ import { ReadOnlyAclClient } from '@trinaryex/keyspace';
2
3
  import { ReadOnlyClient, TriexClient } from '@trinaryex/sdk';
3
4
  import { captureExecutor } from './capture.js';
4
5
  /**
@@ -26,6 +27,11 @@ export function createContext(apiKey, config, suiClientOverride) {
26
27
  apiKey,
27
28
  config,
28
29
  suiClient: sui,
30
+ keyspaceClient: () => new ReadOnlyAclClient({
31
+ suiClient: sui(),
32
+ apiKey,
33
+ ...(config.indexerUrl ? { indexerUrl: config.indexerUrl } : {}),
34
+ }),
29
35
  readClient: () => new ReadOnlyClient({
30
36
  apiKey,
31
37
  network: config.network,
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,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Ac,CAAC;YACjB,MAAM;YACN,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChE,CAAC;QACJ,WAAW,EAAE,CAAC,MAAc,EAAE,EAAE,CAC9B,IAAI,WAAW,CAAC;YACd,SAAS,EAAE,GAAG,EAAE;YAChB,MAAM;YACN,OAAO,EAAE,MAAM;YACf,QAAQ,EAAE,eAAe;YACzB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChE,CAAC;KACL,CAAA;AACH,CAAC"}
package/dist/registry.js CHANGED
@@ -1,7 +1,12 @@
1
+ import { keyspaceTools } from './tools/keyspace.js';
1
2
  import { prepareTools } from './tools/prepare.js';
2
3
  import { readTools } from './tools/read.js';
3
4
  /** Every tool this server can expose, in a stable order. */
4
- export const ALL_TOOLS = [...readTools, ...prepareTools];
5
+ export const ALL_TOOLS = [
6
+ ...readTools,
7
+ ...keyspaceTools,
8
+ ...prepareTools,
9
+ ];
5
10
  /**
6
11
  * Inputs any tool may declare without an SDK counterpart.
7
12
  *
@@ -23,6 +28,9 @@ export const GLOBAL_SYNTHETIC_PARAMS = {
23
28
  */
24
29
  export const EXCLUDED_SDK_PATHS = {
25
30
  'market.resolvePool': 'Internal plumbing — pool ids are resolved inside the tools that need them.',
31
+ 'keyspace.hasAccess': 'A membership check callable from the readPrincipals that keyspace_get_acl already returns; add a tool if callers want it server-side.',
32
+ 'keyspace.getStaleEntries': 'Staleness is already reported per entry by keyspace_get_acl, which returns EntryMeta.isStale for every entry.',
33
+ 'keyspace.isEntryStale': 'Single-entry form of keyspace.getStaleEntries; same reason — keyspace_get_acl already carries isStale.',
26
34
  'balances.currency': 'Wallet CRED balance is a plain Sui coin read; account_balances_at_hub covers the trading-account view.',
27
35
  };
28
36
  /**
@@ -31,6 +39,6 @@ export const EXCLUDED_SDK_PATHS = {
31
39
  * `tools/list` says so.
32
40
  */
33
41
  export function toolsForMode(mode) {
34
- return mode === 'read' ? readTools : ALL_TOOLS;
42
+ return mode === 'read' ? [...readTools, ...keyspaceTools] : ALL_TOOLS;
35
43
  }
36
44
  //# sourceMappingURL=registry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAI3C,4DAA4D;AAC5D,MAAM,CAAC,MAAM,SAAS,GAAc,CAAC,GAAG,SAAS,EAAE,GAAG,YAAY,CAAC,CAAA;AAEnE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAA2B;IAC7D,MAAM,EACJ,+GAA+G;CAClH,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA2B;IACxD,oBAAoB,EAClB,4EAA4E;IAC9E,mBAAmB,EACjB,wGAAwG;CAC3G,CAAA;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,IAAgB;IAC3C,OAAO,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAA;AAChD,CAAC"}
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAI3C,4DAA4D;AAC5D,MAAM,CAAC,MAAM,SAAS,GAAc;IAClC,GAAG,SAAS;IACZ,GAAG,aAAa;IAChB,GAAG,YAAY;CAChB,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAA2B;IAC7D,MAAM,EACJ,+GAA+G;CAClH,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA2B;IACxD,oBAAoB,EAClB,4EAA4E;IAC9E,oBAAoB,EAClB,uIAAuI;IACzI,0BAA0B,EACxB,+GAA+G;IACjH,uBAAuB,EACrB,wGAAwG;IAC1G,mBAAmB,EACjB,wGAAwG;CAC3G,CAAA;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,IAAgB;IAC3C,OAAO,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,EAAE,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AACvE,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { ToolDef } from './types.js';
2
+ export declare const keyspaceTools: ToolDef[];
@@ -0,0 +1,55 @@
1
+ import { ok } from '../result.js';
2
+ import { objectId, suiAddress } from '../schemas.js';
3
+ /**
4
+ * Keyspace lookup tools.
5
+ *
6
+ * Keyspace is end-to-end encrypted: ciphertext lives off-chain, the Read set
7
+ * lives on Sui, and Seal key servers release decryption shares only after
8
+ * `keyspace::seal_approve` verifies membership — against a session key the
9
+ * *wallet* signed. That signature is unavailable here by design, so this
10
+ * server covers exactly the half that needs no key: discovering which
11
+ * Keyspaces an address can read, and reading their public metadata.
12
+ *
13
+ * Decryption belongs wherever the private key already lives.
14
+ */
15
+ const NO_DECRYPT_NOTE = ' This returns metadata only — never plaintext. Decrypting an entry requires a wallet signature for a Seal session key, which this server cannot produce; do that where the private key lives.';
16
+ export const keyspaceTools = [
17
+ {
18
+ name: 'keyspace_list_accessible',
19
+ title: 'List accessible Keyspaces',
20
+ description: 'List the Keyspace ids an address holds any role on — the starting point for reading shared hub locations.' +
21
+ NO_DECRYPT_NOTE,
22
+ kind: 'read',
23
+ sdkPath: 'keyspace.getAccessibleAcls',
24
+ inputShape: {
25
+ address: suiAddress.describe('Sui address to look up. Public data; no signature involved.'),
26
+ },
27
+ handler: async (ctx, args) => {
28
+ const aclIds = await ctx.keyspaceClient().getAccessibleAcls(args.address);
29
+ return ok({ address: args.address, aclIds, count: aclIds.length });
30
+ },
31
+ },
32
+ {
33
+ name: 'keyspace_get_acl',
34
+ title: 'Get Keyspace detail',
35
+ description: 'Read one Keyspace: its role principals, epoch, and the encrypted entries it holds (id, uri, description, epoch, staleness). Use readPrincipals to check whether an address can decrypt before paying for a signature, and the per-entry fingerprint to skip re-decrypting unchanged data.' +
36
+ NO_DECRYPT_NOTE,
37
+ kind: 'read',
38
+ sdkPath: 'keyspace.getAcl',
39
+ inputShape: {
40
+ aclId: objectId.describe('Keyspace object id.'),
41
+ },
42
+ handler: async (ctx, args) => {
43
+ const acl = await ctx.keyspaceClient().getAcl(args.aclId);
44
+ // Cache fingerprint per the Keyspace docs: an entry is unchanged while
45
+ // the acl epoch, entry count, uri and entry epoch all hold. Comparing it
46
+ // lets a caller skip both the wallet signature and the Seal round-trip.
47
+ const entries = acl.entries.map((entry) => ({
48
+ ...entry,
49
+ fingerprint: `${acl.epoch}:${acl.entryCount}:${entry.uri}:${entry.epoch}`,
50
+ }));
51
+ return ok({ ...acl, entries });
52
+ },
53
+ },
54
+ ];
55
+ //# sourceMappingURL=keyspace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyspace.js","sourceRoot":"","sources":["../../src/tools/keyspace.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAGpD;;;;;;;;;;;GAWG;AACH,MAAM,eAAe,GACnB,+LAA+L,CAAA;AAEjM,MAAM,CAAC,MAAM,aAAa,GAAc;IACtC;QACE,IAAI,EAAE,0BAA0B;QAChC,KAA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G,EAAE,OAAO,EAAE,CAAC,CAAA;QAChC,CAAC;KACF;CACF,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trinaryex/mcp",
3
- "version": "3.4.0",
3
+ "version": "3.6.0",
4
4
  "description": "Keyless, multi-tenant MCP server for Trinary Exchange — market reads and unsigned transaction preparation for EVE Frontier trading agents.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,7 +42,8 @@
42
42
  "dependencies": {
43
43
  "@modelcontextprotocol/sdk": "^1.30.0",
44
44
  "@mysten/sui": "^2.16.0",
45
- "@trinaryex/sdk": "3.4.0",
45
+ "@trinaryex/keyspace": "^8.3.1",
46
+ "@trinaryex/sdk": "3.6.0",
46
47
  "express": "^5.2.1",
47
48
  "zod": "^4.4.3"
48
49
  },