@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.
- package/LICENSE +178 -0
- package/README.md +180 -0
- package/dist/client.d.ts +60 -0
- package/dist/client.js +177 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +36 -0
- package/dist/config.js +40 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/output.d.ts +20 -0
- package/dist/output.js +45 -0
- package/dist/output.js.map +1 -0
- package/dist/schemas.d.ts +37 -0
- package/dist/schemas.js +76 -0
- package/dist/schemas.js.map +1 -0
- package/dist/server.d.ts +17 -0
- package/dist/server.js +27 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/build.d.ts +3 -0
- package/dist/tools/build.js +208 -0
- package/dist/tools/build.js.map +1 -0
- package/dist/tools/index.d.ts +11 -0
- package/dist/tools/index.js +23 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/indexer.d.ts +3 -0
- package/dist/tools/indexer.js +30 -0
- package/dist/tools/indexer.js.map +1 -0
- package/dist/tools/query.d.ts +12 -0
- package/dist/tools/query.js +98 -0
- package/dist/tools/query.js.map +1 -0
- package/dist/tools/read.d.ts +9 -0
- package/dist/tools/read.js +173 -0
- package/dist/tools/read.js.map +1 -0
- package/dist/tools/shared.d.ts +31 -0
- package/dist/tools/shared.js +42 -0
- package/dist/tools/shared.js.map +1 -0
- package/dist/tools/sign.d.ts +3 -0
- package/dist/tools/sign.js +120 -0
- package/dist/tools/sign.js.map +1 -0
- package/dist/tools/worker.d.ts +3 -0
- package/dist/tools/worker.js +60 -0
- package/dist/tools/worker.js.map +1 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
Copyright [2026] [Max Weber]
|
|
177
|
+
|
|
178
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# @odatano/core-mcp
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@odatano/core-mcp)
|
|
4
|
+
[](https://www.npmjs.com/package/@odatano/core-mcp)
|
|
5
|
+
[](https://www.npmjs.com/package/@odatano/core)
|
|
6
|
+
[](https://modelcontextprotocol.io/)
|
|
7
|
+
[](https://nodejs.org/)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
|
|
10
|
+
MCP server that lets AI agents use [ODATANO](https://github.com/ODATANO/ODATANO),
|
|
11
|
+
the Cardano OData bridge for SAP CAP: read chain, address, UTxO, asset,
|
|
12
|
+
staking and governance data; query the indexer with OData `$filter`; build
|
|
13
|
+
**unsigned** transactions (ADA, metadata, multi-asset, mint, Plutus V3 spend);
|
|
14
|
+
hand them to a human / wallet for signing; verify signatures; submit signed
|
|
15
|
+
CBOR; poll confirmations. Sibling of
|
|
16
|
+
[NIGHTGATE-MCP](https://github.com/ODATANO/NIGHTGATE-MCP) (Midnight).
|
|
17
|
+
|
|
18
|
+
The agent gets a **notary, not a wallet**: nothing in this server can sign.
|
|
19
|
+
HSM signing (`SignWithHsm*`) and every Admin operation (crawler / worker
|
|
20
|
+
pause & resume) are deliberately not exposed. Wallet-worker jobs (ODATANO
|
|
21
|
+
2.0, server-managed wallets) are opt-in.
|
|
22
|
+
|
|
23
|
+
## Requirements
|
|
24
|
+
|
|
25
|
+
- Node.js >= 20
|
|
26
|
+
- A running ODATANO host (`@odatano/core` >= 1.11.0; the worker / indexer
|
|
27
|
+
tools appear automatically on >= 2.0.0-rc.1)
|
|
28
|
+
|
|
29
|
+
## Getting an ODATANO instance
|
|
30
|
+
|
|
31
|
+
The fastest way is the official Docker image (published from the ODATANO
|
|
32
|
+
repo on every release; details in its `docs/guides/DOCKER_DEPLOYMENT.md`):
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
docker run -d --name odatano -p 4004:4004 \
|
|
36
|
+
-e NETWORK=preview \
|
|
37
|
+
-e BACKENDS=blockfrost,koios \
|
|
38
|
+
-e BLOCKFROST_API_KEY=preview_xxx \
|
|
39
|
+
ghcr.io/odatano/odatano:latest
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Alternatively any CAP app using the `@odatano/core` plugin works
|
|
43
|
+
(`npm i @odatano/core @cap-js/sqlite`, add `cds.requires.odatano-core`,
|
|
44
|
+
`cds watch`), e.g. the ODATANO repo itself.
|
|
45
|
+
|
|
46
|
+
## Setup
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npm install
|
|
50
|
+
npm run build
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Configuration is environment-driven:
|
|
54
|
+
|
|
55
|
+
| Variable | Default | Purpose |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| `ODATANO_BASE_URL` | `http://localhost:4004` | ODATANO host app |
|
|
58
|
+
| `ODATANO_USERNAME` / `ODATANO_PASSWORD` | unset | Basic auth (CAP mocked/dev auth, e.g. `alice`) |
|
|
59
|
+
| `ODATANO_TOKEN` | unset | Bearer JWT (XSUAA / `auth: jwt`); an `odat_…` value is reserved for the planned ODATANO agent-grant token (sent as `x-agent-token`) |
|
|
60
|
+
| `ODATANO_SERVICE_PREFIX` | `/odata/v4` | Prefix before `cardano-odata`, `cardano-transaction`, `cardano-sign`, `cardano-worker`, `cardano-indexer` |
|
|
61
|
+
| `ODATANO_TIMEOUT_MS` | `30000` | Per-request timeout |
|
|
62
|
+
| `ODATANO_MCP_MAX_ROWS` | `50` | Default `$top` for `query_entity` and cap on arrays in tool output |
|
|
63
|
+
| `ODATANO_MCP_ENABLE_WALLET_JOBS` | `false` | Register `submit_wallet_job` / `cancel_wallet_job` (server-managed wallets sign — see below) |
|
|
64
|
+
|
|
65
|
+
At startup the server probes `<prefix>/cardano-worker/$metadata` and
|
|
66
|
+
`<prefix>/cardano-indexer/$metadata`; the 2.0 tools are registered only when
|
|
67
|
+
those services exist, so a 1.x host gets a clean 36-tool catalogue.
|
|
68
|
+
|
|
69
|
+
## Use with Claude Code
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
claude mcp add odatano \
|
|
73
|
+
--env ODATANO_BASE_URL=http://localhost:4004 \
|
|
74
|
+
--env ODATANO_USERNAME=alice \
|
|
75
|
+
-- npx -y @odatano/core-mcp
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Or in a project `.mcp.json`:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"mcpServers": {
|
|
83
|
+
"odatano": {
|
|
84
|
+
"command": "npx",
|
|
85
|
+
"args": ["-y", "@odatano/core-mcp"],
|
|
86
|
+
"env": {
|
|
87
|
+
"ODATANO_BASE_URL": "http://localhost:4004",
|
|
88
|
+
"ODATANO_USERNAME": "alice"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Tools
|
|
96
|
+
|
|
97
|
+
### Read (`CardanoODataService`)
|
|
98
|
+
|
|
99
|
+
| Tool | What it does |
|
|
100
|
+
|---|---|
|
|
101
|
+
| `get_network_info` | Host network (mainnet / preview / preprod), tip, backend health — call first |
|
|
102
|
+
| `get_latest_block` / `get_block` | Latest block / block by hash |
|
|
103
|
+
| `get_epoch` | Epoch by number, or the current one |
|
|
104
|
+
| `get_protocol_parameters` | Ledger protocol parameters (fees, min-UTxO, cost models, …) |
|
|
105
|
+
| `get_transaction` | Transaction by hash, optionally with resolved inputs/outputs |
|
|
106
|
+
| `get_transaction_metadata` | Metadata entries (CIP-20, label-1447, CIP-25, …) |
|
|
107
|
+
| `parse_transaction_cbor` | Decode signed/unsigned CBOR — pure, no network |
|
|
108
|
+
| `get_address` / `get_utxos` / `get_address_assets` / `get_address_transactions` | Address balance, UTxOs (by address or payment credential), assets, recent txs |
|
|
109
|
+
| `get_asset_info` / `get_asset_history` | Native asset supply + CIP-25/26 metadata, mint/burn history |
|
|
110
|
+
| `get_account` / `get_pool` / `get_drep` | Stake account, stake pool, governance DRep |
|
|
111
|
+
| `query_entity` | Generic OData query (`$filter/$select/$expand/$orderby/$top/$skip/$count`) over the indexer entity sets — the way to use the 2.0 crawler pre-sync |
|
|
112
|
+
|
|
113
|
+
Lookups return `{ found: false }` as a clean negative instead of an error.
|
|
114
|
+
|
|
115
|
+
### Build — unsigned (`CardanoTransactionService`)
|
|
116
|
+
|
|
117
|
+
| Tool | What it does |
|
|
118
|
+
|---|---|
|
|
119
|
+
| `build_ada_transfer` | ADA transfer, optional assets / inline datum / lock at script address / CIP-33 ref script |
|
|
120
|
+
| `build_metadata_transaction` | Transfer carrying transaction metadata (anchoring) |
|
|
121
|
+
| `build_multi_asset_transfer` | Native assets + ADA to one recipient |
|
|
122
|
+
| `build_mint_transaction` | Mint / burn under a Plutus V3 policy (params, required signers, ref inputs, metadata, `__INPUT_IDX__` placeholders) |
|
|
123
|
+
| `build_plutus_spend` | Spend a script UTxO: validator + redeemer, continuing datum, extra outputs, combined mint |
|
|
124
|
+
| `set_collateral` | Ensure an ADA-only collateral UTxO exists (self-send build if not) |
|
|
125
|
+
| `get_build_details` / `list_builds_by_address` | Re-fetch a build / build audit trail |
|
|
126
|
+
| `derive_script_address` / `extract_payment_key_hash` | Pure utilities |
|
|
127
|
+
|
|
128
|
+
Every build returns `{ id, unsignedTxCbor, fee, … }` — **nothing is signed or submitted**.
|
|
129
|
+
|
|
130
|
+
### Sign handoff, verify, submit (`CardanoSignService` / `CardanoTransactionService`)
|
|
131
|
+
|
|
132
|
+
| Tool | What it does |
|
|
133
|
+
|---|---|
|
|
134
|
+
| `create_signing_request` | Build → signing request with instructions + `cardano-cli` command for the human / wallet |
|
|
135
|
+
| `get_signing_request` / `list_signing_requests` | State: `pending → verified → submitted` |
|
|
136
|
+
| `verify_signature` | Check a signed CBOR against its request (required signers, fee payer) — no submit |
|
|
137
|
+
| `verify_data_signature` | CIP-30 `signData` (COSE_Sign1) verification for wallet login / consent |
|
|
138
|
+
| `submit_signed_transaction` | Submit already-signed CBOR (by `buildId`, or raw + `network`); duplicate → `alreadySubmitted: true` |
|
|
139
|
+
| `submit_verified_transaction` | Verify + submit for a signing request (`deferSubmit` supported) |
|
|
140
|
+
| `get_submission_status` | Submission state, optionally re-checking the chain |
|
|
141
|
+
|
|
142
|
+
### ODATANO 2.0 (registered when the host serves them)
|
|
143
|
+
|
|
144
|
+
| Tool | What it does |
|
|
145
|
+
|---|---|
|
|
146
|
+
| `get_sync_status` / `get_reorg_log` | Crawler / pre-sync status and reorg history (`CardanoIndexerService`) |
|
|
147
|
+
| `get_worker_status` / `get_wallet_job_status` | Wallet-worker status and job polling (`CardanoWorkerService`) |
|
|
148
|
+
| `submit_wallet_job` / `cancel_wallet_job` | **Opt-in** (`ODATANO_MCP_ENABLE_WALLET_JOBS=1`): queue a job that a server-managed wallet builds, signs, submits and confirms — this moves funds; use with a scoped credential only |
|
|
149
|
+
|
|
150
|
+
## Errors
|
|
151
|
+
|
|
152
|
+
Upstream OData errors are returned as tool errors with
|
|
153
|
+
`{ httpStatus, code, message }` (`ODATANO_INVALID_INPUT`, `ODATANO_NOT_FOUND`,
|
|
154
|
+
`ODATANO_INSUFFICIENT_FUNDS`, `ODATANO_TX_VALIDATION_FAILED`,
|
|
155
|
+
`ODATANO_PROVIDER_UNAVAILABLE`, `ODATANO_PROVIDER_RATE_LIMITED`, …) so the
|
|
156
|
+
agent can react (401 → credentials, 429 → back off, 400 → fix arguments).
|
|
157
|
+
Long arrays are capped at `ODATANO_MCP_MAX_ROWS` and large CBOR blobs nested
|
|
158
|
+
in results are elided (the tools whose job is returning CBOR keep it).
|
|
159
|
+
|
|
160
|
+
## Integration check
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
npm run integration
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Runs an in-memory MCP client against the server: asserts the tool sets per
|
|
167
|
+
capability, schemas, and that invalid arguments are rejected before any HTTP
|
|
168
|
+
call. Optional live round-trip on preview (reads only; add
|
|
169
|
+
`ODATANO_TEST_BUILD=1` for one unsigned build that is parsed, never submitted):
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
ODATANO_LIVE=1 ODATANO_BASE_URL=http://localhost:4004 ODATANO_USERNAME=alice \
|
|
173
|
+
npm run integration
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Unit tests: `npm test`.
|
|
177
|
+
|
|
178
|
+
## License
|
|
179
|
+
|
|
180
|
+
Apache-2.0
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type OdatanoMcpConfig, type ServiceKey } from './config.js';
|
|
2
|
+
/** Error carrying the OData error body of a failed ODATANO call. */
|
|
3
|
+
export declare class OdatanoApiError extends Error {
|
|
4
|
+
readonly status: number;
|
|
5
|
+
readonly code: string | undefined;
|
|
6
|
+
constructor(status: number, code: string | undefined, message: string);
|
|
7
|
+
}
|
|
8
|
+
/** OData system query options accepted by {@link OdatanoClient.queryEntity}. */
|
|
9
|
+
export interface EntityQuery {
|
|
10
|
+
filter?: string;
|
|
11
|
+
select?: string;
|
|
12
|
+
expand?: string;
|
|
13
|
+
orderby?: string;
|
|
14
|
+
top?: number;
|
|
15
|
+
skip?: number;
|
|
16
|
+
count?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Minimal OData V4 client for the ODATANO services. Three verbs:
|
|
20
|
+
* - unbound actions (POST, JSON body) — all ODATANO read/build/sign operations
|
|
21
|
+
* - unbound functions (GET, parameters inline) — the two v2.0 status functions
|
|
22
|
+
* - entity reads (GET with $filter/$select/... ) — the generic query tool
|
|
23
|
+
* plus a bound action on a single entity (CheckSubmissionStatus).
|
|
24
|
+
*/
|
|
25
|
+
export declare class OdatanoClient {
|
|
26
|
+
private readonly config;
|
|
27
|
+
constructor(config: OdatanoMcpConfig);
|
|
28
|
+
serviceUrl(service: ServiceKey): string;
|
|
29
|
+
/** POST <service>/<name> with the provided parameters as JSON body (undefined dropped). */
|
|
30
|
+
callAction(service: ServiceKey, name: string, params?: Record<string, unknown>): Promise<unknown>;
|
|
31
|
+
/** POST <service>/<Entity>(<key>)/<Service>.<name> — bound action on one entity. */
|
|
32
|
+
callBoundAction(service: ServiceKey, entity: string, key: string, qualifiedName: string, params?: Record<string, unknown>): Promise<unknown>;
|
|
33
|
+
/** GET <service>/<name>(p1=...,p2=...) with only the provided parameters. */
|
|
34
|
+
callFunction(service: ServiceKey, name: string, params?: Record<string, string | number | undefined>): Promise<unknown>;
|
|
35
|
+
/** GET <service>/<Entity>?$filter=...&$top=... — returns the raw OData collection payload. */
|
|
36
|
+
queryEntity(service: ServiceKey, entity: string, query?: EntityQuery): Promise<unknown>;
|
|
37
|
+
/** GET <service>/<Entity>(<key>) — single entity by key. */
|
|
38
|
+
readEntity(service: ServiceKey, entity: string, key: string, expand?: string): Promise<unknown>;
|
|
39
|
+
/**
|
|
40
|
+
* Cheap capability probe: does `<service>/$metadata` answer 200? Used at
|
|
41
|
+
* startup to register the v2.0 worker/indexer tools only when the host
|
|
42
|
+
* actually serves them.
|
|
43
|
+
*/
|
|
44
|
+
serviceExists(service: ServiceKey): Promise<boolean>;
|
|
45
|
+
private headers;
|
|
46
|
+
private request;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Encode a JS value as an OData URL literal: numbers and Edm.Guid keys are
|
|
50
|
+
* unquoted, everything else is a quoted string with '' escaping.
|
|
51
|
+
*/
|
|
52
|
+
export declare function odataLiteral(value: string | number): string;
|
|
53
|
+
/** Build the `?$filter=...` query string; only provided options are emitted. */
|
|
54
|
+
export declare function buildQueryString(query: EntityQuery): string;
|
|
55
|
+
/**
|
|
56
|
+
* Drop @odata.* metadata keys so tool output stays clean for the model.
|
|
57
|
+
* `@odata.count` on a collection is preserved as `count`; the `value`
|
|
58
|
+
* array of a collection response is kept as-is (trimming happens later).
|
|
59
|
+
*/
|
|
60
|
+
export declare function stripODataNoise(payload: unknown): unknown;
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { SERVICES } from './config.js';
|
|
2
|
+
/** Error carrying the OData error body of a failed ODATANO call. */
|
|
3
|
+
export class OdatanoApiError extends Error {
|
|
4
|
+
status;
|
|
5
|
+
code;
|
|
6
|
+
constructor(status, code, message) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.status = status;
|
|
9
|
+
this.code = code;
|
|
10
|
+
this.name = 'OdatanoApiError';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Minimal OData V4 client for the ODATANO services. Three verbs:
|
|
15
|
+
* - unbound actions (POST, JSON body) — all ODATANO read/build/sign operations
|
|
16
|
+
* - unbound functions (GET, parameters inline) — the two v2.0 status functions
|
|
17
|
+
* - entity reads (GET with $filter/$select/... ) — the generic query tool
|
|
18
|
+
* plus a bound action on a single entity (CheckSubmissionStatus).
|
|
19
|
+
*/
|
|
20
|
+
export class OdatanoClient {
|
|
21
|
+
config;
|
|
22
|
+
constructor(config) {
|
|
23
|
+
this.config = config;
|
|
24
|
+
}
|
|
25
|
+
serviceUrl(service) {
|
|
26
|
+
return `${this.config.baseUrl}${this.config.servicePrefix}/${SERVICES[service]}`;
|
|
27
|
+
}
|
|
28
|
+
/** POST <service>/<name> with the provided parameters as JSON body (undefined dropped). */
|
|
29
|
+
async callAction(service, name, params = {}) {
|
|
30
|
+
const body = {};
|
|
31
|
+
for (const [key, value] of Object.entries(params)) {
|
|
32
|
+
if (value === undefined)
|
|
33
|
+
continue;
|
|
34
|
+
body[key] = value;
|
|
35
|
+
}
|
|
36
|
+
return this.request('POST', `${this.serviceUrl(service)}/${name}`, body);
|
|
37
|
+
}
|
|
38
|
+
/** POST <service>/<Entity>(<key>)/<Service>.<name> — bound action on one entity. */
|
|
39
|
+
async callBoundAction(service, entity, key, qualifiedName, params = {}) {
|
|
40
|
+
const url = `${this.serviceUrl(service)}/${entity}(${odataLiteral(key)})/${qualifiedName}`;
|
|
41
|
+
return this.request('POST', url, params);
|
|
42
|
+
}
|
|
43
|
+
/** GET <service>/<name>(p1=...,p2=...) with only the provided parameters. */
|
|
44
|
+
async callFunction(service, name, params = {}) {
|
|
45
|
+
const parts = [];
|
|
46
|
+
for (const [key, value] of Object.entries(params)) {
|
|
47
|
+
if (value === undefined || value === null || value === '')
|
|
48
|
+
continue;
|
|
49
|
+
parts.push(`${key}=${odataLiteral(value)}`);
|
|
50
|
+
}
|
|
51
|
+
return this.request('GET', `${this.serviceUrl(service)}/${name}(${parts.join(',')})`);
|
|
52
|
+
}
|
|
53
|
+
/** GET <service>/<Entity>?$filter=...&$top=... — returns the raw OData collection payload. */
|
|
54
|
+
async queryEntity(service, entity, query = {}) {
|
|
55
|
+
const qs = buildQueryString(query);
|
|
56
|
+
return this.request('GET', `${this.serviceUrl(service)}/${entity}${qs}`);
|
|
57
|
+
}
|
|
58
|
+
/** GET <service>/<Entity>(<key>) — single entity by key. */
|
|
59
|
+
async readEntity(service, entity, key, expand) {
|
|
60
|
+
const qs = expand ? `?$expand=${encodeURIComponent(expand)}` : '';
|
|
61
|
+
return this.request('GET', `${this.serviceUrl(service)}/${entity}(${odataLiteral(key)})${qs}`);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Cheap capability probe: does `<service>/$metadata` answer 200? Used at
|
|
65
|
+
* startup to register the v2.0 worker/indexer tools only when the host
|
|
66
|
+
* actually serves them.
|
|
67
|
+
*/
|
|
68
|
+
async serviceExists(service) {
|
|
69
|
+
try {
|
|
70
|
+
const response = await fetch(`${this.serviceUrl(service)}/$metadata`, {
|
|
71
|
+
method: 'GET',
|
|
72
|
+
headers: this.headers(),
|
|
73
|
+
signal: AbortSignal.timeout(Math.min(this.config.timeoutMs, 10000)),
|
|
74
|
+
});
|
|
75
|
+
// Consume the body so the socket is released.
|
|
76
|
+
await response.arrayBuffer().catch(() => undefined);
|
|
77
|
+
return response.ok;
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
headers(hasBody = false) {
|
|
84
|
+
const headers = { Accept: 'application/json' };
|
|
85
|
+
const basic = this.config.username
|
|
86
|
+
? `Basic ${Buffer.from(`${this.config.username}:${this.config.password ?? ''}`).toString('base64')}`
|
|
87
|
+
: undefined;
|
|
88
|
+
if (this.config.token?.startsWith('odat_')) {
|
|
89
|
+
// Reserved for the ODATANO agent-grant token: travels in its own header
|
|
90
|
+
// so it never collides with the host app's transport auth.
|
|
91
|
+
headers['x-agent-token'] = this.config.token;
|
|
92
|
+
if (basic)
|
|
93
|
+
headers.Authorization = basic;
|
|
94
|
+
}
|
|
95
|
+
else if (this.config.token) {
|
|
96
|
+
headers.Authorization = `Bearer ${this.config.token}`;
|
|
97
|
+
}
|
|
98
|
+
else if (basic) {
|
|
99
|
+
headers.Authorization = basic;
|
|
100
|
+
}
|
|
101
|
+
if (hasBody)
|
|
102
|
+
headers['Content-Type'] = 'application/json';
|
|
103
|
+
return headers;
|
|
104
|
+
}
|
|
105
|
+
async request(method, url, body) {
|
|
106
|
+
const response = await fetch(url, {
|
|
107
|
+
method,
|
|
108
|
+
headers: this.headers(body !== undefined),
|
|
109
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
110
|
+
signal: AbortSignal.timeout(this.config.timeoutMs),
|
|
111
|
+
});
|
|
112
|
+
const text = await response.text();
|
|
113
|
+
let payload;
|
|
114
|
+
try {
|
|
115
|
+
payload = text ? JSON.parse(text) : {};
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
payload = { raw: text };
|
|
119
|
+
}
|
|
120
|
+
if (!response.ok) {
|
|
121
|
+
const err = payload.error;
|
|
122
|
+
throw new OdatanoApiError(response.status, err?.code, err?.message ?? `ODATANO request failed with HTTP ${response.status}`);
|
|
123
|
+
}
|
|
124
|
+
return stripODataNoise(payload);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
128
|
+
/**
|
|
129
|
+
* Encode a JS value as an OData URL literal: numbers and Edm.Guid keys are
|
|
130
|
+
* unquoted, everything else is a quoted string with '' escaping.
|
|
131
|
+
*/
|
|
132
|
+
export function odataLiteral(value) {
|
|
133
|
+
if (typeof value === 'number')
|
|
134
|
+
return String(value);
|
|
135
|
+
if (UUID_RE.test(value))
|
|
136
|
+
return value.toLowerCase();
|
|
137
|
+
return `'${value.replace(/'/g, "''")}'`;
|
|
138
|
+
}
|
|
139
|
+
/** Build the `?$filter=...` query string; only provided options are emitted. */
|
|
140
|
+
export function buildQueryString(query) {
|
|
141
|
+
const parts = [];
|
|
142
|
+
const add = (name, value) => {
|
|
143
|
+
if (value === undefined || value === '')
|
|
144
|
+
return;
|
|
145
|
+
parts.push(`$${name}=${encodeURIComponent(String(value))}`);
|
|
146
|
+
};
|
|
147
|
+
add('filter', query.filter);
|
|
148
|
+
add('select', query.select);
|
|
149
|
+
add('expand', query.expand);
|
|
150
|
+
add('orderby', query.orderby);
|
|
151
|
+
add('top', query.top);
|
|
152
|
+
add('skip', query.skip);
|
|
153
|
+
if (query.count)
|
|
154
|
+
add('count', 'true');
|
|
155
|
+
return parts.length ? `?${parts.join('&')}` : '';
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Drop @odata.* metadata keys so tool output stays clean for the model.
|
|
159
|
+
* `@odata.count` on a collection is preserved as `count`; the `value`
|
|
160
|
+
* array of a collection response is kept as-is (trimming happens later).
|
|
161
|
+
*/
|
|
162
|
+
export function stripODataNoise(payload) {
|
|
163
|
+
if (payload === null || typeof payload !== 'object' || Array.isArray(payload))
|
|
164
|
+
return payload;
|
|
165
|
+
const out = {};
|
|
166
|
+
for (const [key, value] of Object.entries(payload)) {
|
|
167
|
+
if (key === '@odata.count') {
|
|
168
|
+
out.count = value;
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
if (key.startsWith('@odata'))
|
|
172
|
+
continue;
|
|
173
|
+
out[key] = value;
|
|
174
|
+
}
|
|
175
|
+
return out;
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA0C,MAAM,aAAa,CAAC;AAE/E,oEAAoE;AACpE,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAEtB;IACA;IAFlB,YACkB,MAAc,EACd,IAAwB,EACxC,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAoB;QAIxC,IAAI,CAAC,IAAI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KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACnD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IAC9F,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAkC,CAAC,EAAE,CAAC;QAC9E,IAAI,GAAG,KAAK,cAAc,EAAE,CAAC;YAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;YAAC,SAAS;QAAC,CAAC;QAC5D,IAAI,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC;YAAE,SAAS;QACvC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACnB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server configuration, environment-driven so the same binary works for
|
|
3
|
+
* local dev (CAP mocked auth against a `cds watch` instance) and for a
|
|
4
|
+
* deployed ODATANO behind XSUAA / a reverse proxy (bearer token).
|
|
5
|
+
*/
|
|
6
|
+
export interface OdatanoMcpConfig {
|
|
7
|
+
/** Base URL of the ODATANO host app, e.g. http://localhost:4004 */
|
|
8
|
+
baseUrl: string;
|
|
9
|
+
/**
|
|
10
|
+
* Token credential. An `odat_...` value is reserved for the planned ODATANO
|
|
11
|
+
* agent-grant token (sent as `x-agent-token`, optionally alongside basic
|
|
12
|
+
* transport auth); anything else is sent as `Authorization: Bearer`.
|
|
13
|
+
*/
|
|
14
|
+
token?: string;
|
|
15
|
+
/** Basic-auth credentials for CAP mocked/dev auth (e.g. `alice`). */
|
|
16
|
+
username?: string;
|
|
17
|
+
password?: string;
|
|
18
|
+
/** Prefix in front of the service names, default `/odata/v4`. */
|
|
19
|
+
servicePrefix: string;
|
|
20
|
+
/** Request timeout in milliseconds. */
|
|
21
|
+
timeoutMs: number;
|
|
22
|
+
/** Default `$top` for query tools and cap for arrays in tool output. */
|
|
23
|
+
maxRows: number;
|
|
24
|
+
/** Register the wallet-worker write tools (submit_wallet_job / cancel_wallet_job). */
|
|
25
|
+
enableWalletJobs: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** ODATANO service names (path segments after the prefix). */
|
|
28
|
+
export declare const SERVICES: {
|
|
29
|
+
readonly odata: "cardano-odata";
|
|
30
|
+
readonly transaction: "cardano-transaction";
|
|
31
|
+
readonly sign: "cardano-sign";
|
|
32
|
+
readonly worker: "cardano-worker";
|
|
33
|
+
readonly indexer: "cardano-indexer";
|
|
34
|
+
};
|
|
35
|
+
export type ServiceKey = keyof typeof SERVICES;
|
|
36
|
+
export declare function loadConfig(env?: NodeJS.ProcessEnv): OdatanoMcpConfig;
|