MCP servers for AI agents
Two Model Context Protocol servers put both chains in front of an agent. @odatano/core-mcp reads Cardano, queries the indexer with OData, builds unsigned transactions and submits signed CBOR. @odatano/nightgate-mcp anchors documents on Midnight, proves zero-knowledge claims over hidden fields, swaps and mints shielded tokens, and verifies against live contract state. Both carry the ANALYTICS tools for their chain.
Neither server gets operator rights. HSM signing, server wallets, contract deployment and every admin operation are not exposed. On Cardano every build comes back unsigned and a human or a CIP-30 wallet signs. On Midnight the server builds, proves and signs locally with the agent’s own seed, and a sponsor pays the fee. The agent holds no NIGHT.
Set-up
One oda_… key from the API page configures both servers. Needs Node.js 20 or newer; npx fetches the servers.
{
"mcpServers": {
"odatano": {
"command": "npx",
"args": ["-y", "@odatano/core-mcp"],
"env": { "ODATANO_ACCESS_KEY": "oda_..." }
},
"nightgate": {
"command": "npx",
"args": ["-y", "@odatano/nightgate-mcp"],
"env": { "ODATANO_ACCESS_KEY": "oda_..." }
}
}
}
With Claude Code:
claude mcp add odatano --env ODATANO_ACCESS_KEY=oda_... -- npx -y @odatano/core-mcp
claude mcp add nightgate --env ODATANO_ACCESS_KEY=oda_... -- npx -y @odatano/nightgate-mcp
The hosted API is the default URL. It meters the key per call and answers a 402 with the top-up hint when calls run out.
Shared configuration
| Variable | Default | Purpose |
|---|---|---|
ODATANO_ACCESS_KEY | the oda_… key. Against a direct instance: an odat_… or ngat_… agent grant, or any other bearer | |
ODATANO_ACCESS_URL | https://api.preprod.odatano.dev | the API, or your own instance, e.g. http://localhost:4004 |
ODATANO_ACCESS_USER, ODATANO_ACCESS_PASSWORD | basic auth against a dev instance with CAP mocked auth | |
ODATANO_ANALYTICS_URL | <ODATANO_ACCESS_URL>/odata/v4/analytics | where ANALYTICS answers; the analytics_* tools register when it does |
Per-server variables (timeouts, row caps, service paths, the Midnight seed and network) are in the READMEs linked below.
ODATANO-MCP (Cardano)
34 tools, plus 10 analytics tools when the host serves ANALYTICS. The set is what an API key may call; operator tools are not part of it.
| Group | Tools | What |
|---|---|---|
| Read | get_network_info, get_latest_block, get_block, get_epoch, get_protocol_parameters, get_transaction, get_transaction_metadata, parse_transaction_cbor, get_address, get_utxos, get_address_assets, get_address_transactions, get_asset_info, get_asset_history, get_account, get_pool, get_drep | chain, address, asset, staking and governance lookups. A miss returns { found: false }, never an error |
| Query | query_entity | OData V4 over the 20 chain entity sets of the read service: $filter, $select, $expand, $orderby, $top, $skip, $count. Questions no fixed action covers become one call |
| Build | build_ada_transfer, build_metadata_transaction, build_multi_asset_transfer, build_mint_transaction, build_plutus_spend, set_collateral, get_build_details, derive_script_address, extract_payment_key_hash | every build returns { id, unsignedTxCbor, fee }. Nothing is signed |
| Sign and submit | create_signing_request, get_signing_request, verify_signature, verify_data_signature, submit_signed_transaction, submit_verified_transaction, get_submission_status | hand-off to a human or wallet, verification, submission of signed CBOR |
| Analytics | analytics_overview, analytics_key_figures, analytics_daily, analytics_top, analytics_epochs, analytics_metrics, analytics_metric, analytics_series, analytics_compare, analytics_anomalies | ANALYTICS for Cardano, one call each |
A typical flow:
get_network_info → get_utxos(address) → build_ada_transfer(...) nothing moved
parse_transaction_cbor show the human what they sign
create_signing_request instructions + cardano-cli command
… human or CIP-30 wallet signs …
verify_signature → submit_signed_transaction → get_submission_status
NIGHTGATE-MCP (Midnight)
28 tools, plus 9 analytics tools when the host serves ANALYTICS. Every write is built, proven and signed in the server with the agent’s seed, a sponsor pays the fee, and the tool waits until the transaction settled. Reads of contract state are free and answer verified: false when nothing is there, never an error.
| Group | Tools | What |
|---|---|---|
| Verify | verify_attestation, verify_predicate | a record or a zero-knowledge claim against live contract state. Free |
| Anchor and prove | prepare_document_proof, prepare_membership_set, anchor_document, submit_vault_call | salted content tree, set root, an anchor in one call; any vault call: claims over a hidden field, claims across two documents, disclosure |
| Sponsoring | build_sponsorable_transaction, get_attester_identity, sponsor_unbound_transaction, sponsor_finalized_transaction | build a vault call and keep the bytes for a sponsor elsewhere, or hand bytes built elsewhere to a sponsor |
| Swaps | get_swap_wallet, read_swap_offer, build_swap_offer, take_swap_offer, revert_swap_offer, sponsor_swap | one half of a shielded swap built locally, taken, released or sponsored |
| Offer board | post_swap_offer, list_swap_offers, retire_swap_offer, get_swap_offer, my_swap_offers, get_board_status | post a maker half, find open offers, follow fills. The board counts need no credentials |
| Tokens and contracts | mint_token, burn_token, send_token, call_contract, derive_token_type | mint a shielded token on a token factory with the seed as issuer, burn, pay another address, call a circuit of an installed contract package |
| Usage | get_usage | what the key has left and what each call cost. Free |
| Analytics | analytics_overview, analytics_key_figures, analytics_daily, analytics_top_block_producers, analytics_metrics, analytics_metric, analytics_series, analytics_compare, analytics_anomalies | ANALYTICS for Midnight, one call each |
With only ODATANO_ACCESS_KEY set, vault tools use the shared sandbox vault of the network. The first write creates the seed file ~/.nightgate-mcp/seed. It is the agent’s identity on Midnight: keep it and back it up.
A first anchor, and a claim over a hidden field:
anchor_document(sha256) → status, attesterId, txHash, check about a minute
verify_attestation(check) → verified: true free
prepare_document_proof → payloadHash, contentRoot, opening keep opening
anchor_document(payloadHash, contentRoot, schemaId)
submit_vault_call("proveFieldPredicate", merkleProof) e.g. carbon_footprint ≤ 80
verify_predicate(check) → verified: true free
Each MCP release names the NIGHTGATE version it needs. The configuration page on GitHub lists them.
Your own instance
Set ODATANO_ACCESS_URL to your ODATANO or NIGHTGATE host. For a local cds watch with mocked auth, ODATANO_ACCESS_USER=alice is enough. For anything else, create a scoped agent grant once as the operator and hand the returned odat_… or ngat_… token to the agent as ODATANO_ACCESS_KEY. The write tools are then limited to the grant’s allow list and budget.
The Docker images are the fastest way to an own instance: ghcr.io/odatano/odatano and ghcr.io/odatano/nightgate. See ODATANO and NIGHTGATE.
Errors
Upstream errors reach the agent as { httpStatus, code, message }, so it can react instead of failing blind: 401 means credentials, 400 means fix the arguments, 429 means back off, 402 means top up. A Midnight write that fails with CHAIN_EXECUTION_FAILED landed on chain but did not apply: run the tool again, it builds against the new state. A write that was cut off or came back pending picks up its own job when called again with the same arguments, so nothing is paid twice.
On GitHub
- ODATANO-CORE-MCP: every tool with its arguments, configuration, integration check · npm
- NIGHTGATE-MCP: every tool, what a write returns, seed, swaps, configuration · npm
- NIGHTGATE TX: the local builder behind the Midnight writes
- ANALYTICS: what the
analytics_*tools return