@odatano/nightgate-mcp 0.11.0 → 0.14.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/CHANGELOG.md +262 -217
- package/README.md +15 -112
- package/dist/builder.d.ts +6 -4
- package/dist/builder.js +13 -20
- package/dist/builder.js.map +1 -1
- package/dist/built.d.ts +23 -0
- package/dist/built.js +58 -0
- package/dist/built.js.map +1 -0
- package/dist/client.d.ts +2 -2
- package/dist/client.js +3 -2
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +5 -0
- package/dist/config.js +26 -2
- package/dist/config.js.map +1 -1
- package/dist/factory.d.ts +1 -1
- package/dist/factory.js +3 -13
- package/dist/factory.js.map +1 -1
- package/dist/swap.js +8 -11
- package/dist/swap.js.map +1 -1
- package/dist/tools.js +44 -16
- package/dist/tools.js.map +1 -1
- package/docs/configuration.md +46 -0
- package/docs/tools.md +85 -0
- package/package.json +4 -3
package/docs/tools.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
| `get_grant_usage` | What the key did and what it may still do: hour and day budgets, rate classes with what is left |
|
|
31
|
+
| `analytics_*` | Midnight aggregates via ODATANO ASTRA, when the host serves it |
|
|
32
|
+
|
|
33
|
+
Errors carry the server's HTTP status and `code` (`INVALID_ARGUMENT`, ...).
|
|
34
|
+
|
|
35
|
+
## Fee sponsoring
|
|
36
|
+
|
|
37
|
+
The caller builds, the server pays. Needs `@odatano/nightgate-tx` next to the
|
|
38
|
+
server and `NIGHTGATE_SEED_HEX`; the contract state is read through the API.
|
|
39
|
+
|
|
40
|
+
1. `build_sponsorable_transaction` builds, proves and signs the call locally
|
|
41
|
+
and returns a `txId`. The bytes never travel as a tool argument.
|
|
42
|
+
2. `sponsor_unbound_transaction` with the `txId`, or with `file` for bytes
|
|
43
|
+
built elsewhere; the server's sponsor pool pays and submits.
|
|
44
|
+
3. `get_job_status` with the returned `sessionId`, then `verify_attestation`.
|
|
45
|
+
|
|
46
|
+
`failed` / `CHAIN_EXECUTION_FAILED`: landed but not applied; build again, never
|
|
47
|
+
resubmit the same bytes.
|
|
48
|
+
|
|
49
|
+
## Shielded swaps
|
|
50
|
+
|
|
51
|
+
Two wallets exchange two shielded tokens without a contract. Each side builds
|
|
52
|
+
one half, the halves mirror each other, a sponsor merges them and pays the fee.
|
|
53
|
+
Needs `@odatano/nightgate-tx` next to the server, `NIGHTGATE_SEED_HEX` and a
|
|
54
|
+
Midnight indexer the swap wallet syncs its coins from (`NIGHTGATE_INDEXER_HTTP_URL`,
|
|
55
|
+
`NIGHTGATE_INDEXER_WS_URL`).
|
|
56
|
+
|
|
57
|
+
1. `get_swap_wallet`: balance, free coins and `spendable` per token type. The
|
|
58
|
+
first call starts the sync of the shielded coins (about 5 minutes from
|
|
59
|
+
genesis, seconds with `NIGHTGATE_SWAP_STATE_FILE`).
|
|
60
|
+
2. Maker: `build_swap_offer` with `give` and `want` returns the offer file
|
|
61
|
+
(`swapoffer1...`) to publish, or `post_swap_offer` puts it on the server's
|
|
62
|
+
board.
|
|
63
|
+
3. Taker: `list_swap_offers` or `read_swap_offer`, then `take_swap_offer` with
|
|
64
|
+
`expect`, `submit: true` and, for a board entry, its `offerId`. It builds
|
|
65
|
+
the mirror half and submits both; the server's sponsor pool pays.
|
|
66
|
+
4. `get_job_status` with the returned `sessionId`; the result carries `swap`.
|
|
67
|
+
The maker follows the offer with `get_swap_offer` or `my_swap_offers`
|
|
68
|
+
(`filled` + `filledTxHash`); `list_swap_offers` with `status: all` and
|
|
69
|
+
`since` is the board's change feed.
|
|
70
|
+
|
|
71
|
+
- One half spends at most `NIGHTGATE_SWAP_MAX_INPUTS` coins, the smallest that
|
|
72
|
+
fit. `give.amount` above `spendable` is refused before proving.
|
|
73
|
+
- An offer fills once. Its coins stay reserved in the maker's wallet until the
|
|
74
|
+
swap lands or `revert_swap_offer` releases them.
|
|
75
|
+
- A refused submission keeps the proven half: `sponsor_swap` with its `halfId`.
|
|
76
|
+
- The sponsor needs swaps switched on and both token types on its list; an
|
|
77
|
+
agent grant needs `sponsorSwap` in `allowedActions`.
|
|
78
|
+
- With `NIGHTGATE_PROOF_SERVER_URL` the proof server sees the coins a half
|
|
79
|
+
spends: use one you run yourself.
|
|
80
|
+
- Tokens to swap: `mint_token` mints on a token factory to this wallet, or to
|
|
81
|
+
any wallet whose two keys are given. Without a `sessionId` the seed is the
|
|
82
|
+
issuer, the mint is built here and the sponsor pays; this needs
|
|
83
|
+
`@odatano/contract-token-factory` next to `@odatano/nightgate-tx`. A landed
|
|
84
|
+
mint makes the type known to the sponsor.
|
|
85
|
+
- `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.
|
|
3
|
+
"version": "0.14.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.
|
|
54
|
+
"@odatano/nightgate-tx": ">=0.14.0"
|
|
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.
|
|
66
|
+
"@odatano/nightgate-tx": "^0.14.0",
|
|
66
67
|
"@types/node": "^20.0.0",
|
|
67
68
|
"typescript": "^5.5.0"
|
|
68
69
|
}
|