@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
@@ -0,0 +1,60 @@
1
+ import { z } from 'zod';
2
+ import { jsonValue, uuid } from '../schemas.js';
3
+ import { makeRunner } from './shared.js';
4
+ /*
5
+ * ODATANO v2.0 wallet worker (CardanoWorkerService). Status/read tools are
6
+ * always registered when the service exists. The write tools queue jobs that
7
+ * a SERVER-HELD wallet signs, so they are opt-in (ODATANO_MCP_ENABLE_WALLET_JOBS)
8
+ * and meant to be used with a scoped credential; PauseWorker / ResumeWorker
9
+ * (Admin) are never exposed.
10
+ */
11
+ const JOB_KINDS = ['simpleAda', 'metadata', 'multiAsset', 'mint', 'plutusSpend', 'submitSigned'];
12
+ export function registerWorkerTools(server, ctx) {
13
+ const { client, config } = ctx;
14
+ const run = makeRunner(ctx);
15
+ server.registerTool('get_worker_status', {
16
+ description: 'Live wallet-worker summary on the host (ODATANO >= 2.0): running flag, configured wallet ids, ' +
17
+ 'in-flight executions, jobs awaiting confirmation, queue depth.',
18
+ inputSchema: {},
19
+ }, run(async () => client.callFunction('worker', 'GetWorkerStatus')));
20
+ server.registerTool('get_wallet_job_status', {
21
+ description: 'Lifecycle state of a wallet-worker job: status (pending / building / submitting / submitted / ' +
22
+ 'confirmed / failed / cancelled), attempt, txHash, fee, error code/message, timestamps. Poll every few ' +
23
+ 'seconds until confirmed or failed. Non-admin callers see their own jobs only.',
24
+ inputSchema: {
25
+ jobId: uuid('jobId').describe('Job id returned by submit_wallet_job'),
26
+ },
27
+ }, run(async (args) => client.callFunction('worker', 'GetJobStatus', { jobId: args.jobId }), {
28
+ notFoundAs: (args) => ({ jobId: args.jobId }),
29
+ }));
30
+ if (!config.enableWalletJobs)
31
+ return;
32
+ server.registerTool('submit_wallet_job', {
33
+ description: 'Queue an asynchronous transaction job for a SERVER-MANAGED worker wallet (ODATANO >= 2.0): the host ' +
34
+ 'builds, signs with the wallet\'s software/HSM key, submits and tracks confirmation. requestJson is the ' +
35
+ 'same payload shape as the matching build_* tool (senderAddress is overridden with the wallet address); ' +
36
+ 'kind submitSigned takes {signedTxCbor} and only submits. ' +
37
+ 'Idempotent per (walletId, kind, idempotencyKey) - a retry returns the original job. Returns ' +
38
+ '{ jobId, status, deduplicated }; poll get_wallet_job_status. THIS MOVES FUNDS once confirmed - only ' +
39
+ 'use with an explicit instruction and a wallet you are allowed to spend from.',
40
+ inputSchema: {
41
+ walletId: z.string().min(1).max(50).describe('Configured worker wallet id'),
42
+ kind: z.enum(JOB_KINDS).describe('Job kind: simpleAda | metadata | multiAsset | mint | plutusSpend | submitSigned'),
43
+ requestJson: jsonValue('requestJson', 'object')
44
+ .describe('Build request payload (same fields as the corresponding build_* tool, minus senderAddress)'),
45
+ idempotencyKey: z.string().min(1).max(100).optional().describe('Caller key that dedupes retries (strongly recommended)'),
46
+ priority: z.number().int().optional().describe('Higher runs first within a wallet'),
47
+ notBefore: z.string().datetime().optional().describe('ISO timestamp; do not start before'),
48
+ },
49
+ }, run(async (args) => client.callAction('worker', 'SubmitWalletJob', args)));
50
+ server.registerTool('cancel_wallet_job', {
51
+ description: 'Cancel a still-pending wallet job. Jobs that already started building may reach the chain and cannot ' +
52
+ 'be cancelled (returns false).',
53
+ inputSchema: {
54
+ jobId: uuid('jobId').describe('Job id'),
55
+ },
56
+ }, run(async (args) => client.callAction('worker', 'CancelJob', { jobId: args.jobId }), {
57
+ notFoundAs: (args) => ({ jobId: args.jobId }),
58
+ }));
59
+ }
60
+ //# sourceMappingURL=worker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/tools/worker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAoB,MAAM,aAAa,CAAC;AAE3D;;;;;;GAMG;AAEH,MAAM,SAAS,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc,CAAU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+1,52 @@
1
+ {
2
+ "name": "@odatano/core-mcp",
3
+ "version": "0.1.0",
4
+ "description": "MCP server exposing ODATANO (Cardano OData bridge, SAP CAP) to AI agents: reads, unsigned tx builds, signing handoff, submit",
5
+ "license": "Apache-2.0",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "type": "module",
10
+ "main": "dist/index.js",
11
+ "bin": {
12
+ "odatano-mcp": "dist/index.js"
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "engines": {
20
+ "node": ">=20"
21
+ },
22
+ "scripts": {
23
+ "build": "tsc -p tsconfig.json",
24
+ "start": "node dist/index.js",
25
+ "test": "tsc -p tsconfig.test.json && node --test .test-dist/schemas.test.js .test-dist/output.test.js .test-dist/client.test.js",
26
+ "integration": "npm run build && node scripts/integration-mcp.mjs",
27
+ "prepublishOnly": "npm run build"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/ODATANO/ODATANO-MCP.git"
32
+ },
33
+ "keywords": [
34
+ "mcp",
35
+ "model-context-protocol",
36
+ "cardano",
37
+ "blockchain",
38
+ "odata",
39
+ "sap-cap",
40
+ "utxo",
41
+ "plutus",
42
+ "ai-agent"
43
+ ],
44
+ "dependencies": {
45
+ "@modelcontextprotocol/sdk": "^1.0.0",
46
+ "zod": "^3.23.0"
47
+ },
48
+ "devDependencies": {
49
+ "@types/node": "^20.0.0",
50
+ "typescript": "^5.5.0"
51
+ }
52
+ }