@odatano/nightgate-mcp 0.10.1 → 0.12.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/docs/tools.md ADDED
@@ -0,0 +1,84 @@
1
+ # Tools of @odatano/nightgate-mcp
2
+
3
+ Every tool, what it does, and the two flows that chain several of them. Async
4
+ tools return `{ jobId, status }`; `get_job_status` polls. The server reads
5
+ the chain through the ODATANO API; only the swap wallet syncs from a Midnight
6
+ indexer.
7
+
8
+ ## All tools
9
+
10
+ | Tool | What it does |
11
+ |---|---|
12
+ | `verify_attestation`, `verify_predicate`, `verify_predicate_attestation`, `verify_document` | Check records and ZK claims against live contract state; absent = `verified: false` |
13
+ | `prepare_document_proof`, `prepare_membership_set` | Build proof inputs: salted content tree, set root |
14
+ | `anchor_document`, `attest_agent_output` | Anchor a document hash or an agent-output envelope (async) |
15
+ | `prove_field_predicate`, `prove_field_equality`, `prove_field_membership` | ZK claims over one hidden field (async) |
16
+ | `prove_field_predicates_batch` | Up to 8 claims in one transaction (async) |
17
+ | `prove_document_integrity`, `prove_document_diff` | ZK claims across two documents (async) |
18
+ | `grant_disclosure`, `revoke_disclosure` | On-chain disclosure ACL (async) |
19
+ | `build_sponsorable_transaction`, `get_attester_identity` | Build, prove and sign a vault call locally; the bytes stay here under a `txId`, or go to `outFile`. The attester id and shielded keys of the seed |
20
+ | `sponsor_unbound_transaction`, `sponsor_finalized_transaction` | Hand a built transaction by `txId` or `file` to a sponsor that pays and submits (async); the result says what was sent |
21
+ | `get_swap_wallet`, `read_swap_offer` | Shielded coins of the local wallet; what an offer gives and wants |
22
+ | `build_swap_offer`, `take_swap_offer`, `revert_swap_offer` | Build one half of a shielded swap locally, take an offer, release a half |
23
+ | `sponsor_swap` | Hand both halves of a swap, or a board offer plus the taker half, to a sponsor that merges, pays and submits (async) |
24
+ | `post_swap_offer`, `list_swap_offers`, `retire_swap_offer` | The server's offer board: post a maker half, find open offers, take yours down |
25
+ | `get_swap_offer`, `my_swap_offers`, `get_board_status` | Follow one offer, see your own posts and their fills, read the board's counts without credentials |
26
+ | `mint_token` | Mint a shielded token with a name of your own on a token factory: built here with the seed as issuer and sponsored, or by a server session (async) |
27
+ | `grant_disclosure_to_holders`, `revoke_holder_disclosure`, `claim_disclosure`, `holder_claim_key` | Disclose a document to the holders of a token; read it with the secret behind a registered claim key |
28
+ | `derive_token_type` | Token type a minting contract produces |
29
+ | `get_job_status` | Poll an async job; batches report `chainSegments`, swaps `swap` |
30
+ | `analytics_*` | Midnight aggregates via ODATANO ASTRA, when the host serves it |
31
+
32
+ Errors carry the server's HTTP status and `code` (`INVALID_ARGUMENT`, ...).
33
+
34
+ ## Fee sponsoring
35
+
36
+ The caller builds, the server pays. Needs `@odatano/nightgate-tx` next to the
37
+ server and `NIGHTGATE_SEED_HEX`; the contract state is read through the API.
38
+
39
+ 1. `build_sponsorable_transaction` builds, proves and signs the call locally
40
+ and returns a `txId`. The bytes never travel as a tool argument.
41
+ 2. `sponsor_unbound_transaction` with the `txId`, or with `file` for bytes
42
+ built elsewhere; the server's sponsor pool pays and submits.
43
+ 3. `get_job_status` with the returned `sessionId`, then `verify_attestation`.
44
+
45
+ `failed` / `CHAIN_EXECUTION_FAILED`: landed but not applied; build again, never
46
+ resubmit the same bytes.
47
+
48
+ ## Shielded swaps
49
+
50
+ Two wallets exchange two shielded tokens without a contract. Each side builds
51
+ one half, the halves mirror each other, a sponsor merges them and pays the fee.
52
+ Needs `@odatano/nightgate-tx` next to the server, `NIGHTGATE_SEED_HEX` and a
53
+ Midnight indexer the swap wallet syncs its coins from (`NIGHTGATE_INDEXER_HTTP_URL`,
54
+ `NIGHTGATE_INDEXER_WS_URL`).
55
+
56
+ 1. `get_swap_wallet`: balance, free coins and `spendable` per token type. The
57
+ first call starts the sync of the shielded coins (about 5 minutes from
58
+ genesis, seconds with `NIGHTGATE_SWAP_STATE_FILE`).
59
+ 2. Maker: `build_swap_offer` with `give` and `want` returns the offer file
60
+ (`swapoffer1...`) to publish, or `post_swap_offer` puts it on the server's
61
+ board.
62
+ 3. Taker: `list_swap_offers` or `read_swap_offer`, then `take_swap_offer` with
63
+ `expect`, `submit: true` and, for a board entry, its `offerId`. It builds
64
+ the mirror half and submits both; the server's sponsor pool pays.
65
+ 4. `get_job_status` with the returned `sessionId`; the result carries `swap`.
66
+ The maker follows the offer with `get_swap_offer` or `my_swap_offers`
67
+ (`filled` + `filledTxHash`); `list_swap_offers` with `status: all` and
68
+ `since` is the board's change feed.
69
+
70
+ - One half spends at most `NIGHTGATE_SWAP_MAX_INPUTS` coins, the smallest that
71
+ fit. `give.amount` above `spendable` is refused before proving.
72
+ - An offer fills once. Its coins stay reserved in the maker's wallet until the
73
+ swap lands or `revert_swap_offer` releases them.
74
+ - A refused submission keeps the proven half: `sponsor_swap` with its `halfId`.
75
+ - The sponsor needs swaps switched on and both token types on its list; an
76
+ agent grant needs `sponsorSwap` in `allowedActions`.
77
+ - With `NIGHTGATE_PROOF_SERVER_URL` the proof server sees the coins a half
78
+ spends: use one you run yourself.
79
+ - Tokens to swap: `mint_token` mints on a token factory to this wallet, or to
80
+ any wallet whose two keys are given. Without a `sessionId` the seed is the
81
+ issuer, the mint is built here and the sponsor pays; this needs
82
+ `@odatano/contract-token-factory` next to `@odatano/nightgate-tx`. A landed
83
+ mint makes the type known to the sponsor.
84
+ - `get_board_status` says whether a sponsor is ready before anything is built.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odatano/nightgate-mcp",
3
- "version": "0.10.1",
3
+ "version": "0.12.0",
4
4
  "description": "MCP server exposing NIGHTGATE (Midnight blockchain attestation layer) to AI agents",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {
@@ -13,6 +13,7 @@
13
13
  },
14
14
  "files": [
15
15
  "dist",
16
+ "docs",
16
17
  "README.md",
17
18
  "CHANGELOG.md",
18
19
  "LICENSE"
@@ -50,7 +51,7 @@
50
51
  },
51
52
  "peerDependencies": {
52
53
  "@odatano/contract-token-factory": ">=0.1.0",
53
- "@odatano/nightgate-tx": ">=0.10.2"
54
+ "@odatano/nightgate-tx": ">=0.12.2"
54
55
  },
55
56
  "peerDependenciesMeta": {
56
57
  "@odatano/contract-token-factory": {
@@ -62,7 +63,7 @@
62
63
  },
63
64
  "devDependencies": {
64
65
  "@odatano/contract-token-factory": "^0.1.0",
65
- "@odatano/nightgate-tx": "^0.10.2",
66
+ "@odatano/nightgate-tx": "^0.12.2",
66
67
  "@types/node": "^20.0.0",
67
68
  "typescript": "^5.5.0"
68
69
  }