@odatano/core-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 (45) hide show
  1. package/LICENSE +178 -0
  2. package/README.md +180 -0
  3. package/dist/client.d.ts +60 -0
  4. package/dist/client.js +177 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/config.d.ts +36 -0
  7. package/dist/config.js +40 -0
  8. package/dist/config.js.map +1 -0
  9. package/dist/index.d.ts +2 -0
  10. package/dist/index.js +21 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/output.d.ts +20 -0
  13. package/dist/output.js +45 -0
  14. package/dist/output.js.map +1 -0
  15. package/dist/schemas.d.ts +37 -0
  16. package/dist/schemas.js +76 -0
  17. package/dist/schemas.js.map +1 -0
  18. package/dist/server.d.ts +17 -0
  19. package/dist/server.js +27 -0
  20. package/dist/server.js.map +1 -0
  21. package/dist/tools/build.d.ts +3 -0
  22. package/dist/tools/build.js +208 -0
  23. package/dist/tools/build.js.map +1 -0
  24. package/dist/tools/index.d.ts +11 -0
  25. package/dist/tools/index.js +23 -0
  26. package/dist/tools/index.js.map +1 -0
  27. package/dist/tools/indexer.d.ts +3 -0
  28. package/dist/tools/indexer.js +30 -0
  29. package/dist/tools/indexer.js.map +1 -0
  30. package/dist/tools/query.d.ts +12 -0
  31. package/dist/tools/query.js +98 -0
  32. package/dist/tools/query.js.map +1 -0
  33. package/dist/tools/read.d.ts +9 -0
  34. package/dist/tools/read.js +173 -0
  35. package/dist/tools/read.js.map +1 -0
  36. package/dist/tools/shared.d.ts +31 -0
  37. package/dist/tools/shared.js +42 -0
  38. package/dist/tools/shared.js.map +1 -0
  39. package/dist/tools/sign.d.ts +3 -0
  40. package/dist/tools/sign.js +120 -0
  41. package/dist/tools/sign.js.map +1 -0
  42. package/dist/tools/worker.d.ts +3 -0
  43. package/dist/tools/worker.js +60 -0
  44. package/dist/tools/worker.js.map +1 -0
  45. package/package.json +52 -0
package/dist/config.js ADDED
@@ -0,0 +1,40 @@
1
+ /** ODATANO service names (path segments after the prefix). */
2
+ export const SERVICES = {
3
+ odata: 'cardano-odata',
4
+ transaction: 'cardano-transaction',
5
+ sign: 'cardano-sign',
6
+ worker: 'cardano-worker',
7
+ indexer: 'cardano-indexer',
8
+ };
9
+ function positiveInt(name, raw, fallback) {
10
+ if (raw === undefined || raw === '')
11
+ return fallback;
12
+ const n = Number(raw);
13
+ if (!Number.isFinite(n) || n <= 0 || !Number.isInteger(n)) {
14
+ throw new Error(`Invalid ${name}: ${raw}`);
15
+ }
16
+ return n;
17
+ }
18
+ function bool(raw) {
19
+ if (raw === undefined)
20
+ return false;
21
+ return ['1', 'true', 'yes', 'on'].includes(raw.trim().toLowerCase());
22
+ }
23
+ export function loadConfig(env = process.env) {
24
+ const baseUrl = (env.ODATANO_BASE_URL ?? 'http://localhost:4004').replace(/\/+$/, '');
25
+ let servicePrefix = env.ODATANO_SERVICE_PREFIX ?? '/odata/v4';
26
+ if (!servicePrefix.startsWith('/'))
27
+ servicePrefix = `/${servicePrefix}`;
28
+ servicePrefix = servicePrefix.replace(/\/+$/, '');
29
+ return {
30
+ baseUrl,
31
+ token: env.ODATANO_TOKEN || undefined,
32
+ username: env.ODATANO_USERNAME || undefined,
33
+ password: env.ODATANO_PASSWORD || undefined,
34
+ servicePrefix,
35
+ timeoutMs: positiveInt('ODATANO_TIMEOUT_MS', env.ODATANO_TIMEOUT_MS, 30000),
36
+ maxRows: positiveInt('ODATANO_MCP_MAX_ROWS', env.ODATANO_MCP_MAX_ROWS, 50),
37
+ enableWalletJobs: bool(env.ODATANO_MCP_ENABLE_WALLET_JOBS),
38
+ };
39
+ }
40
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AA2BA,8DAA8D;AAC9D,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,KAAK,EAAE,eAAe;IACtB,WAAW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EAAE,GAAG,CAAC,aAAa,IAAI,SAAS;QACrC,QAAQ,EAAE,GAAG,CAAC,gBAAgB,IAAI,SAAS;QAC3C,QAAQ,EAAE,GAAG,CAAC,gBAAgB,IAAI,SAAS;QAC3C,aAAa;QACb,SAAS,EAAE,WAAW,CAAC,oBAAoB,EAAE,GAAG,CAAC,kBAAkB,EAAE,KAAK,CAAC;QAC3E,OAAO,EAAE,WAAW,CAAC,sBAAsB,EAAE,GAAG,CAAC,oBAAoB,EAAE,EAAE,CAAC;QAC1E,gBAAgB,EAAE,IAAI,CAAC,GAAG,CAAC,8BAA8B,CAAC;KAC3D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
+ import { OdatanoClient } from './client.js';
4
+ import { loadConfig } from './config.js';
5
+ import { buildServer, detectCapabilities } from './server.js';
6
+ async function main() {
7
+ const config = loadConfig();
8
+ const client = new OdatanoClient(config);
9
+ const caps = await detectCapabilities(client);
10
+ const server = buildServer(config, caps);
11
+ // stdio transport: stdout is the protocol channel, diagnostics go to stderr
12
+ const optional = [caps.worker && 'worker', caps.indexer && 'indexer'].filter(Boolean).join(', ') || 'none (core < 2.0 or unreachable)';
13
+ console.error(`odatano-mcp: connecting tools to ${config.baseUrl}${config.servicePrefix} (v2.0 services: ${optional}` +
14
+ `${caps.worker && config.enableWalletJobs ? '; wallet jobs ENABLED' : ''})`);
15
+ await server.connect(new StdioServerTransport());
16
+ }
17
+ main().catch((err) => {
18
+ console.error('odatano-mcp failed to start:', err);
19
+ process.exit(1);
20
+ });
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE9D,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,IAAI,GAAG,MAAM,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACzC,4EAA4E;IAC5E,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,QAAQ,EAAE,IAAI,CAAC,OAAO,IAAI,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,kCAAkC,CAAC;IACvI,OAAO,CAAC,KAAK,CAAC,oCAAoC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,aAAa,oBAAoB,QAAQ,EAAE;QACnH,GAAG,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC/E,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;AACnD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,GAAG,CAAC,CAAC;IACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Output hygiene for tool results: cap long arrays and elide huge CBOR/hex
3
+ * blobs nested inside results so a single tool call cannot flood the agent's
4
+ * context. The tools whose purpose IS returning CBOR (build_*, get_build_details,
5
+ * parse_transaction_cbor) call {@link trimResult} with `keepCbor: true`.
6
+ */
7
+ export interface TrimOptions {
8
+ /** Max elements kept in any array (top-level `value` and nested). */
9
+ maxRows: number;
10
+ /** Keep CBOR/script hex fields verbatim (default: elide above `cborLimit`). */
11
+ keepCbor?: boolean;
12
+ /** Character limit above which CBOR-ish string fields are elided. */
13
+ cborLimit?: number;
14
+ }
15
+ export declare function trimResult(payload: unknown, opts: TrimOptions): unknown;
16
+ /**
17
+ * Convert a 404 from a Get* read into the "clean negative" shape used across
18
+ * ODATANO/NIGHTGATE MCP servers: `{ found: false, ... }` instead of an error.
19
+ */
20
+ export declare function notFound(detail: Record<string, unknown>): Record<string, unknown>;
package/dist/output.js ADDED
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Output hygiene for tool results: cap long arrays and elide huge CBOR/hex
3
+ * blobs nested inside results so a single tool call cannot flood the agent's
4
+ * context. The tools whose purpose IS returning CBOR (build_*, get_build_details,
5
+ * parse_transaction_cbor) call {@link trimResult} with `keepCbor: true`.
6
+ */
7
+ const CBOR_KEYS = new Set([
8
+ 'unsignedTxCbor', 'signedTxCbor', 'txCbor', 'cbor', 'rawCbor',
9
+ 'validatorScript', 'mintingPolicyScript', 'referenceScriptHex', 'scriptCbor',
10
+ ]);
11
+ export function trimResult(payload, opts) {
12
+ const cborLimit = opts.cborLimit ?? 8192;
13
+ return walk(payload, 0);
14
+ function walk(value, depth) {
15
+ if (Array.isArray(value)) {
16
+ const kept = value.slice(0, opts.maxRows).map((v) => walk(v, depth + 1));
17
+ if (value.length > opts.maxRows) {
18
+ // Arrays cannot carry a marker without changing element types, so
19
+ // the truncation notice is appended as a final string element.
20
+ kept.push(`… ${value.length - opts.maxRows} more item(s) truncated (limit ${opts.maxRows}); narrow with $filter/$top or increase ODATANO_MCP_MAX_ROWS`);
21
+ }
22
+ return kept;
23
+ }
24
+ if (value !== null && typeof value === 'object') {
25
+ const out = {};
26
+ for (const [k, v] of Object.entries(value)) {
27
+ if (!opts.keepCbor && typeof v === 'string' && CBOR_KEYS.has(k) && v.length > cborLimit) {
28
+ out[k] = `<${k}: ${v.length} hex chars elided — use get_build_details / get_signing_request to fetch it>`;
29
+ continue;
30
+ }
31
+ out[k] = walk(v, depth + 1);
32
+ }
33
+ return out;
34
+ }
35
+ return value;
36
+ }
37
+ }
38
+ /**
39
+ * Convert a 404 from a Get* read into the "clean negative" shape used across
40
+ * ODATANO/NIGHTGATE MCP servers: `{ found: false, ... }` instead of an error.
41
+ */
42
+ export function notFound(detail) {
43
+ return { found: false, ...detail };
44
+ }
45
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;IACxB,gBAAgB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS;IAC7D,iBAAiB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,YAAY;CAC7E,CAAC,CAAC;AAWH,MAAM,UAAU,UAAU,CAAC,OAAgB,EAAE,IAAiB;IAC5D,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC;IACzC,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IAExB,SAAS,IAAI,CAAC,KAAc,EAAE,KAAa;QACzC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;YACzE,IAAI,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;gBAChC,kEAAkE;gBAClE,+DAA+D;gBAC/D,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,kCAAkC,IAAI,CAAC,OAAO,8DAA8D,CAAC,CAAC;YAC1J,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAChD,MAAM,GAAG,GAA4B,EAAE,CAAC;YACxC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;gBACtE,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC;oBACxF,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,8EAA8E,CAAC;oBAC1G,SAAS;gBACX,CAAC;gBACD,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;YAC9B,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,MAA+B;IACtD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,CAAC;AACrC,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { z } from 'zod';
2
+ export declare const hex64: (what: string) => z.ZodString;
3
+ export declare const hex56: (what: string) => z.ZodString;
4
+ /** Any even-length hex string (CBOR, COSE, scripts). */
5
+ export declare const hexString: (what: string, max?: number) => z.ZodEffects<z.ZodString, string, string>;
6
+ /**
7
+ * Bech32 Cardano address (payment or stake). Loose check: prefix + charset +
8
+ * length; the server does the checksum. Accepts addr / addr_test / stake /
9
+ * stake_test.
10
+ */
11
+ export declare const bech32Address: z.ZodString;
12
+ export declare const stakeAddress: z.ZodString;
13
+ export declare const poolId: z.ZodString;
14
+ export declare const drepId: z.ZodString;
15
+ /** `policyId (56 hex) + assetNameHex (0..64 hex)`; `lovelace` is also accepted where the server does. */
16
+ export declare const assetUnit: z.ZodString;
17
+ /**
18
+ * Non-negative integer amount as decimal string (preferred, exact) or JS
19
+ * number. Always forwarded to ODATANO as a string so nothing is rounded.
20
+ */
21
+ export declare const amount: (what: string) => z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string, string | number>;
22
+ /** Positive integer amount (>= 1). */
23
+ export declare const positiveAmount: (what: string) => z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string, string | number>;
24
+ /** Posix milliseconds as decimal string or number, forwarded as string. */
25
+ export declare const posixMs: (what: string) => z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string, string | number>;
26
+ /** A string that must parse as JSON (objects/arrays are passed pre-stringified to ODATANO). */
27
+ export declare const jsonString: (what: string, kind?: "array" | "object" | "any") => z.ZodEffects<z.ZodString, string, string>;
28
+ /**
29
+ * JSON that the agent may pass either as a string or as a native value; the
30
+ * native form is stringified before it reaches ODATANO. Convenient for
31
+ * datums / redeemers / metadata objects.
32
+ */
33
+ export declare const jsonValue: (what: string, kind?: "array" | "object" | "any") => z.ZodEffects<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodUnknown | z.ZodArray<z.ZodUnknown, "many"> | z.ZodRecord<z.ZodString, z.ZodUnknown>]>, string, unknown>;
34
+ export declare const uuid: (what: string) => z.ZodString;
35
+ export declare const network: z.ZodEnum<["mainnet", "preview", "preprod"]>;
36
+ /** Clamp an integer into [min, max] (used for limits the server also clamps). */
37
+ export declare const clampedInt: (what: string, min: number, max: number, fallback: number) => z.ZodEffects<z.ZodOptional<z.ZodNumber>, number, number | undefined>;
@@ -0,0 +1,76 @@
1
+ import { z } from 'zod';
2
+ /*
3
+ * Shared zod helpers for Cardano-native shapes. Validation happens in the MCP
4
+ * layer so obviously malformed input never reaches ODATANO (and the agent
5
+ * gets a precise message instead of a generic 400).
6
+ */
7
+ const HEX = /^[0-9a-fA-F]+$/;
8
+ export const hex64 = (what) => z.string().regex(/^[0-9a-fA-F]{64}$/, `${what} must be 64 hex characters (32 bytes)`);
9
+ export const hex56 = (what) => z.string().regex(/^[0-9a-fA-F]{56}$/, `${what} must be 56 hex characters (28 bytes)`);
10
+ /** Any even-length hex string (CBOR, COSE, scripts). */
11
+ export const hexString = (what, max = 1_000_000) => z.string().min(2).max(max).regex(HEX, `${what} must be hex`).refine((s) => s.length % 2 === 0, {
12
+ message: `${what} must have an even number of hex characters`,
13
+ });
14
+ /**
15
+ * Bech32 Cardano address (payment or stake). Loose check: prefix + charset +
16
+ * length; the server does the checksum. Accepts addr / addr_test / stake /
17
+ * stake_test.
18
+ */
19
+ export const bech32Address = z.string()
20
+ .regex(/^(addr|addr_test|stake|stake_test)1[02-9ac-hj-np-z]{20,120}$/, 'must be a bech32 Cardano address (addr…/addr_test…/stake…/stake_test…)');
21
+ export const stakeAddress = z.string()
22
+ .regex(/^(stake|stake_test)1[02-9ac-hj-np-z]{20,80}$/, 'must be a bech32 stake address (stake…/stake_test…)');
23
+ export const poolId = z.string()
24
+ .regex(/^pool1[02-9ac-hj-np-z]{20,70}$/, 'must be a bech32 pool id (pool1…)');
25
+ export const drepId = z.string()
26
+ .regex(/^drep(_script)?1[02-9ac-hj-np-z]{20,70}$/, 'must be a bech32 DRep id (drep1… / drep_script1…)');
27
+ /** `policyId (56 hex) + assetNameHex (0..64 hex)`; `lovelace` is also accepted where the server does. */
28
+ export const assetUnit = z.string()
29
+ .regex(/^[0-9a-fA-F]{56}(?:[0-9a-fA-F]{2}){0,32}$/, 'must be policyId (56 hex) + assetNameHex (up to 64 hex)');
30
+ /**
31
+ * Non-negative integer amount as decimal string (preferred, exact) or JS
32
+ * number. Always forwarded to ODATANO as a string so nothing is rounded.
33
+ */
34
+ export const amount = (what) => z.union([
35
+ z.string().regex(/^\d+$/, `${what} must be a non-negative integer (decimal string)`),
36
+ z.number().int().nonnegative(),
37
+ ]).transform((v) => String(v));
38
+ /** Positive integer amount (>= 1). */
39
+ export const positiveAmount = (what) => z.union([
40
+ z.string().regex(/^[1-9]\d*$/, `${what} must be a positive integer (decimal string)`),
41
+ z.number().int().positive(),
42
+ ]).transform((v) => String(v));
43
+ /** Posix milliseconds as decimal string or number, forwarded as string. */
44
+ export const posixMs = amount;
45
+ /** A string that must parse as JSON (objects/arrays are passed pre-stringified to ODATANO). */
46
+ export const jsonString = (what, kind = 'any') => z.string().min(1).superRefine((s, ctx) => {
47
+ let parsed;
48
+ try {
49
+ parsed = JSON.parse(s);
50
+ }
51
+ catch {
52
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message: `${what} must be a JSON string` });
53
+ return;
54
+ }
55
+ if (kind === 'array' && !Array.isArray(parsed)) {
56
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message: `${what} must be a JSON array` });
57
+ }
58
+ if (kind === 'object' && (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed))) {
59
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message: `${what} must be a JSON object` });
60
+ }
61
+ });
62
+ /**
63
+ * JSON that the agent may pass either as a string or as a native value; the
64
+ * native form is stringified before it reaches ODATANO. Convenient for
65
+ * datums / redeemers / metadata objects.
66
+ */
67
+ export const jsonValue = (what, kind = 'any') => z.union([
68
+ jsonString(what, kind),
69
+ kind === 'array' ? z.array(z.unknown()) : kind === 'object' ? z.record(z.unknown()) : z.unknown(),
70
+ ]).transform((v) => (typeof v === 'string' ? v : JSON.stringify(v)));
71
+ export const uuid = (what) => z.string().uuid(`${what} must be a UUID`);
72
+ export const network = z.enum(['mainnet', 'preview', 'preprod']);
73
+ /** Clamp an integer into [min, max] (used for limits the server also clamps). */
74
+ export const clampedInt = (what, min, max, fallback) => z.number().int().min(min, `${what} must be >= ${min}`).max(max, `${what} must be <= ${max}`).optional()
75
+ .transform((v) => v ?? fallback);
76
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AAEH,MAAM,GAAG,GAAG,gBAAgB,CAAC;AAE7B,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CACpC,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mBAAmB,EAAE,GAAG,IAAI,uCAAuC,CAAC,CAAC;AAExF,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CACpC,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mBAAmB,EAAE,GAAG,IAAI,uCAAuC,CAAC,CAAC;AAExF,wDAAwD;AACxD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,GAAG,GAAG,SAAS,EAAE,EAAE,CACzD,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,IAAI,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE;IAC7F,OAAO,EAAE,GAAG,IAAI,6CAA6C;CAC9D,CAAC,CAAC;AAEL;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,EAAE;KACpC,KAAK,CAAC,8DAA8D,EAAE,wEAAwE,CAAC,CAAC;AAEnJ,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,EAAE;KACnC,KAAK,CA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C,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE;CAClG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEvE,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,GAAG,IAAI,iBAAiB,CAAC,CAAC;AAEhF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAEjE,iFAAiF;AACjF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,GAAW,EAAE,GAAW,EAAE,QAAgB,EAAE,EAAE,CACrF,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,eAAe,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,eAAe,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;KACpG,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { OdatanoClient } from './client.js';
3
+ import type { OdatanoMcpConfig } from './config.js';
4
+ import { type Capabilities } from './tools/index.js';
5
+ export declare const SERVER_VERSION = "0.1.0";
6
+ /**
7
+ * Probe which optional (v2.0) services the host serves. Both probes run in
8
+ * parallel and never throw; an unreachable host simply yields no v2.0 tools
9
+ * (the core tools are registered regardless and report errors per call).
10
+ */
11
+ export declare function detectCapabilities(client: OdatanoClient): Promise<Capabilities>;
12
+ /**
13
+ * Build the MCP server with all tools registered; transport is the caller's
14
+ * choice. `caps` defaults to "core only" so callers that cannot reach the host
15
+ * (unit tests, schema inspection) get a deterministic tool set.
16
+ */
17
+ export declare function buildServer(config: OdatanoMcpConfig, caps?: Capabilities): McpServer;
package/dist/server.js ADDED
@@ -0,0 +1,27 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { OdatanoClient } from './client.js';
3
+ import { registerTools } from './tools/index.js';
4
+ export const SERVER_VERSION = '0.1.0';
5
+ /**
6
+ * Probe which optional (v2.0) services the host serves. Both probes run in
7
+ * parallel and never throw; an unreachable host simply yields no v2.0 tools
8
+ * (the core tools are registered regardless and report errors per call).
9
+ */
10
+ export async function detectCapabilities(client) {
11
+ const [worker, indexer] = await Promise.all([
12
+ client.serviceExists('worker'),
13
+ client.serviceExists('indexer'),
14
+ ]);
15
+ return { worker, indexer };
16
+ }
17
+ /**
18
+ * Build the MCP server with all tools registered; transport is the caller's
19
+ * choice. `caps` defaults to "core only" so callers that cannot reach the host
20
+ * (unit tests, schema inspection) get a deterministic tool set.
21
+ */
22
+ export function buildServer(config, caps = { worker: false, indexer: false }) {
23
+ const server = new McpServer({ name: 'odatano', version: SERVER_VERSION });
24
+ registerTools(server, { client: new OdatanoClient(config), config }, caps);
25
+ return server;
26
+ }
27
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAqB,MAAM,kBAAkB,CAAC;AAEpE,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAEtC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAAqB;IAC5D,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC1C,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC;QAC9B,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC;KAChC,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,MAAwB,EAAE,OAAqB,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE;IAC1G,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC;IAC3E,aAAa,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,CAAC;IAC3E,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { type ToolContext } from './shared.js';
3
+ export declare function registerBuildTools(server: McpServer, ctx: ToolContext): void;
@@ -0,0 +1,208 @@
1
+ import { z } from 'zod';
2
+ import { amount, bech32Address, hex64, hexString, jsonValue, network, posixMs, uuid, } from '../schemas.js';
3
+ import { JSON_HINT, makeRunner, UNSIGNED_HINT } from './shared.js';
4
+ /*
5
+ * Build tools over CardanoTransactionService. Every Build* action returns a
6
+ * TransactionBuilds row: { id (buildId), unsignedTxCbor, fee, ttl, status,
7
+ * scriptAddress?, scriptHash?, ... }. Nothing is signed here - the host never
8
+ * holds the sender's key in this flow - so exposing the full parameter set is
9
+ * safe: the worst outcome of a bad build is an unsigned CBOR nobody signs.
10
+ */
11
+ const validityBounds = {
12
+ validityStartMs: posixMs('validityStartMs').optional()
13
+ .describe('Optional validity-interval start, Posix milliseconds'),
14
+ validityEndMs: posixMs('validityEndMs').optional()
15
+ .describe('Optional validity-interval end, Posix milliseconds'),
16
+ };
17
+ const scriptParams = {
18
+ scriptParamsJson: jsonValue('scriptParamsJson', 'array').optional()
19
+ .describe('Optional JSON array of PlutusData parameters applied to the script before hashing/building ' +
20
+ '(parameterized validators). Typed entries {"uplc":"data"|"bytes"|"int"|"bool"|"unit","value":…} are ' +
21
+ 'applied as native UPLC constants; bare PlutusData entries mean "data".'),
22
+ };
23
+ const forceInputs = {
24
+ forceInputsJson: jsonValue('forceInputsJson', 'array').optional()
25
+ .describe('Optional JSON array of {txHash, outputIndex} UTxOs that MUST be consumed (one-shot mint seeds, ' +
26
+ 'token-carrying UTxOs, deterministic input control)'),
27
+ };
28
+ const referenceInputs = {
29
+ referenceInputsJson: jsonValue('referenceInputsJson', 'array').optional()
30
+ .describe('Optional JSON array of {txHash, outputIndex} CIP-31 reference inputs (read-only, not consumed): ' +
31
+ 'oracle feeds, shared config UTxOs, reference-script UTxOs'),
32
+ };
33
+ const referenceScript = {
34
+ referenceScriptHex: hexString('referenceScriptHex').optional()
35
+ .describe('Optional Plutus V3 validator CBOR hex attached as CIP-33 reference script on the primary output. ' +
36
+ 'Inflates the output min-ADA significantly - lovelaceAmount must cover it.'),
37
+ };
38
+ const requiredSigners = {
39
+ requiredSignersJson: jsonValue('requiredSignersJson', 'array').optional()
40
+ .describe('Optional JSON array of 28-byte Ed25519 key hashes (56 hex each) that must sign; needed by validators ' +
41
+ 'checking extra_signatories. Get a hash via extract_payment_key_hash.'),
42
+ };
43
+ export function registerBuildTools(server, ctx) {
44
+ const { client } = ctx;
45
+ const run = makeRunner(ctx);
46
+ server.registerTool('build_ada_transfer', {
47
+ description: 'Build a simple ADA transfer (optionally carrying native assets, an inline datum, or locking at a ' +
48
+ 'Plutus script address). Coin selection, fee and change are computed by the host (Buildooor).' +
49
+ UNSIGNED_HINT + JSON_HINT,
50
+ inputSchema: {
51
+ senderAddress: bech32Address.describe('Sender / fee payer (bech32)'),
52
+ recipientAddress: bech32Address.describe('Recipient (bech32); ignored when lockOnScript is true'),
53
+ lovelaceAmount: amount('lovelaceAmount').describe('Amount in lovelace (1 ADA = 1000000)'),
54
+ changeAddress: bech32Address.optional().describe('Change address; defaults to senderAddress'),
55
+ outputDatumJson: jsonValue('outputDatumJson').optional()
56
+ .describe('Optional inline datum for the recipient output (PlutusData JSON, DetailedSchema). Required when sending to a script address.'),
57
+ assetsJson: jsonValue('assetsJson', 'array').optional()
58
+ .describe('Optional native assets for the output: [{"unit":"policyId+assetNameHex","quantity":"amount"}]'),
59
+ ...forceInputs,
60
+ validatorScript: hexString('validatorScript').optional()
61
+ .describe('Optional Plutus validator CBOR hex; required when lockOnScript is true (used only to derive the target script address)'),
62
+ ...scriptParams,
63
+ lockOnScript: z.boolean().optional()
64
+ .describe('When true, route the output to the enterprise script address derived from validatorScript (+ scriptParamsJson) instead of recipientAddress'),
65
+ ...referenceScript,
66
+ ...validityBounds,
67
+ },
68
+ }, run(async (args) => client.callAction('transaction', 'BuildSimpleAdaTransaction', args), { keepCbor: true }));
69
+ server.registerTool('build_metadata_transaction', {
70
+ description: 'Build an ADA transfer that carries transaction metadata (CIP-20 message, label-1447 financial anchor, ' +
71
+ 'any label -> JSON). Use lovelaceAmount = min-ADA and recipient = sender for a pure anchoring tx.' +
72
+ UNSIGNED_HINT + JSON_HINT,
73
+ inputSchema: {
74
+ senderAddress: bech32Address.describe('Sender / fee payer (bech32)'),
75
+ recipientAddress: bech32Address.describe('Recipient (bech32); may equal senderAddress'),
76
+ lovelaceAmount: amount('lovelaceAmount').describe('Amount in lovelace'),
77
+ changeAddress: bech32Address.optional().describe('Change address; defaults to senderAddress'),
78
+ metadataJson: jsonValue('metadataJson', 'object')
79
+ .describe('Metadata as JSON object keyed by numeric label string, e.g. {"674":{"msg":["hello"]}}'),
80
+ },
81
+ }, run(async (args) => client.callAction('transaction', 'BuildTransactionWithMetadata', args), { keepCbor: true }));
82
+ server.registerTool('build_multi_asset_transfer', {
83
+ description: 'Build a transfer of native assets (tokens / NFTs) together with ADA to one recipient.' +
84
+ UNSIGNED_HINT + JSON_HINT,
85
+ inputSchema: {
86
+ senderAddress: bech32Address.describe('Sender / fee payer (bech32)'),
87
+ recipientAddress: bech32Address.describe('Recipient (bech32)'),
88
+ lovelaceAmount: amount('lovelaceAmount').describe('Lovelace to send along (must cover min-ADA of the token output)'),
89
+ assetsJson: jsonValue('assetsJson', 'array')
90
+ .describe('Assets to send: [{"unit":"policyId+assetNameHex","quantity":"amount"}]'),
91
+ changeAddress: bech32Address.optional().describe('Change address; defaults to senderAddress'),
92
+ outputDatumJson: jsonValue('outputDatumJson').optional()
93
+ .describe('Optional inline datum for the recipient output (PlutusData JSON). Required for script addresses.'),
94
+ ...referenceScript,
95
+ ...validityBounds,
96
+ },
97
+ }, run(async (args) => client.callAction('transaction', 'BuildMultiAssetTransaction', args), { keepCbor: true }));
98
+ server.registerTool('build_mint_transaction', {
99
+ description: 'Build a mint or burn of native assets under a Plutus (V3) minting policy. Supports parameterized policies, ' +
100
+ 'required signers, inline datum on the recipient output, CIP-31 reference inputs, CIP-33 reference-script ' +
101
+ 'deploy, metadata (CIP-25 label 721 goes in metadataJson) and forced inputs for one-shot policies. ' +
102
+ 'Redeemer/datum JSON may contain __INPUT_IDX:<txHash>#<outputIndex>__ placeholders that resolve to the ' +
103
+ 'input index after coin selection.' + UNSIGNED_HINT + JSON_HINT,
104
+ inputSchema: {
105
+ senderAddress: bech32Address.describe('Sender / fee payer (bech32)'),
106
+ recipientAddress: bech32Address.describe('Receiver of the minted assets (bech32)'),
107
+ lovelaceAmount: amount('lovelaceAmount').describe('Lovelace sent with the minted assets (must cover min-ADA)'),
108
+ mintActionsJson: jsonValue('mintActionsJson', 'array')
109
+ .describe('Mint/burn actions: [{"assetUnit":"policyId+assetNameHex","quantity":"amount"}] (negative quantity = burn)'),
110
+ mintingPolicyScript: hexString('mintingPolicyScript').describe('Minting policy script CBOR hex (as emitted by Aiken/Plutus; do NOT unwrap)'),
111
+ changeAddress: bech32Address.optional().describe('Change address; defaults to senderAddress'),
112
+ ...requiredSigners,
113
+ ...scriptParams,
114
+ inlineDatumJson: jsonValue('inlineDatumJson').optional()
115
+ .describe('Optional PlutusData JSON inline datum on the recipient output (tokens carrying state)'),
116
+ mintRedeemerJson: jsonValue('mintRedeemerJson').optional()
117
+ .describe('Optional PlutusData JSON redeemer for the policy; defaults to integer 0'),
118
+ lockOnScript: z.boolean().optional()
119
+ .describe('When true (with scriptParamsJson), route the output to the applied script\'s enterprise address instead of recipientAddress'),
120
+ ...forceInputs,
121
+ ...referenceInputs,
122
+ metadataJson: jsonValue('metadataJson', 'object').optional()
123
+ .describe('Optional metadata object keyed by numeric label string (CIP-25: {"721":{...}})'),
124
+ ...referenceScript,
125
+ ...validityBounds,
126
+ },
127
+ }, run(async (args) => client.callAction('transaction', 'BuildMintTransaction', args), { keepCbor: true }));
128
+ server.registerTool('build_plutus_spend', {
129
+ description: 'Build a transaction spending a UTxO locked at a Plutus (V3) script address: validator + redeemer + the ' +
130
+ 'script UTxO (txHash#index), optional datum (hash-based), continuing-output inline datum, extra outputs, ' +
131
+ 'combined mint, CIP-31 reference inputs, CIP-33 reference script, required signers. The host evaluates ' +
132
+ 'the script locally for the ExUnits budget; on-chain validation at submit stays authoritative.' +
133
+ UNSIGNED_HINT + JSON_HINT,
134
+ inputSchema: {
135
+ senderAddress: bech32Address.describe('Fee payer / collateral provider (bech32)'),
136
+ recipientAddress: bech32Address.describe('Receiver of the unlocked funds (bech32)'),
137
+ lovelaceAmount: amount('lovelaceAmount').describe('Lovelace to send to recipientAddress'),
138
+ validatorScript: hexString('validatorScript').describe('Plutus validator CBOR hex (as emitted by the compiler; do NOT unwrap)'),
139
+ scriptTxHash: hex64('scriptTxHash').describe('Tx hash of the UTxO locked at the script address'),
140
+ scriptOutputIndex: z.number().int().nonnegative().describe('Output index of the locked UTxO'),
141
+ redeemerJson: jsonValue('redeemerJson').describe('Redeemer as PlutusData JSON (constructor/fields, int, bytes, list, map)'),
142
+ datumJson: jsonValue('datumJson').optional().describe('Optional datum PlutusData JSON (only for hash-based datums; inline datums are read from the UTxO)'),
143
+ changeAddress: bech32Address.optional().describe('Change address; defaults to senderAddress'),
144
+ ...requiredSigners,
145
+ ...scriptParams,
146
+ inlineDatumJson: jsonValue('inlineDatumJson').optional()
147
+ .describe('Optional PlutusData JSON inline datum for the recipient output (state-machine continuing output)'),
148
+ lockOnScript: z.boolean().optional()
149
+ .describe('When true (with scriptParamsJson), route the output back to the applied script\'s enterprise address'),
150
+ ...forceInputs,
151
+ extraOutputsJson: jsonValue('extraOutputsJson', 'array').optional()
152
+ .describe('Optional additional outputs after the primary one: [{address, lovelaceAmount, assets?:[{unit,quantity}], inlineDatumJson?, referenceScriptHex?}]'),
153
+ mintActionsJson: jsonValue('mintActionsJson', 'array').optional()
154
+ .describe('Optional mint/burn actions for a combined spend+mint: [{"assetUnit","quantity"}]; requires mintingPolicyScript'),
155
+ mintingPolicyScript: hexString('mintingPolicyScript').optional()
156
+ .describe('Optional minting policy CBOR hex (required with mintActionsJson; if byte-equal to validatorScript, scriptParamsJson applies to it too)'),
157
+ mintRedeemerJson: jsonValue('mintRedeemerJson').optional()
158
+ .describe('Optional PlutusData JSON redeemer for the policy; defaults to integer 0; supports __INPUT_IDX__ placeholders'),
159
+ ...referenceInputs,
160
+ ...referenceScript,
161
+ ...validityBounds,
162
+ },
163
+ }, run(async (args) => client.callAction('transaction', 'BuildPlutusSpendTransaction', args), { keepCbor: true }));
164
+ server.registerTool('set_collateral', {
165
+ description: 'Ensure a dedicated ADA-only collateral UTxO exists for Plutus transactions: checks the address for ' +
166
+ '>= 2 UTxOs of >= 5 ADA and, if missing, builds a self-send that creates a 5 ADA UTxO. Returns the ' +
167
+ 'build (to sign + submit) or a no-op result when collateral is already fine.' + UNSIGNED_HINT,
168
+ inputSchema: {
169
+ address: bech32Address.describe('Address to check / prepare (bech32)'),
170
+ },
171
+ }, run(async (args) => client.callAction('transaction', 'SetCollateral', { address: args.address }), { keepCbor: true }));
172
+ server.registerTool('get_build_details', {
173
+ description: 'Re-fetch a transaction build by buildId: unsigned CBOR, fee, ttl, status (built / signed / submitted), ' +
174
+ 'derived script address, inputs/outputs recorded at build time. Returns found:false for unknown ids.',
175
+ inputSchema: {
176
+ buildId: uuid('buildId').describe('Build id returned by a build_* tool'),
177
+ },
178
+ }, run(async (args) => client.callAction('transaction', 'GetBuildDetails', { buildId: args.buildId }), {
179
+ keepCbor: true,
180
+ notFoundAs: (args) => ({ buildId: args.buildId }),
181
+ }));
182
+ server.registerTool('list_builds_by_address', {
183
+ description: 'Transaction builds recorded for a sender address (build audit trail): buildId, status, fee, created time.',
184
+ inputSchema: {
185
+ address: bech32Address.describe('Sender address (bech32)'),
186
+ },
187
+ }, run(async (args) => client.callAction('transaction', 'GetTransactionBuildsByAddress', { address: args.address }), {
188
+ notFoundAs: (args) => ({ address: args.address }),
189
+ }));
190
+ server.registerTool('derive_script_address', {
191
+ description: 'Utility: apply optional PlutusData parameters to a validator script and return its enterprise script ' +
192
+ 'address (bech32) and 28-byte script hash. Pure derivation - no transaction, no chain call. Script hex ' +
193
+ 'from Aiken/Plutus compilers is CBOR-wrapped flat UPLC; pass it as-is (unwrapping changes the hash).' + JSON_HINT,
194
+ inputSchema: {
195
+ validatorScript: hexString('validatorScript').describe('Validator script CBOR hex'),
196
+ ...scriptParams,
197
+ network: network.optional().describe('Network override for the address prefix; defaults to the host network'),
198
+ },
199
+ }, run(async (args) => client.callAction('transaction', 'DeriveScriptAddress', args)));
200
+ server.registerTool('extract_payment_key_hash', {
201
+ description: 'Utility: decode a bech32 address and return its 28-byte payment credential hash (56 hex). Pure ' +
202
+ 'decoding, no chain call. Use it for requiredSignersJson or credential-based UTxO queries.',
203
+ inputSchema: {
204
+ address: bech32Address.describe('Bech32 address (addr… / addr_test…)'),
205
+ },
206
+ }, run(async (args) => client.callAction('transaction', 'ExtractPaymentKeyHash', { address: args.address })));
207
+ }
208
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/tools/build.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,GAC3E,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAoB,MAAM,aAAa,CAAC;AAErF;;;;;;GAMG;AAEH,MAAM,cAAc,GAAG;IACrB,eAAe,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE;SACnD,QAAQ,CAAC,sDAAsD,CAAC;IACnE,aAAa,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE;SAC/C,QAAQ,CAAC,oDAAoD,CAAC;CAClE,CAAC;AAEF,MAAM,YAAY,GAAG;IACnB,gBAAgB,EAAE,SAAS,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE;SAChE,QAAQ,CAAC,6FAA6F;QACrG,sGAAsG;QACtG,wEAAwE,CAAC;CAC9E,CAAC;AAEF,MAAM,WAAW,GAAG;IAClB,eAAe,EAAE,SAAS,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE;SAC9D,QAAQ,CAAC,iGAAiG;QACzG,oDAAoD,CAAC;CAC1D,CAAC;AAEF,MAAM,eAAe,GAAG;IACtB,mBAAmB,EAAE,SAAS,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE;SACtE,QAAQ,CAAC,kGAAkG;QAC1G,2DAA2D,CAAC;CACjE,CAAC;AAEF,MAAM,eAA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EAAE,CAAC;KAClD,CAAC,CACH,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,uBAAuB,EACvB;QACE,WAAW,EACT,uGAAuG;YACvG,wGAAwG;YACxG,qGAAqG,GAAG,SAAS;QACnH,WAAW,EAAE;YACX,eAAe,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC;YACnF,GAAG,YAAY;YACf,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uEAAuE,CAAC;SAC9G;KACF,EACD,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,aAAa,EAAE,qBAAqB,EAAE,IAAI,CAAC,CAAC,CACnF,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,0BAA0B,EAC1B;QACE,WAAW,EACT,iGAAiG;YACjG,2FAA2F;QAC7F,WAAW,EAAE;YACX,OAAO,EAAE,aAAa,CAAC,QAAQ,CAAC,qCAAqC,CAAC;SACvE;KACF,EACD,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,aAAa,EAAE,uBAAuB,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAC1G,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { type QueryCapabilities } from './query.js';
3
+ import type { ToolContext } from './shared.js';
4
+ export type Capabilities = QueryCapabilities;
5
+ /**
6
+ * Register the tool catalogue. Reads, generic query, unsigned builds and the
7
+ * signing handoff are always present; the v2.0 worker / indexer tools only
8
+ * when the host serves those services (see OdatanoClient.serviceExists).
9
+ * HSM signing and every Admin action are deliberately never registered.
10
+ */
11
+ export declare function registerTools(server: McpServer, ctx: ToolContext, caps: Capabilities): void;
@@ -0,0 +1,23 @@
1
+ import { registerBuildTools } from './build.js';
2
+ import { registerIndexerTools } from './indexer.js';
3
+ import { registerQueryTools } from './query.js';
4
+ import { registerReadTools } from './read.js';
5
+ import { registerSignTools } from './sign.js';
6
+ import { registerWorkerTools } from './worker.js';
7
+ /**
8
+ * Register the tool catalogue. Reads, generic query, unsigned builds and the
9
+ * signing handoff are always present; the v2.0 worker / indexer tools only
10
+ * when the host serves those services (see OdatanoClient.serviceExists).
11
+ * HSM signing and every Admin action are deliberately never registered.
12
+ */
13
+ export function registerTools(server, ctx, caps) {
14
+ registerReadTools(server, ctx);
15
+ registerQueryTools(server, ctx, caps);
16
+ registerBuildTools(server, ctx);
17
+ registerSignTools(server, ctx);
18
+ if (caps.worker)
19
+ registerWorkerTools(server, ctx);
20
+ if (caps.indexer)
21
+ registerIndexerTools(server, ctx);
22
+ }
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAA0B,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIlD;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,MAAiB,EAAE,GAAgB,EAAE,IAAkB;IACnF,iBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,kBAAkB,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IACtC,kBAAkB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,iBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,IAAI,IAAI,CAAC,MAAM;QAAE,mBAAmB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClD,IAAI,IAAI,CAAC,OAAO;QAAE,oBAAoB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { type ToolContext } from './shared.js';
3
+ export declare function registerIndexerTools(server: McpServer, ctx: ToolContext): void;