nanoodle-mcp
OfficialEnables keyless x402 payments for API calls using Nano cryptocurrency, with automatic signing and broadcasting of Nano send blocks through a Nano RPC node, plus proof-of-work handling and wallet management.
This server has a remotely hosted endpoint. Open its connector listing for connection details, authentication requirements, and setup instructions:
nanoodle-mcp
Build a multi-model media pipeline visually at nanoodle.com — then hand the whole pipeline to your agent as ONE typed tool.
Skill or MCP? Running (or designing) a single workflow? The nanoodle skill is one command and no setup. This server is for when you've built up a folder of saved graphs and want each one exposed to your agent as its own tool.
Point this MCP server at a folder of noodle-graph.json saves from the
nanoodle editor and every graph becomes a callable tool with a derived input
schema — in Claude Code, Grok, Claude Desktop, Cursor, VS Code, Windsurf, or
anything else that speaks the Model Context Protocol.
It speaks stdio to your own agent by default, or HTTP to everyone with
serve mode — including
charging per call in Nano, so strangers'
agents can pay to run your noodles with no account anywhere — or
selling runs for native NEAR, custom workflows included.
No middleman server, no telemetry — and with wallet mode,
no account either. The MCP implementation here is hand-rolled (stdio +
streamable HTTP, JSON-RPC 2.0 — small enough to read). Two runtime dependencies:
nanoodle (MIT), the zero-dep
workflow executor that does all the heavy lifting, and
nanocurrency (GPL-3.0) for
signing Nano blocks — loaded only on the x402 paths, see
Licensing. Your NanoGPT API key goes straight from your
machine to nano-gpt.com; it is never logged and never
appears on stdout.
NEAR HACKATHON entry
Built at NEAR HACKATHON (2026-11-01 to 2026-11-14), track
agents (Agent Economy). Only the NEAR integration described here is the entry; the rest
of this README documents the product it was added to.
What it is. nanoodle-mcp is an MCP server that runs nanoodle workflow graphs (multi-step pipelines of NanoGPT text, image, video, audio and 3D models) as tools. In the hackathon it gained a NEAR payment rail: an AI agent composes its own workflow, gets an itemized price for free, pays with one native NEAR transfer, receives the result, and gets the unused part of its deposit back on chain. A second piece, a worker for NEAR Agent Market, sells the same workflow runs as market jobs.
Problem. An agent that wants to run a paid multi-model pipeline needs an account and an API key at the provider, and cannot tell what a multi-step run will cost before it starts. A fixed price per call means the buyer overpays or the seller loses money on expensive runs.
How NEAR fits. NEAR carries the payment and the refund. The quote comes back inside
the MCP tool answer: a payment id, the receiving account, an exact yoctoNEAR amount and a
30-minute expiry. The agent sends one native Transfer. The server reads that transaction
from NEAR RPC at FINAL finality, checks the receiver, the exact amount, the single action,
the timing and that the hash was not used before, runs the workflow once, and signs a
refund transfer of the deposit minus the actual cost. Finality in 2–3 seconds and gas of
about 0.000045 NEAR per transfer make a deposit and refund per call practical. This is not
x402: there is no HTTP 402 and no facilitator, only an in-band MCP quote paid by a plain
transfer. Design and threat model: docs/near-payments.md.
How NanoUSD fits (in preparation — not live). A third, separate route at
nanusd.nanoodle.com will take NanoUSD (NANUSD): a USD-pegged asset on its own
Nano-protocol network (accounts start with usd_), issued by Nanswap against
USDC reserves — not a token on Nano, and not USDC. Its gate is an instance of
the shared payment route (src/pay/route-core.mjs) with its own adapter
(src/nanusd/), the same quote → settle → change lifecycle as the other
rails, with the rate locked at the 1:1 peg so no oracle is involved. Design:
docs/nanusd-payments.md.
Status.
Offline: the whole payment flow passes against a local NEAR chain stand-in and a local NanoGPT stand-in (35 checks), and the market worker passes against a local market stand-in that checks every request and answer against the market's OpenAPI file (30 checks).
Real testnet, read-only: the transaction checker and the server's own payment verifier read a real testnet transfer from public RPC and pass (step 4 below).
Live mainnet, verified 2026-11-13: connect to https://near.nanoodle.com/mcp. Quotes pay
nanoodle.near; the server detects the transfer, runs the workflow using the shared Nano funding pool, and sends unused NEAR back to the payer. A real 0.003192 NEAR payment was detected without submitting its hash, a text workflow succeeded, and 0.00318950963855421686747 NEAR was refunded at FINAL finality. All 13 payment/receipt/refund checks passed. Custom and saved workflows paid in NEAR and USDC also passed automatic discovery, execution, same-asset refund and replay; USDC verification includes the payment and refund transactions. The primary endpoint atmcp.nanoodle.comcontinues to default to Nano.Market: workers poll the live marketplace for five configured listings. Song, Image, Character and Clip are publicly visible; the custom-workflow profile is not verified published. Owner access is needed to finish that listing. No paid production hire has been verified in this check.
NEAR mode first ships in npm version 0.7.0. Until
npm view nanoodle-mcp versionshows 0.7.0 or later, run it from a clone as below.
Try it: do X, see Y. Node 22.23.5+, 24.22.3+ or 26.13.1+. Steps 1–3 need no network
after npm ci, and no keys or funds.
git clone -b near-hackathon https://github.com/nanoodlecom/nanoodle-mcp && cd nanoodle-mcp && npm ciDo | See |
1. | The real server binary starts in NEAR mode against local stand-ins. An agent prices a custom |
2. | The Agent Market worker runs as a child process against a local market stand-in: a normal job, an unsafe graph, an over-budget graph, a malformed brief, a kill and restart mid-run, and a lost submit answer. Ends |
3. | The full offline test suite. Ends with |
4. | Read-only, no keys. The payment rules the server applies (final, succeeded, receiver, one |
5. Real testnet payment and refund (maintainer-run; moves testnet NEAR, needs two funded testnet accounts and, for the last variant, a NanoGPT key) | Prove it on testnet: two scripts create the accounts, pay a quote, check the refund on chain and print explorer links. |
Built in the hackathon window, and before. The diff of the entry is
compare/pre-hackathon...near-hackathon
(branch near-hackathon). The pre-hackathon tag is the last commit on main before the
NEAR work (2026-11-06). Commits on main between the hackathon announcement (2026-10-19)
and that tag are Nano-payment and maintenance work; they are counted as baseline and not
claimed.
Before: the nanoodle workflow engine (
nanoodle) and this server: saved graphs as typed MCP tools, BYOK, pay per call in Nano (x402), serve mode, the hosted server, andrun_noodlefor share links.In the window:
src/near/: NEAR RPC client, payment verification, refund signing (ed25519 withnode:crypto, transactions serialized by hand), exact yoctoNEAR math, NEAR/USD rate, durable payment ledger.src/custom-workflow.mjs: the safety allowlist and itemized pricing for workflows an agent composes.src/near-gate.mjs: the NEAR payment gate,run_noodlewith an inlinegraph, the freeprice_noodleandnoodle_guidetools.src/market/andscripts/market-*: the NEAR Agent Market worker, its listing catalog and price check (docs/near-agent-market.md).scripts/near-simulate.mjs,scripts/near-check-tx.mjs,scripts/near-pay.mjs,scripts/near-testnet-*.mjs, the tests for all of the above, and the docs.src/near/rates.mjs: NEAR/USD, XNO/USD and the NEAR→XNO swap rate derived from them, an optional swap margin, background and forced refresh,GET /rates; receipts with three money legs (caller payment, model payment, refund) and per-call operator accounting in the ledger.src/rail-router.mjsandscripts/dual-simulate.mjs: one server that accepts Nano or NEAR per call (--charge-usdtogether with--near-merchant).
Declarations.
Baseline (own, pre-hackathon, MIT): the nanoodle engine and the nanoodle-mcp server.
Libraries: the two Node runtime dependencies predate the hackathon:
nanoodle(MIT, own) andnanocurrency(GPL-3.0, Nano signing; see Licensing). Server-side NEAR verification and signing use Node built-ins. The wallet payment page bundles NEAR Connect 0.12.0 (MIT, HOT Labs), with esbuild as a build tool; both are pinned development dependencies. See assets/README.md.AI-generated code: most of the code, tests and documentation in the hackathon diff were written with AI coding assistants, directed by the maintainer.
Other chains: the pre-existing product accepts payment in Nano (XNO) through x402. That is not part of the entry.
External services the NEAR code calls: public NEAR RPC (fastnear by default), CoinGecko for the NEAR/USD rate (can be pinned with
--near-usd), NanoGPT for the models, and, in the testnet scripts only, the NEAR testnet account helper.
Related MCP server: AgentTasker MCP Server
Example: a description becomes a playable fighter
Play Iron Verdict: a furnace knight with heavy jumps, punches, ground slams and punishing arena combat. A coding agent built the game using the character-sprites skill.
The character-sprites graph turns a humanoid description into a character
reference and a matching parts sheet. The skill's local rig script turns those
parts into transparent idle, walk, punch and jump frames with an atlas and
timing metadata. The coding agent then implements physics, combat and game
rules. The finished game demonstrates that combination; one MCP call returns
the reference and parts images, not the complete game.
Mount the character-sprites graph
in your server's graph folder to expose it as a tool. Use tools/list to check
whether a given server has it mounted and read its input schema before calling.
For the published graph, the generation step is:
{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"character-sprites","arguments":{"Character":"A compact furnace knight with an ivory helmet, amber visor, navy armor and brass gauntlets. Outlined 2D platformer art. No weapon or wings."}}}Install the skill for local extraction and animation (Node 22.23.5+, 24.22.3+, or 26.13.1+ and ffmpeg/ffprobe required). A useful agent request is: “Use character-sprites to make an animated fighter from my description, inspect the joints and alpha edges, then build a small playable arena with heavy gravity and impactful combat.”
Install
You need: Node 22.23.5+, 24.22.3+, or 26.13.1+, a folder of saved graphs (say ~/noodles — see
Making graphs), and a nano-gpt.com
API key in NANOGPT_API_KEY (or passed via --key / --env-file) — or no
key at all with a Nano wallet, see
wallet mode.
Optional: ffmpeg on PATH. Tools whose graphs include a local-media node
(resize, video frames, combine, audio trim/extract) use a pure-JS path for the
common case but fall back to ffmpeg/ffprobe for formats it can't handle —
JPEG/WebP resize, reading video frames, compressed audio. Without ffmpeg those
runs fail (and auto-refund in charge mode); the server prints a warning at
startup naming the affected tools. Pure image/LLM/vision tools don't need it.
Install with apt install ffmpeg (Debian/Ubuntu) / brew install ffmpeg.
Claude Code
claude mcp add nanoodle --env NANOGPT_API_KEY=your-key-here -- npx -y nanoodle-mcp --graphs ~/noodlesOr install it as a plugin — Claude Code prompts for your noodles folder and API key, and also learns what a noodle is (this repo doubles as a plugin marketplace):
/plugin marketplace add nanoodlecom/nanoodle-mcp
/plugin install nanoodle@nanoodleGrok
grok mcp add nanoodle -e NANOGPT_API_KEY=your-key-here -- npx -y nanoodle-mcp --graphs ~/noodlesOr, for a remote/serve endpoint (no local process, no API key on your machine):
grok mcp add --transport http noodles https://mcp.nanoodle.com/mcpThat writes [mcp_servers.noodles] into ~/.grok/config.toml (or
.grok/config.toml with --scope project). Same shape by hand:
[mcp_servers.noodles]
url = "https://mcp.nanoodle.com/mcp"
enabled = trueCursor
Install in Cursor
(then edit the graphs path and key), or add to .cursor/mcp.json yourself:
{
"mcpServers": {
"nanoodle": {
"command": "npx",
"args": ["-y", "nanoodle-mcp", "--graphs", "/absolute/path/to/noodles"],
"env": { "NANOGPT_API_KEY": "your-key-here" }
}
}
}VS Code
.vscode/mcp.json — note VS Code's root key is servers, not mcpServers:
{
"servers": {
"nanoodle": {
"type": "stdio",
"command": "npx",
"args": ["-y", "nanoodle-mcp", "--graphs", "/absolute/path/to/noodles"],
"env": { "NANOGPT_API_KEY": "your-key-here" }
}
}
}Windsurf
~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"nanoodle": {
"command": "npx",
"args": ["-y", "nanoodle-mcp", "--graphs", "/absolute/path/to/noodles"],
"env": { "NANOGPT_API_KEY": "your-key-here" }
}
}
}Claude Desktop
Same shape as Cursor/Windsurf, in claude_desktop_config.json under
mcpServers.
ChatGPT
ChatGPT only connects to remote HTTPS MCP servers. The hosted endpoint is
already live — add https://mcp.nanoodle.com/mcp (paid per call in Nano, no
API key). Local stdio (npx nanoodle-mcp --graphs …) stays BYOK and is not
reachable from ChatGPT.
⚠️ This spends real money
The server runs on your money — either a nano-gpt.com API key (BYOK) or,
keyless, your own Nano wallet via
x402. Every tools/call
executes a workflow against the NanoGPT API and spends from that balance —
and the caller is usually an AI agent deciding on its own when to call. Point
it only at graphs you're happy to have run, and keep an eye on your balance.
Each result ends with a cost: $X.XXXX line so the agent (and you) can see
what a call cost.
Wallet mode — no account, no API key (x402)
NanoGPT supports x402 accountless payments:
a keyless API call answers HTTP 402 with a Nano invoice, you pay it, the
call completes. Give the server a wallet and it does this automatically —
no NanoGPT account, no API key, no signup anywhere:
export NANO_SEED=<64-hex seed> # account 0 pays; or NANO_PRIVATE_KEY=<64-hex key>
nanoodle-mcp --graphs ~/noodles --max-usd 0.50Per call, the server: sees the 402 invoice → signs a Nano send block locally →
broadcasts it through a Nano RPC node (--nano-rpc / NANO_RPC_URL, default
rpc.nano.to) → NanoGPT detects the deposit and returns
the result. The seed/private key never leaves the process: only the signed
block goes to the RPC node, and neither secret is ever logged. An API key,
if present, always wins — the wallet is only used keyless.
Hosted paid tools and Market workers compare account reads across configured
Nano RPCs, validate mainnet identity and pause new spending on stale or
inconsistent views. Configure independent peers with a comma-separated
NANO_RPC_URL; multiple configured peers require at least two readable nodes.
See Nano RPC freshness for protocol requirements,
monitoring and the remaining restart-recovery limits.
Proof-of-work reliability. Every send block needs Nano proof-of-work. The
server asks the RPC node's work_generate first, but public nodes routinely
refuse or throttle it (no GPU, key required); the fallback is local
single-threaded CPU work, which can take a minute. Two fast options, both via
--work-rpc / NANO_WORK_URL:
Hosted GPU work API — sub-second work, no hardware. E.g. nano.to's PoW API (
--work-rpc https://rpc.nano.to) or Nanswap Nodes (--work-rpc https://nodes.nanswap.com/XNO— the fast work server is on their paid plan; the free one queues for minutes). Put the API key inNANO_WORK_KEY(env or--env-file, never a flag) — it's sent as both akeybody field (nano.to style) and anodes-api-keyheader (Nanswap style).Your own nano-work-server on the same machine (
nano-work-server --cpu-threads 8 -l 127.0.0.1:7076→ work in a few seconds, free forever).
Order: --work-rpc (2-minute timeout, so a hung server can't stall a payment)
→ --nano-rpc node → local CPU. The wallet also precomputes work for the
next block the moment one publishes, and serve mode prewarms at boot — with
any healthy work source, callers effectively never wait on proof-of-work.
The local-CPU last resort runs on the Node main thread: in --serve mode a
send-difficulty grind (minutes) freezes the whole HTTP server while it runs.
If your remote work sources are dependable, pass --no-local-work — the send
then fails cleanly instead (an unpayable invoice is refused up front, and a
failed refund/payout send leaves the balance in the wallet for the next
settle to move).
This is a hot wallet. Use a dedicated wallet holding pocket money, not
your savings: its balance is a natural spend ceiling, and --max-usd adds a
per-call one on top. NanoGPT auto-refunds overpayments and failed generations
on its side.
Prefer prepay? Wallet mode settles on-chain per call. If you'd rather pay once and draw down a balance, that's exactly what a NanoGPT account is: deposit crypto (Nano included) into an account, take its API key, and run the server in normal BYOK mode — same tools, one payment instead of many.
An experimental Base/Solana x402 exact ingress
ships with its durable payment-authority store and CDP Bazaar discovery
support, qualified offline only. It is not enabled by the CLI or hosted
server, and no live payment path exists until an operator wires a route,
a facilitator and a payTo address.
Serve mode — host your noodles as a service (--serve)
Everything above speaks MCP over stdio to your own agent. --serve speaks
MCP over streamable HTTP instead, turning a directory of noodles into a
service anyone's agent can connect to:
nanoodle-mcp --graphs ~/noodles --serve 8402Hosted execution has a 30-minute deadline across each workflow and its output
downloads. Operators can set NANOODLE_RUN_TIMEOUT_MS (positive milliseconds,
at most 24 hours). Saved/custom workflows and Market jobs use the same rule;
nested tools share their parent's deadline. See execution and payment
cancellation.
Callers connect with one command — no key, no signup:
claude mcp add --transport http noodles https://your-host/mcp
# or
grok mcp add --transport http noodles https://your-host/mcpGET / serves a landing page with the tool list and that exact command (Claude
and Grok behind a one-click toggle — same endpoint, same flags), so sharing
your server's bare URL is the onboarding. Every workflow on it links to its
source: an open in editor link (a share link minted from the exact graph
file being served — it loads the workflow in the
nanoodle editor to inspect, remix, or run on your own
key) and its raw graph JSON at /graph/<tool>.json. The page also spells
out the economics (deposits settle at metered cost + 20%; the markup is the
author's cut on graphs that name a payout address, and the operator's on the
rest, and the page says which of yours do) and how to self-host — this server, the editor, and the
executor are MIT (licensing). Generated media comes back as an
unguessable /out/… URL. Download that URL when handing off the original file
to another tool. Images up to 1,500,000 bytes also come back as a base64 image
block for display. A 1,200,000-byte PNG takes 1,600,000 bytes in base64 before MCP
adds the rest of the response. Runs themselves are not logged: free serve mode keeps no
record of who called what, and charge mode keeps only a payments ledger (money
events, never run telemetry — see below).
Generated media is deleted after --out-ttl hours — a privacy backstop so
a hosted server doesn't hoard every caller's generations on disk forever. In
--serve mode it defaults to 24h; pass --out-ttl <hours> to change it
(fractions like 0.5 are fine) or --out-ttl 0 to keep everything. Stdio mode
defaults to off — files you generated locally are yours to keep — but honors
the flag if you pass it. The sweep only ever removes media artifacts (images,
video, audio); the operator's own costs.json, gate-state.json, and
usage.jsonl are never touched. Note the 24h default matches the charge gate's
replay window: a paid result stays replayable for 24h and references its /out/
URL, so lowering --out-ttl below 24h in charge mode means a replayed result
can point at a file that's already been swept.
Privacy — what your server keeps
Run with the defaults and the same promise the hosted server makes holds on your box, every line checkable in this repo:
No accounts, no API keys, no sign-ins. In charge mode, paying is the only thing that authorizes a call.
Prompts and inputs are never written to disk or logs. Input media rides in memory only — it is never stored. In charge mode the gate keeps only a short hash binding a payment to its call (
hashArgs), never the arguments.Generated media auto-deletes after
--out-ttlhours (default 24h in--serve, off for local stdio), served at unguessable/out/…URLs until then. Set--out-ttl 0to keep everything.Results are held in memory for delivery, not stored — the restart-state file carries no result text or error detail.
No analytics, no trackers, no IP logs — the app keeps no request logs. In charge mode the one thing it writes is
usage.jsonl, a payments ledger of money-lifecycle events that mirror the public Nano ledger — no run telemetry, no error text. Free serve mode writes no ledger at all.
gate-state.json itself never holds customer content. It exists to keep
in-flight money safe across the restart a deploy causes — quotes and owed sends
survive — but a paid tool's text output and any upstream error detail are
never written to disk. Media results persist only their /out/ pointer and a
receipt; a text result persists as nothing, so a restart between a run and the
caller's retry simply re-runs the tool (charged once, delivered once — the
operator eats one duplicate model call) rather than replaying content from disk,
and a failed run replays a fixed placeholder plus its refund status, never the
original error message.
One caveat, stated plainly: generation runs on NanoGPT's API, so prompt content in flight is governed by their privacy policy.
Free serve mode runs on your balance — fine on a trusted network, ruinous on the open internet. For that, charge for calls:
Charging per call (--charge-usd)
nanoodle-mcp --graphs ~/noodles --env-file wallet.env \
--serve 0.0.0.0:8402 --public-url https://noodles.example.com --charge-usd 0.05Now every tool call is paid in Nano (XNO) by the caller, with no accounts
on either side. The flow their agent walks through (the server's MCP
instructions teach it automatically):
On each PAYMENT REQUIRED quote the tools/call hangs up with payUrl,
watchUrl, and a next imperative ( blocking: false ):
Pay. Show the user ONLY
payUrl(QR for the exact amount); any Nano wallet scans it. Never show themwatchUrlor the wallet address.Watch — immediately, on that same payment link. The agent opens
watchUrl(GET /x402/watch/<id>, agent-only SSE) the moment it has the quote. Onestatusevent per state change; when payment lands the stream closes withdone: trueand anextfield for phase 3. (The pay page uses the same stream; pollGET /x402/status/<id>?wait=1as a fallback.) Detection is RPC polling or push via--nano-ws— about a second.Results. ONLY after the watch closes paid: re-call the tool with the same arguments plus
_payment_id. Thattools/callis the results stream — it runs the workflow (progress heartbeats on a streaming transport) and returns the result with a receipt. Do not open it while still watching for payment. Re-calls with the same_payment_idreplay the cached result free.
What they paid is a deposit, not the price: the call settles at the run's actual metered model cost + 20%, and everything above that is sent back to the paying wallet as change — the same deposit→meter→refund model NanoGPT itself uses, one layer up. Nobody ever pays off an estimate.
Nano has no payment memo, so each quote's amount carries a few raw of random
dust — the amount is the memo. Quotes expire after 15 minutes; a payment
that arrives late is bounced straight back, and a run that fails after
payment is refunded automatically. Arguments are validated before a quote
is issued (nobody pays for a typo), and run_noodle is withdrawn in Nano charge
mode; NEAR mode prices and sells it, custom graphs included — see
Pay with NEAR.
For unpinned tools, the Nano deposit uses the higher of the catalog forecast
and the observed cost high-water mark used for pricing. The gate adds 20%,
applies a 2× variance multiplier (1.25× for a deterministic forecast that
covers observed costs), and rounds up to a whole cent. --charge-usd sets
the opening deposit when neither cost signal is available and the minimum
when a forecast only covers some priced nodes. Inexact runs preserve earlier
exact pricing observations for the same workflow and provider. The operator
absorbs any overrun. The gate prefers the exact raw-XNO/USD pair from
an unpaid NanoGPT invoice. It refreshes the rate after 60 seconds and can
keep using that observation for up to five minutes during an outage.
CoinGecko and Kraken provide timestamped XNO/USD fallbacks within the same
freshness limit. GET /rates/nano checks the rate the Nano checkout would
use. --xno-usd pins an operator-configured rate. Set per-graph overrides in
the top-level block shown below.
"x402": { "usd": 0.10, "author": "nano_1abc…" }humanize-comment quotes each request on its own. The quote is built from the draft,
context, guidance, and maxChars actually sent. The optional keep array accepts
up to eight verbatim strings, each 1–500 Unicode characters. Every occurrence
of each string in the draft is protected. A ninth entry is rejected before charging.
Each call's max_tokens is
sized from that request: maxChars, or the draft's length when maxChars is
omitted, plus a small slack. The decider also reserves tokens for its ranking JSON and for GLM reasoning, which shares that max_tokens budget. Tokens are estimated at about 3.5 bytes each; the draft, context, and guidance the decider reads are priced at 2.5 bytes per token, so its estimate grows with context length. Until the decider starts, a hosted run admits a writer, fallback, or re-ask only if it fits the deposit with the decider's estimated cost still counted. That estimate is admission headroom, not money set aside, so it makes a skipped decider less likely but does not rule it out. The
priced worst case is every writer once, one extra retry, the decider, and a second decider pass when
a protected span can be repaired or the call can ask the decider to confirm one fitting rewrite (a title, a length cap, or a required ending).
When a writer's fallback model runs, both calls are charged.
On a hosted payment the quote caps what the customer pays. A step whose estimate or invoice would push the spend past
the quote is skipped. A skipped writer step ends as a partial result, or with nothing
owed when nothing was sent. A skipped or unusable decider is an error, not the original draft returned as a successful comment. The deposit is 12% above that priced charge, at least $0.001,
rounded up, and never below it. Settlement of a hosted payment charges the customer the lesser of the metered
cost plus 20% and the quoted deposit, and returns the difference. When a provider
meters more than the quote, the operator absorbs that overrun. This refund and cap apply to hosted payments.
Direct-wallet spending has no cap and is not refunded. A short comment
is not asked for the longest comment's hold. The graph's usd is only the
ceiling for that longest request, used when a model has no price.
Workflow creator payouts
usd overrides the deposit for every other tool. author routes the 20% markup of every
successful call to that address — computed on what the run actually cost,
never on the deposit, and capped by whatever the deposit has left once the cost
is taken out (a deposit too small to cover cost + 20% pays the author only the
remainder). Nano has no network fees and this server takes no cut of the
markup, so creators keep 100% of what does get routed. With no author
field the markup stays with the wallet running the server — it is opt-in per
graph, not the default. In exact raw, per settled call:
cost = metered model cost, converted at the deposit's own oracle pair, rounded up
markup = cost / 5 (20%, integer floor)
take = min(markup, deposit − cost) → author (or kept, if no author field)
change = deposit − cost − take → back to the payerThe same x402.author field also works on the NEAR service, for both saved workflows
and custom graphs passed to run_noodle. The customer pays in NEAR or USDC on NEAR;
the author still receives Nano, from the same Nano wallet pool used to fund models.
The payout converts only the collected markup at the quote's locked XNO/USD rate,
using integer arithmetic and rounding down to raw. It is capped by what remains of
the deposit after model costs. There is no additional creator fee. Customer change
and failure refunds stay in the customer's original asset. Without x402.author,
the operator keeps the markup.
NEAR creator payouts use a durable outbox: the debt and signed Nano block are recorded
before publication, and retries replay that same block. A replacement is allowed only
when a different, confirmed successor proves the original block can never land.
Pending payouts survive restarts and quote pruning; receipts expose the author,
exact Nano amount, status and block hash. Payout retries do not block the result or
customer refund. Authored workflows are refused before quoting if no Nano payout
wallet or current XNO/USD rate is available. API-key-funded servers can configure
NANO_SEED or NANO_PRIVATE_KEY for these payouts too.
Hosted creator workflows
On near.nanoodle.com/creators, upload a
native Nanoodle graph. An embedded x402.author Nano address is optional. Nanoodle stores
the recipe, funds the model calls from its shared pool, and supplies a run page
and a dedicated MCP endpoint. The creator supplies the workflow, not a server,
provider key or marketplace token. Customers still pay NEAR or USDC before execution. With a valid address, successful
runs pay the creator in Nano using the rules above; without one, no creator payout
is made. The form warns on the first Host click and requires a second Host click
for the same graph, name and description to host without creator payouts. Editing
the form or choosing another file resets that acknowledgment. Free checking never
requires a payout address; malformed explicit metadata is still rejected.
Connected, named Text and Choice nodes become customer inputs automatically. Multiple inputs are mapped independently; no primary input selection is needed. Locked nodes, unnamed defaults, and saved optional prompts stay in the recipe. A saved text feeding only an optional field port (such as Image→Video's motion prompt) also stays in the recipe. The Day to Night example exposes its Day keyframe prompt and Night keyframe instruction while preserving its motion default. Names do not turn text into image inputs: upload nodes remain unsupported by the paid hosted runner. Model configuration stays in the stored recipe; callers cannot replace the graph or payout address. Uploads are immutable and deduplicated: a revision gets a new link. Public pages and MCP discovery do not distribute the graph. Hosting the platform yourself remains supported by this open-source repository.
POST /creators/check validates and prices without executing; POST /creators/workflows hosts it. Both accept {graph, name, description};
the check response includes the same customer schema as the hosted endpoint.
Explicit legacy inputName submissions still select a named Text node for the
single-input pricing probe and publish their former full input schema. The
automatic form omits inputName; existing hosted records keep their published
schemas. ComfyUI/OpenArt exports receive a format error before
pricing or hosting: rebuild or open a supported native graph in the Nanoodle
editor and use Save to export noodle-graph.json. Renaming a foreign JSON file
does not convert it. A successful upload returns /workflows/wf_… and
/workflows/wf_…/mcp. The endpoint offers run_workflow and free
price_workflow, using the same NEAR/USDC gate, execution graph, receipt and
result components as the main service. /workflows/wf_…/llms.txt explains
automatic payment continuation for that endpoint.
Hosting is immediate after automated graph, price and Nano-address checks.
There is no Nanoodle review or approval step. Share the run page with people,
or connect an agent to the uploaded workflow's /workflows/wf_…/mcp endpoint.
The page supplies the MCP URL, client connection command and copyable payment
instructions. Users pay the execution quote in NEAR/USDC before the workflow
runs; unused funds return in the same asset. Successful executions route the
collected model-cost fee to the embedded Nano author address as above.
Creator marketplace-listing setup is not currently offered. Market holds buyer funds in escrow and releases seller proceeds after delivery/acceptance; those proceeds cannot fund Nanoodle's upfront execution quote for that same job. Such an integration requires the creator to front the execution cost. The existing Nanoodle marketplace workers remain separate from this hosted creator flow.
For Nanoodle's existing marketplace workers, which execute their own hires directly rather than through a paid MCP call, the creator payout becomes owed only after acceptance. It is 20% of actual model cost, capped by accepted proceeds after model costs, converted at the XNO/USD rate locked before execution. Refunded hires and unknown model costs create no payout. The common durable Nano outbox retries pending sends without rerunning the workflow or paying a settled assignment twice. The marketplace's own fee and cent rounding can reduce the payout. Official registration/adoption flow: market.near.ai agent guide.
A run costing more than its deposit keeps the whole deposit and the operator absorbs the excess; a run whose model reports no cost settles at $0 and the whole deposit is returned (the caller is never billed off a number the meter didn't produce). The math is integer-exact end to end: USD decimals parse by string into nano-dollars, the rate is the oracle invoice's literal raw/USD pair, every conversion is BigInt ratio arithmetic with an explicit floor or ceil, and floats never touch an on-chain value.
The wallet (NANO_SEED / NANO_PRIVATE_KEY, via --env-file) receives
payments, sends refunds and author payouts, and — if you don't set an API
key — also pays NanoGPT per call via x402, making the whole service
nano-in/nano-out. With an API key, runs spend from the key and the wallet only
handles the customer side.
For hosted wallet-funded MCP workflows, set NANOGPT_FALLBACK_API_KEY in the
service's secret environment or --env-file to add a funded NanoGPT account as
a backup. Leave NANOGPT_API_KEY unset to keep the Nano wallet first. For
synchronous model requests, Nanoodle uses the backup only when an initial,
priced x402 quote offers a different payment method. Both methods draw from
the run's approved USD budget. Customer checkout and refunds still use the
configured payment rail.
Payment detection
Polling receivable on your Nano RPC node (1s while quotes are pending) is
the always-on default. Add --nano-ws wss://… to subscribe to a Nano node
websocket for push detection — settlement is then effectively instant and
polling relaxes to a safety net. Public websockets exist (e.g.
wss://nanoslo.0x.no/websocket worked at the time of writing); your own node
is the dependable option. Either way the poller also checks account_history,
so payments pocketed by a concurrently-running wallet are still found.
Payments ledger
In charge mode <out>/usage.jsonl is a payments ledger: one line per money
event only — quote, paid, refund, change, author_payout — your
server's own record of money moving, nothing client-side. It is deliberately
not a usage log: there are no run events, no run timing, no
success/failure telemetry, and no upstream error strings (which can quote user
content). A money event does carry .tool — the tool name is the subject of
the payment, not a record of a run — so you can see what earns, but not who
ran what when or whether it failed. Refunds record a fixed category
(run_failed, late_payment), never the underlying error text — the full
error still reaches the caller and the operator's stderr. Free serve mode
writes no ledger at all. Some starters:
jq -r 'select(.event=="paid") | .tool' usage.jsonl | sort | uniq -c | sort -rn # paid calls per tool
jq 'select(.event=="paid") | .settleMs' usage.jsonl # quote→settle latency
jq 'select(.event=="paid") | .usd' usage.jsonl | jq -s add # gross deposits taken
jq -r 'select(.event=="refund") | .reason' usage.jsonl | sort | uniq -c # refunds by categoryTLS trust prerequisite
The eMudhra intermediate-key compromise affects outbound HTTPS and WSS from this Node process: NanoGPT requests, Nano RPC/work services, authenticated wallet websocket connections, media downloads, and share links. Both hosted and local MCP clients need patched certificate trust. Updating a browser does not update Node's bundled roots.
On Debian 13, install ca-certificates >= 20250419+deb13u1; on Ubuntu 24.04,
install >= 20260816ubuntu0.24.04.1. Before npm/npx installs and server startup,
select only the patched OpenSSL store on those Linux hosts:
export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
export SSL_CERT_DIR=/etc/ssl/certs
export NODE_OPTIONS="${NODE_OPTIONS:+$NODE_OPTIONS }--use-openssl-ca"
export npm_config_cafile="$SSL_CERT_FILE"
export npm_config_strict_ssl=true
# Now run npm ci, npx, or your normal server command in this environment.Preserve unrelated Node flags, remove conflicting --use-bundled-ca or
--use-system-ca, and remove NODE_EXTRA_CA_CERTS while applying this policy.
Those additive options do not remove compromised roots. Keep certificate
verification enabled. For macOS/Windows, update OS trust and the Node runtime,
then verify the actual runtime's trust policy; these Linux paths are not portable.
Use a supported runtime meeting the
November 2026 Node security floors:
22.23.5, 24.22.3, or 26.13.1. Restart any long-running MCP process after
changing its runtime or trust policy and verify the binary it actually loads.
The Netcup deployment uses a separate Node binary and trust wrapper. Follow the Netcup runtime instructions and verify the launcher before activating a release. CI tests and release jobs use the Node version pinned in their workflows and select Ubuntu's patched OpenSSL trust store before software downloads.
Verify ordinary HTTPS succeeds and all twelve incident probe handshakes fail
with certificate errors, including AAA cross-sign variants. Use the shared
tools/check-tls-trust.py in the deploy repository with --client node --node /opt/node22/bin/node through with-system-trust on Netcup. Repeat with the
Node executable actually used by each local npx/editor MCP installation.
Test authenticated WSS and read-only RPC connectivity separately; avoid a paid
run or wallet transfer as a health check. Review unexpected spend or wallet/API
activity and rotate exposed credentials if misuse or interception is suspected.
Merging this source is not evidence that external clients are patched.
Hosting checklist
Reverse proxy / tunnel: bind localhost, put Caddy/nginx/cloudflared in front for HTTPS, and set
--public-urlto the outside URL (it's what pay links and media links are built from).systemd (adjust paths):
[Unit] Description=nanoodle-mcp serve After=network-online.target [Service] ExecStart=/usr/bin/npx nanoodle-mcp --graphs /srv/noodles --out /srv/noodle-out \ --env-file /srv/wallet.env --serve 8402 --public-url https://noodles.example.com \ --charge-usd 0.05 --work-rpc http://127.0.0.1:7076 Restart=on-failure [Install] WantedBy=multi-user.targetKeep the float small: the wallet is hot. Sweep revenue to cold storage regularly; if you run with an API key, cap that account's balance too.
Work server: refunds and payouts are Nano sends and need proof-of-work — use a hosted GPU work API (nano.to, Nanswap — key in
NANO_WORK_KEYin the env file), or pointNANO_WORK_URLat anano-work-server --gpuon any box you own over a tailnet (work requests carry only block hashes — nothing secret). Pair either with--no-local-workso a work outage can't freeze the server on CPU work. Wallet-material and key env vars all belong in the--env-file, which also takesNANO_WS_URLfor a key-bearing websocket URL (e.g. Nanswap'swss://nodes.nanswap.com/ws/?ticker=XNO&api_key=…).There is intentionally no auth: on a charged server, payment is the authorization. Don't serve graphs you wouldn't want strangers running.
How it works
~/noodles/
generate-hero-image.json → tool "generate-hero-image"
make-jingle.json → tool "make-jingle"Every readable *.json graph in --graphs becomes one MCP tool:
Tool field | Derived from the graph |
| filename minus |
| the graph's first comment (if any), its node chain in dependency order with node names (e.g. |
| one string property per unwired field, exactly like the nanoodle CLI's |
media inputs | image / audio / video inputs take a file path or https URL — local files ride inline as base64 |
result | text outputs as text blocks; media outputs saved into |
When the run does not use your prompt verbatim, the result says so. Many
image and video models reject an over-long prompt outright, and in a graph the
prompt is usually written by an upstream LLM — nobody typed it, so nobody can
shorten it. nanoodle (0.8.0+) trims it to the model's cap at a sentence
boundary instead of losing the run to a certain 400. That is only defensible if
the caller is told, so the trim leads the tool result:
note: prompt trimmed for "Poster" (qwen-image-3) — the prompt was 1320 characters
and this model accepts at most 800, so nanoodle cut it to 791 characters at a
sentence boundary. The run used the shortened prompt.It matters most in charge mode, where that run is already paid for. The library
also emits a process warning, but stderr belongs to whoever started the server,
not to the agent that paid.
A ⚖️ Decide gate that answers no is a result, not an error. nanoodle
0.9.0 runs the Decide node. A yes/no gate that says no settles as status
gated and stops its branch. The tool result is normal (not isError), the
decision's tiny cost is billed, and nothing behind the gate runs or bills. The
result leads with:
gated: "Is it a cat?" answered no (yes 12%), so the run stopped there on purpose — skipped, not billed: "Cat poem". This is a result, not an error.
Cat poem: skipped — gate "Is it a cat?" answered no
cost: $0.000003Protocol behavior worth knowing: malformed calls (unknown tool, unknown /
missing / non-string argument) are rejected as JSON-RPC -32602 before any
money is spent; a run that fails (network, model error, missing key) comes
back as a normal tool result with isError: true.
usage: nanoodle-mcp --graphs <dir> [--graphs <dir> …] [--out dir] [--key K] [--env-file path] [--nano-rpc url] [--work-rpc url] [--max-usd n]
--graphs dir directory of noodle-graph.json saves (required; repeat to serve
several dirs — scanned in order, so an earlier dir wins name clashes)
--out dir where media outputs are saved (default ./nanoodle-out)
--key K NanoGPT API key (defaults to NANOGPT_API_KEY)
--env-file p read NANOGPT_API_KEY / NANO_SEED / NANO_PRIVATE_KEY / NANO_WORK_URL /
NANO_WORK_KEY / NANO_WS_URL from a .env-style file
--nano-rpc u Nano RPC node for wallet mode (default https://rpc.nano.to; NANO_RPC_URL)
--work-rpc u dedicated work_generate endpoint — a local nano-work-server or a hosted
GPU work API (NANO_WORK_URL; NANO_WORK_KEY carries its API key;
falls back to --nano-rpc, then local CPU work)
--max-usd n wallet mode: refuse any single x402 invoice above $nKey precedence matches the nanoodle CLI: --key > --env-file >
NANOGPT_API_KEY; wallet secrets come only from the environment or
--env-file, never argv. The server refuses to start if no directory holds a
runnable graph, and says why per file on stderr; stdout is protocol only.
Per-project graphs + a shared library
--graphs is repeatable, so one server can merge several folders. The pattern:
commit a noodles/ dir to a repo for that project's own tools, then list your
global library after it as a fallback:
nanoodle-mcp --graphs ./noodles --graphs ~/noodlesDirs are scanned in the order given, and the earlier dir wins a name clash:
if both folders have a changelog.json, the project's becomes changelog and
the shared one becomes changelog-2. So a project can override a shared tool
just by dropping a same-named graph in ./noodles, while everything else in
~/noodles stays available. An unreadable dir (a typo, a folder that isn't
there) is a hard startup error naming the offender — no silent half-load.
Wiring it into your editor
MCP config is per-project in most clients, so the two-dir pattern lives in the
repo, right next to the graphs it serves. For Claude Code that's a .mcp.json
at the project root — commit it along with noodles/ and everyone who clones
gets the same tools:
{
"mcpServers": {
"nanoodle": {
"type": "stdio",
"command": "npx",
"args": ["-y", "nanoodle-mcp", "--graphs", "./noodles", "--graphs", "/home/you/noodles"]
}
}
}Relative paths resolve from the project root. A project-scoped server named
nanoodle shadows a user-scoped one of the same name, so repos with a
.mcp.json get their own graphs and every other directory falls back to your
global install untouched.
Two things to keep out of a committed config: your API key (leave env
out and let NANOGPT_API_KEY come from the environment, or point
--env-file at a file outside the repo — never commit a key) and, for team
repos, your personal library path (the second --graphs above is an
absolute path on your machine; drop it from a shared repo's config and keep
just ./noodles, since ~ is not expanded in MCP args). Cursor
(.cursor/mcp.json) and VS Code (.vscode/mcp.json) take the same args in
the config shapes shown under Install.
Built-in safe-for-work check
When at least one graph is loaded, sfw_check checks a still image, evenly
sampled video frames, or both. It passes only if the model
(perplexity/pplx-decider-v1.2) answers yes for every picture.
Video sampling needs ffmpeg.
In charge mode, the number of pictures determines the deposit. The run stops before any check the remaining budget cannot cover. The service charges metered cost plus 20%, capped at the deposit, and returns the difference.
Run any share link
Every nanoodle share link is an executable tool. Alongside your saved graphs the
server always exposes one more tool, run_noodle, that takes any share link
and runs it — no file needed:
run_noodle("https://nanoodle.com/#g=…", { "Text": "a lighthouse at dawn" })Pass the link as url and any workflow inputs as inputs (the same friendly
keys the graph's own tool would take; media inputs take a file path or https
URL). It accepts #g=/#j= workflow links, #a= app links, and short links
to one. Direct links decode locally; only fragment-less short links trigger a
network read, and it carries no credentials. Like every other tool, a run
spends real money and ends with a cost: $X.XXXX line.
From version 0.7.0, run_noodle also takes a workflow you composed yourself: pass the graph JSON as
graph instead of url. Two free helpers sit next to it: noodle_guide explains
the graph format, node types and priced models, and price_noodle returns the
itemized estimated cost of a graph or url without running it.
For agent-authored graphs, call noodle_guide first. For example,
{"node_type":"ivideo","limit":5} returns model candidates for an
image-to-video node, and {"format_only":true} returns the graph contract and
a minimal example without looking up model catalogs. The guide filters for
the hosted node policy, provider-advertised capabilities and a priceable
baseline. It does not create a quote, run inference or list the editor's full
inventory. Before quoting a run, pass the actual graph, settings and inputs to
price_noodle.
For a rigged model or a sprite animation, call noodle_guide with
{"node_type":"slice-3d"} or {"node_type":"sprite-stack-render"}. The guide
includes ports, settings, pose playback and a wired example. Use the editor
or a local executor to run these media transforms. Slice 3D example
Pay with NEAR / run custom workflows
A server started with --near-merchant sells workflow runs for NEAR, with
Circle-issued USDC on NEAR available through NEAR_USDC=1,
and it runs workflows the caller composes itself, not only the saved ones.
An agent with a NEAR wallet can design a graph, see what it will cost before it
commits, pay one transfer, get the result, and get the unused part of its deposit
back in the payment asset. Nobody needs a Nanoodle account or an API key. Testnet is the default;
mainnet is a flag. The full design (verification rules, durable state, threat
model) is in docs/near-payments.md.
NEAR mode first ships in npm version 0.7.0. Until
npm view nanoodle-mcp versionshows 0.7.0 or later,npx nanoodle-mcpinstalls a release without NEAR mode: run it from a clone (node bin/nanoodle-mcp.mjs …, as below). The scripts used below (scripts/…) are not in the npm package at all; they need a clone.Live mainnet: https://near.nanoodle.com/mcp, with NEAR or USDC payments to
nanoodle.near. The browser studio at https://near.nanoodle.com quotes and runs ready-made or custom workflows.mcp-near.nanoodle.comremains a compatibility alias. A real payment, automatic detection, workflow execution and native refund were verified on 2026-11-13; the transaction links are in Status. For the shared Nano pool and connected-wallet payment flow, see NEAR endpoint and wallet payments.The same workflow runs can also be sold as jobs on NEAR Agent Market, paid by the market's escrow instead of a transfer per call: see docs/near-agent-market.md.
For USDC contracts, exact token amounts, wallet gas and operator setup, see USDC on NEAR. The examples below use native NEAR.
Try it in one command (offline)
git clone -b near-hackathon https://github.com/nanoodlecom/nanoodle-mcp && cd nanoodle-mcp && npm ci
node scripts/near-simulate.mjs # or: npm run simulate:nearYou do | You see |
run the simulation | the real server binary starts in NEAR mode against a local NEAR chain stand-in and a local NanoGPT stand-in, with a throwaway merchant key |
step 2–4 | the tool list, |
step 5–7 | the quote, one transfer of exactly that amount, then the result with a receipt: charged |
step 8–15 | replay (no re-run, no re-refund), a reused transaction, an unsafe node, an unpriceable model, underpayment, a late payment, a failed run, and the server killed mid-run and mid-refund — each refused or refunded correctly |
step 16 | both balances, reconciled: deposits − refunds = what was charged, gas aside |
It needs no network, keys or funds, and exits non-zero if any of its 35 checks fail.
How pricing works
Every price uses these terms, in price_noodle, quotes, receipts and tool
descriptions:
Term | Meaning |
estimated cost | The model cost the run is expected to have, itemized per paid node (node, model, basis, USD), from NanoGPT's public catalog. Text steps are priced at their |
service fee | 20% of the actual model cost. |
likely charge | Estimated cost + 20% service fee: what you will most likely pay. |
deposit | The most you can be charged. It is held up front and is the amount you send: the likely charge × 2 (× 1.25 when every model has a fixed price), rounded up to the next cent, minimum $0.01. |
charged | Actual model cost + 20% service fee, capped at the deposit. If the provider does not report the full cost of a run, the estimated cost is charged instead. |
refund | The deposit minus what was charged, sent back to the paying account automatically. Exact in yoctoNEAR. |
rate | The NEAR/USD rate used, with its source and time; when known also XNO/USD and the swap rate derived from the two ("1 NEAR = N XNO"), and the swap margin when it is not zero. A quote locks all of it for its lifetime; settlement uses the locked rate. |
In structuredContent.pricing, a figure named after its term is usd
(estimatedCost.usd, likelyCharge.usd, deposit.usd); a figure that is only
known after the run is likelyUsd (serviceFee.likelyUsd, refund.likelyUsd).
Each quote says, in one sentence, what you will most likely pay and that the rest comes back, and in another why the deposit is larger:
You will most likely pay about $0.0115 (0.003172 NEAR): the estimated cost plus a 20% service fee. You send 0.008379 NEAR as a deposit; that is the most you can be charged, even if the run costs more, and the rest is refunded to your account as soon as the run finishes.
Text, video and audio steps bill by what they actually produce, so the deposit holds twice the likely charge as headroom, rounded up to the next cent ($0.03); image prices are fixed.
The worked example (text → llm → image, 1 NEAR = $3.64, illustrative catalog prices):
Step | USD | NEAR |
Estimated cost, | $0.000622 | |
Estimated cost, | $0.009 | |
Estimated cost | $0.00962 | |
Likely charge (estimated cost + 20% service fee) | $0.0115 | 0.003172 |
Deposit (likely charge × 2, rounded up to the cent) | $0.03 | 0.008242 + dust 0.000137 = 0.008379 (≈ $0.0305) |
Actual model cost reported by NanoGPT after the run | $0.00941 | 0.002585164835164835164836 |
Service fee (20% of actual) | $0.001882 | 0.000517032967032967032967 |
Charged | $0.011292 | 0.003102197802197802197803 |
Refund (deposit − charged) | $0.0305 − $0.011292 ≈ $0.019208 | 0.005276802197802197802197 |
The dust (here 0.000137 NEAR, at most 0.000999) makes each open quote's amount unique, so the amount identifies the quote; it comes back with the refund, which is why the refund is a little more than $0.03 − $0.011292. All on-chain math is exact integer yoctoNEAR. A run that fails refunds the whole deposit.
The quote's rate line reads, for example, Rate: 1 NEAR = $3.64 (coingecko, …); 1 XNO = $0.95 (nanogpt-x402, …), so 1 NEAR = 3.831578947 XNO, locked for this quote. The swap
rate is derived from the two USD rates; no swap venue is queried, and the server does
not swap NEAR to XNO itself (refilling the Nano float from received NEAR is a manual
operator task). GET /rates on the server shows the current rates, their sources and
ages; GET /rates?refresh=1 refetches them (at most once every 15 s).
Every receipt ends with the three money legs, each with its own status:
Leg 1, caller payment: 0.008379 NEAR, tx 8PyS…, final.
Leg 2, model payment to NanoGPT: $0.00941 (paid from the operator's NanoGPT balance).
Leg 3, refund: ≈0.005277 NEAR, sent (tx 8yto…, https://testnet.nearblocks.io/txns/8yto…).On a server that pays NanoGPT from its Nano wallet, leg 2 also gives the XNO amount, derived from the reported cost at the locked XNO/USD rate. An unknown cost stays "unknown", never zero.
The agent's side
Design (free).
noodle_guidelists the node types this server runs, the ports each one takes wires on, their fields, the wiring rules, a complete example graph and the priced models.price_noodle { graph, inputs }returns the itemized price and every problem, without a quote. Iterate untilpricing.safety.okis true (it is false whenever a node cannot be priced or the deposit is over the server's cap).Quote. Call
run_noodle { graph, inputs }(or a saved-graph tool) with no payment arguments. The answer isstructuredContent.payment:paymentId,payTo,network,amountYocto,amountNear,expiresAt(30 minutes by default) and thepricing. Nothing is charged.Pay. Send one native transfer of exactly
amountNeartopayTo, for example with near-cli-rs:near tokens payer-name.testnet send-near merchant-name.testnet '0.008379 NEAR' network-config testnet sign-with-keychain sendRun. Repeat the same call with the same arguments plus
_payment_id,_payment_tx(the transaction hash the wallet printed) and_payment_sender(the account you paid from). The server reads the transaction at FINAL finality, checks receiver, amount, singleTransferaction and timing, records the hash as consumed, runs the workflow once, and returns the result with areceipt: charged, refunded, both transaction hashes and explorer links.Replay. Repeating the paying call returns the stored outcome. It never runs, charges or refunds again.
If the transaction is not final yet, the call says so and nothing is consumed: call again 3 seconds later (finality takes 2–3 s). A wrong amount or a payment after expiry is refunded in full and nothing runs.
Prove it on testnet (turnkey)
Two scripts run the whole flow on real NEAR testnet with throwaway accounts: one
creates the accounts, the other plays both the operator and the agent. They move
testnet NEAR only. Keys stay in the directory you pass as --keys-dir (files mode
0600; only public keys are sent or printed); use a directory outside the repository.
# 1. Two new testnet accounts (merchant + payer) through the testnet account helper
node scripts/near-testnet-accounts.mjs --keys-dir ~/.near-testnet-nanoodle
# Ends with READY and exit 0. Exit 1: the helper refused (fallbacks are printed);
# exit 3: the accounts exist but need funding (merchant ≈0.05, payer ≈0.1 NEAR).
# No helper: add --implicit and fund the two printed accounts yourself.
# Own accounts: --use-existing --merchant <id> --merchant-key-file <p> --payer <id> --payer-key-file <p>
# 2. Every check that moves no funds: keys, RPC, balances, rate, server, price, quote
node scripts/near-testnet-e2e.mjs --keys-dir ~/.near-testnet-nanoodle --dry-run --mock-model
# "=== Transactions ===" lists "(none: no funds moved)"; the last line is
# "PASS: 14/14 checks passed (dry run: no funds moved)", exit 0.
# 3. Real payment and refund, model replaced by a local stand-in (no NanoGPT key needed)
node scripts/near-testnet-e2e.mjs --keys-dir ~/.near-testnet-nanoodle --mock-model
# 4. The same with one real NanoGPT call (about $0.00002, capped at 48 output tokens);
# the server reads NANOGPT_API_KEY from .env (or pass --env-file <path>)
node scripts/near-testnet-e2e.mjs --keys-dir ~/.near-testnet-nanoodleStep 3 sends four testnet transactions: a payment, its refund, a payment 0.0000005 NEAR
short (refused, refunded in full, nothing runs) and that refund. It checks the receipt
against the chain to the yoctoNEAR (deposit − refund = charged), that the charge is the
model cost + 20% at the quote's locked rate (with --mock-model, the stand-in's own
reported cost), both balances, replay
(same receipt, no second refund) and reuse of a spent transaction, prints an explorer
link and a near-check-tx command for every transaction, and ends PASS with exit 0.
On any FAIL it exits 1 and prints what to check for each failed area. The server's
state and money log stay in nanoodle-out/near-testnet-e2e/<time>/.
The rest of this section does the same by hand, with your own server.
Running a NEAR-paid server (testnet)
From the cloned repository:
# 1. A merchant account (receives payments, signs refunds); near-cli-rs, testnet faucet
near account create-account sponsor-by-faucet-service merchant-name.testnet autogenerate-new-keypair save-to-keychain network-config testnet create
near account export-account merchant-name.testnet using-private-key network-config testnet # prints ed25519:…
# 2. Secrets in a file, never on the command line
cat > .env <<'EOF'
NANOGPT_API_KEY=your-nanogpt-key
NEAR_PRIVATE_KEY=ed25519:the-key-printed-above
EOF
chmod 600 .env
# 3. Serve (a graphs folder must exist; it may be empty — run_noodle needs no saved graphs)
mkdir -p noodles
node bin/nanoodle-mcp.mjs --graphs ./noodles --serve 0.0.0.0:8402 --public-url https://your-host \
--near-merchant merchant-name.testnet --env-file .envAt startup the server checks that the RPC is on the configured network and that the key is a full-access key of the merchant account, finishes anything a previous run left in flight (a run interrupted by a restart is refunded, never re-run), and logs the network, merchant, RPC host and rate source. It refuses to start on any mismatch. Use a dedicated merchant account: no other software should send from its key.
Flag | Env | Default | Meaning |
|
| off | Turns NEAR mode on. Needs |
|
|
| Network to verify payments and send refunds on. |
|
| fastnear's public RPC, then near.org's | RPC endpoint(s) you trust to report finality, tried in order with failover. The shared watcher detects exact transfers through finalized account changes and receipt-to-transaction lookup; no node or indexer is needed. |
| off | Optional comma-separated archival peers for transaction hashes, historical block hashes and receipt discovery. Choose peers you trust for finality. The primary pool handles broadcasts, current account reads and the finalized chain tip. | |
|
| required | The merchant's full-access key: |
|
| live (CoinGecko, 60 s cache) | Pin the NEAR/USD rate. Without a fresh live rate the server stops quoting rather than guess. |
| live (NanoGPT x402 invoices, then CoinGecko or Kraken) | Pin the XNO/USD rate (the same flag the Nano charge mode uses). Required to quote when the server pays NanoGPT from its Nano wallet. Informational with an API key. | |
|
|
| Swap margin, 0–2000 basis points: NEAR amounts are computed at a NEAR/USD rate that much worse for the caller, to cover swapping NEAR to XNO. |
|
|
| Quote lifetime, 1–120 minutes; the quote's rates stay locked for all of it. |
|
|
| Background refresh of live rates; |
|
| Refuse any call whose deposit would exceed this. | |
| off | Set | |
| none | Comma-separated exact HTTP(S) origins allowed on the NEAR listener, for compatibility hostnames. |
NanoGPT is still paid by your API key or Nano wallet, exactly as in the other
modes; NEAR only changes how callers pay you. Money events go to
<out>/usage.jsonl with "rail": "near"; durable payment state is
<out>/near-state.json (one server per --out directory). Each settled call's
change event records the locked rates, the NEAR charged and refunded, the USD model
cost and, on a wallet-funded server, the XNO it cost (derived), each in its own unit, so
you can total NEAR in against XNO out and decide when to swap
(reading the ledger). Those
conversions are for reporting; nothing is swapped.
kill -HUP <pid> re-reads NEAR_USD and NEAR_SWAP_SPREAD_BPS from the --env-file
and refetches the live rates, without a restart; open quotes keep their locked rates.
Running both rails on one server
node bin/nanoodle-mcp.mjs --graphs ./noodles --serve 0.0.0.0:8402 --public-url https://your-host \
--charge-usd 0.05 --near-merchant merchant-name.testnet --env-file .env # .env also holds NANO_SEEDEach call is paid in Nano by default, exactly as with --charge-usd alone. A saved tool
the NEAR gate also sells says so in its description and takes "_pay_with": "near" for a
NEAR quote; run_noodle, price_noodle and noodle_guide are NEAR-side tools. A Nano
payment id starts with pay_, a NEAR one with nq_, and the server routes the paying
call by it. The two rails keep separate state and ledgers (usage.jsonl and
near-usage.jsonl). npm run simulate:dual shows it offline: a tool quoted in Nano, the
same tool quoted and paid in NEAR, a NEAR-paid custom graph, GET /rates before and after
a forced refresh, and a SIGHUP reload.
Try it live on testnet
With the server above running at https://your-host, any shell can act as the
agent. jq is only used to pick fields out of the answers.
# 1. A payer account (a second account; the faucet funds it with testnet NEAR)
near account create-account sponsor-by-faucet-service payer-name.testnet autogenerate-new-keypair save-to-keychain network-config testnet create
# 2. The workflow and a helper that calls run_noodle over MCP's HTTP transport
GRAPH='{"nodes":[{"id":"n1","type":"text","name":"Idea","fields":{"text":""}},{"id":"n2","type":"llm","fields":{"model":"z-ai/glm-5.3-flash","system":"Write one vivid image prompt for the idea. Reply with the prompt only.","maxTokens":300}},{"id":"n3","type":"image","fields":{"model":"blackforestlabs/flux-3/klein/text-to-image","size":"1024x1024"}}],"links":[{"from":{"node":"n1","port":"text"},"to":{"node":"n2","port":"prompt"}},{"from":{"node":"n2","port":"text"},"to":{"node":"n3","port":"prompt"}}]}'
call() { curl -s https://your-host/mcp -H 'content-type: application/json' -H 'accept: application/json' \
-d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"run_noodle\",\"arguments\":{\"graph\":$GRAPH,\"inputs\":{\"Idea\":\"a lighthouse at dawn\"}$1}}}"; }
# 3. Free price check, then the quote
curl -s https://your-host/mcp -H 'content-type: application/json' -H 'accept: application/json' \
-d "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"price_noodle\",\"arguments\":{\"graph\":$GRAPH,\"inputs\":{\"Idea\":\"a lighthouse at dawn\"}}}}" | jq -r '.result.content[0].text'
call "" | jq '.result.structuredContent.payment | {paymentId, payTo, amountNear, expiresAt}'
# 4. Send exactly amountNear to payTo; near-cli prints the "Transaction ID"
near tokens payer-name.testnet send-near merchant-name.testnet '<amountNear> NEAR' network-config testnet sign-with-keychain send
# 5. Present the payment: same arguments plus the three _payment_ fields
call ',"_payment_id":"nq_…","_payment_tx":"<Transaction ID>","_payment_sender":"payer-name.testnet"' \
| jq '{text: [.result.content[] | select(.type == "text") | .text], receipt: .result.structuredContent.receipt}'The receipt has deposit.explorerUrl and refund.explorerUrl: open both on
testnet.nearblocks.io. Then check both transfers the way the server does,
read-only (no keys):
# the payment
node scripts/near-check-tx.mjs --network testnet --merchant merchant-name.testnet --tx <payment hash> --sender payer-name.testnet \
--state ./nanoodle-out/near-state.json --payment-id nq_…
# the refund (payer and merchant swap places)
node scripts/near-check-tx.mjs --network testnet --merchant payer-name.testnet --tx <refund hash> --sender merchant-name.testnet \
--amount-yocto <receipt refund.yocto>It prints PASS/FAIL for each rule (final, succeeded, receiver, single transfer,
exact amount, inside the quote's time window). Public RPC nodes keep transactions
for only a few days; to check an older one, add
--rpc https://archival-rpc.testnet.fastnear.com. An MCP client that can sign NEAR
transfers (or an agent with a wallet tool) does steps 3–5 itself; clients that
cannot sign need a bridge like the shell above.
Mainnet is --near-network mainnet with a mainnet merchant account and key
(and preferably a keyed RPC first in --near-rpc). Read the
limitations first.
Pay one call on a running server (testnet or mainnet), the way an agent would:
node scripts/near-pay.mjs --url https://your-server --network mainnet \
--payer you.near --payer-key-file ~/.near-credentials/mainnet/you.near.jsonIt asks for a quote, refuses to go on if the network differs or the amount is above
--max-near (default 1), sends ONE transfer of exactly the quoted amount, makes the paid
call, waits for the refund and checks deposit − refund = charged and both transfers on
chain. It prints an explorer link for each transfer and ends PASS with exit 0.
--quote-only stops before any funds move and needs no key. The default call is a tiny
custom workflow (one chat model, 48 output tokens at most); --tool <name> --args '<json>'
pays a saved tool instead.
To pay from a wallet app instead of a key file: run it with --quote-only, send exactly
the quoted amount to the pay-to account from the wallet, then run it again with
--payment-id <nq_…> --payment-tx <hash> in place of the key file.
What a paid server will run
Strangers' graphs run on your server, so NEAR mode accepts only node types whose
inputs come from the caller as text or from upstream NanoGPT nodes, and whose cost
can be bounded before the run: text logic (text, choice, join, comment) and
the NanoGPT model nodes llm, decide, image, edit, tvideo, ivideo,
music, tts and model3d. Refused: upload/media-input nodes, local media
processing (resize, trim, combine…), lipsync, inpaint, custom endpoint nodes,
vision (it sends no output limit; use llm with an image on img1), and nodes
billed by the length of an input clip (vedit, remix, transcribe,
cleanvoice). Also refused: fields that hold URLs or inline data, modelOpts and
extraJson (they are sent to the provider unpriced), a non-numeric maxTokens or
duration, wires into pricing fields, media wired into text fields, and
fragment-less short links. No caller-chosen file, URL or local-media node runs;
ffmpeg may still run on images NanoGPT generated (to shrink one that is too
large to send to the next model, or to fit an image into a decide request).
The graph that runs is the graph that was priced: an llm without maxTokens is
sent max_tokens = 2,000 (or the model's lower maximum), and a video without a
duration is sent the catalog default it was priced at. Every paid node must be
priced by the catalog, and models whose catalog price is set by a live quote at
run time are refused (the refusal names the node and model). Caps: 40 nodes,
200 kB of graph JSON (checked before a share link is inflated), 32 inputs of at
most 20,000 characters (50,000 in total), the deposit cap, and 1,000 open quotes.
Everything is checked before a quote exists, so nobody pays for a call that could
not run. Saved graphs that fail these checks are not offered in NEAR mode, and
neither are the built-in tools.
Limitations
No caller-supplied media (image/audio/video inputs); media must be generated by an upstream NanoGPT node.
Native NEAR and opt-in Circle-issued USDC only; no other NEP-141 tokens or meta-transactions.
The configured RPC is trusted for finality; there is no light-client proof.
Deposits are bounds, not guarantees. Text steps are bounded by
maxTokens, but a provider can still bill more than the catalog suggests (for example a reasoning model's hidden tokens); the charge is capped at the deposit and the operator absorbs the rest.NEAR and USDC checkout text results remain available through the original payment link for 24 hours, including across restarts.
Wallet payments have a pay page and monitoring stream. Exact transfers are detected automatically through RPC; unmatched payments need explicit confirmation.
A transfer for a quote that expired more than an hour earlier is not refunded automatically (the quote is gone); the operator sees it in the merchant account.
The NEAR→XNO swap rate is derived from two USD rates and the server never swaps; the operator carries NEAR/XNO price movement for up to the quote lifetime (30 minutes by default) and until it swaps by hand. The swap margin is the cushion for that.
The full list is in docs/near-payments.md.
Making graphs
Build and test workflows in the nanoodle editor, hit
💾, and drop the downloaded noodle-graph.json into your --graphs folder
(rename it — the filename becomes the tool name). Restart the server (or your
MCP client) to pick up new files.
Describing your tools
The first comment node in a graph doubles as the MCP tool's description: its text leads the auto-derived node chain, so the calling agent reads your words first. Keep it to one sentence saying what the tool produces from what inputs — e.g. "Renders a product mockup image from a one-line feature description." Long text is truncated to 200 characters and whitespace is collapsed, so write for one line. Graphs without a comment just get the node chain, as before.
After each successful run the server records the tool's observed cost in
<out>/costs.json and includes it in the tool description as last run $X.
The stdio server announces description changes with a
notifications/tools/list_changed notification. A fresh tools/list request
reads committed observations, including updates from other MCP processes that
share the output directory. The HTTP landing page and new Nano quotes also
read those observations. Saved-workflow costs follow the executable workflow
definition across files and tool names when they use the same provider base URL.
Built-in tools also track costs by provider. Equivalent URLs share history, and
different API path prefixes have separate histories. Older records without a
workflow or provider identity remain in the sidecar for reference. Tools start
a new observed history when no record matches both identities.
MCP processes sharing a local output directory coordinate cost updates with
costs.json.lock. Leave that file in place while the processes are running.
Limitations
Honest list — most of these are inherited from the executor:
Feed-forward DAGs only. nanoodle graphs are stateless pipelines; there are no loops, no conversations, no memory between calls.
One run per call, no streaming. A
tools/callblocks until the whole workflow finishes — video graphs can take minutes. No MCP progress notifications yet.Graphs load once at startup. Adding or editing files in
--graphsneeds a restart; the tool list doesn't change mid-session (nolistChangednotifications).Headless coverage follows
nanoodle0.9.0 (this package's dependency). Local-media graphs (resize, combine, trim, extract-audio, video-frames, soundtrack) run on your machine — pure JS where possible, ffmpeg onPATHfor the rest. Decide, Clean voice (cleanvoice), 3D model (model3d), 3D input (mupload), and custom endpoint nodes also load and run; they are not skipped at startup. A closed Decide gate is a normalgatedresult. See the supported-nodes table. A graph with a node type the library doesn't know is still skipped at startup with a stderr note.Media rides inline. NanoGPT has no upload endpoint, so media inputs are sent as base64 in the request body (~4 MB max, checked before spending).
No cost cap in key mode. The server won't stop a client from calling an expensive graph repeatedly. Your NanoGPT balance is the only brake. (Wallet mode is better here:
--max-usdcaps each call, and the wallet's balance caps the total.)
No telemetry, no analytics; the API key and wallet secrets are never logged and never appear on stdout.
Testing
Fully offline — the suite spawns the real server against a canned local NanoGPT stub and drives the MCP handshake over stdio:
npm testIt also carries release guards: the three release manifests must agree on the
version, the landing page's chip table may only name node types the nanoodle
library still has, and no startup path may statically import the GPL-3.0
dependency.
Those guards are offline, so they compare repo files to each other and cannot
see npm. One more guard needs the network and therefore runs in the publish
workflow, not in npm test: scripts/assert-npm-version.mjs fails the registry
publish unless server.json's version is really on npm. See
PUBLISHING.md.
The optional ACP v2 seller qualification has its own pinned SDK dependencies and offline test command. Its adapter is disabled by default and has no live wallet, registry or payment integration.
Registry
server.json is the official MCP registry
manifest (io.github.nanoodlecom/nanoodle-mcp); see PUBLISHING.md
for the release checklist.
Agent identity
One identity, every directory. server.json is the source of truth; two
further documents are generated from it (npm run build:identity) and checked
for drift on every npm test:
agent-card.json— the A2A Agent Card, for serving athttps://mcp.nanoodle.com/.well-known/agent-card.jsonagent-registration.json— the ERC-8004 / Solana 8004 registration file, for serving athttps://mcp.nanoodle.com/.well-known/agent-registration.json
Where nanoodle is listed (NEAR Agent Market, MCP Registry, npm), the refresh
procedure, and the one-command registry publish
(npm run publish:registry -- --execute, dry-run without --execute) live in
docs/agent-identity.md.
Optional integrations
ASI Agentverse (inactive by default) — a Python uAgent sidecar in
integrations/agentverse/that exposes this server's workflows to ASI:One / Agentverse chat via the Agent Chat Protocol, settling paid runs through this server's existing payment links. Registration is a deliberate operator step; see its README and RUNBOOK.
Which repo do I want?
This server exposes saved workflows as typed MCP tools. If your agent supports Agent Skills rather than MCP servers, nanoodle-skill (teaches your agent to build any graph) and noodle-skills (prebuilt one-task workflows) cover similar ground without running a server. Running graphs in GitHub CI? → run-noodle-action.
Licensing
MIT: this server (see LICENSE), the
nanoodle editor, and the
nanoodle executor this server
runs graphs on. The sibling projects — nanoodle-py,
nanoodle-skill,
noodle-skills — are MIT too.
Graphs are not covered by any of that. A noodle-graph.json is its
author's work. Serving one as a tool, or downloading one from /graph/<tool>.json,
does not place it under this repo's licence. The public library this project
maintains, awesome-noodles, is
MIT because that repo says so; the graphs on any other server carry whatever
licence their authors give them.
GPL-3.0: one runtime dependency,
nanocurrency. It derives
Nano keys, builds and signs blocks, and computes proof-of-work. It is used only
by the optional x402 Nano wallet: wallet mode
(NANO_SEED / NANO_PRIVATE_KEY) and charge mode
(--charge-usd). NEAR mode (--near-merchant)
loads it too, because it reuses two helpers from src/gate.mjs; the NEAR code itself
does not call it.
Be clear about what that means for you. Every installer receives it.
npm install nanoodle-mcp and npx -y nanoodle-mcp both download and unpack
nanocurrency onto your disk, whether or not you ever touch x402. Your
dependency tree contains GPL-3.0 code from the moment you install, and it is
redistributed with any bundle or image you build from this package.
What the on-demand load changes is narrower, and only that: which runs
execute it. src/wallet.mjs and src/gate.mjs are the only modules that
touch nanocurrency, and bin/nanoodle-mcp.mjs reaches them through
await import() inside the branches that already gate x402. So a BYOK
(API-key) run never loads or runs GPL-3.0 code — it still has it installed.
tests/gpl-boundary.test.mjs holds that line.
We keep it a normal dependency on purpose. npm installs optionalDependencies
by default, so that would change nothing; the only way to skip it is an
optional peerDependency, and then npx -y nanoodle-mcp — the documented
one-command install — could no longer run wallet or charge mode at all. Correct
labelling beats a broken accountless install.
Not affiliated with NanoGPT or Anthropic. Build workflows at nanoodle.com; run them from code with nanoodle-js / nanoodle-py.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
MCP server for Clipkit — gives AI agents a video toolbox via the Clipkit schema.
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA dual-transport MCP server that exposes your API as tools to LLM clients, supporting both stdio transport for local clients like Claude Desktop and HTTP/SSE transport for remote clients like OpenAI's Responses API.-
- AlicenseBqualityCmaintenanceA lightweight stdio-only MCP server that allows AI agents to run multiple tasks (e.g., Python code, HTTP requests, shell commands) in parallel or with dependencies, returning structured results in a single call.276 PyPIMIT
- FlicenseAqualityCmaintenanceMCP server that wraps MiniMax platform APIs (speech, video, image, music, and file management) as tools over stdio, enabling natural language interaction with MiniMax's AI services.161-
- AlicenseBqualityBmaintenanceMCP server that dynamically exposes each enabled ComfyUI workflow as a tool with JSON Schema, supports job submission with wait and idempotency, file uploads, and resource metadata, with both stdio and authenticated Streamable HTTP transports.36MIT