Are you the author? Sign in to claim
Treasury infrastructure for AI agents on Stellar — custody, policy, liquid/yield split, and payment rails.
Treasury infrastructure for AI agents on Stellar — custody, policy, liquid/yield split, and payment rails so an agent can hold and move capital without holding a private key.
Agents can plan and call tools; they still need a place for capital to live, earn, and leave under bounds. Nebula is that treasury layer: each agent gets an isolated Stellar wallet, a liquid band for spend, optional Blend yield on idle funds, and an on-chain policy ledger the Hub enforces before it signs spend.
Private keys never leave the Hub. Agents and MCP clients only present a nbl_live_… token (or OAuth). The Hub enforces policy, confirms when required, signs with Privy custody, and submits to Stellar — the agent only expresses intent.
flowchart TB
subgraph clients [Clients]
CD[Claude Desktop / Cursor]
CC[Claude Code]
RM[Remote MCP / OAuth]
end
subgraph npm [MCP package]
STDIO["nebulamcp-stdio<br/>stdio → Hub HTTP"]
end
subgraph hub [Nebula Hub — apps/nebula-hub]
UI[Dashboard · NetworkChip · Treasury · Policy]
API["/api/tools/* · /api/wallet · /api/agents"]
MCP["POST /mcp · OAuth DCR"]
PIPE[Tool pipeline + confirmations]
PRIVY[Privy embedded Stellar wallet]
end
subgraph chain [Stellar]
POLT[Policy · testnet]
POLM[Policy · mainnet]
TREAS[Blend liquid / yield]
NET[Payments · x402 · MPP]
end
subgraph data [Data]
SB[(Supabase Postgres)]
end
CD --> STDIO
CC --> STDIO
STDIO -->|"NEBULA_TOKEN"| API
RM --> MCP
MCP --> PIPE
API --> PIPE
UI --> API
PIPE --> PRIVY
PIPE --> POLT
PIPE --> POLM
PRIVY --> TREAS
PRIVY --> NET
PIPE --> SB
UI --> SB
| Layer | Role |
|---|---|
Hub (apps/nebula-hub) | Next.js app: Privy auth + custody, treasury/policy UI, tool APIs, remote Streamable HTTP MCP |
nebulamcp-core | Shared Zod tool schemas + confirmation / policy matrix |
nebulamcp-stdio | Thin stdio MCP client → Hub (npx nebulamcp-stdio) |
Landing (apps/landing) | Marketing site; built into Hub public/landing for deploy |
Policy contract (contracts/policy) | Shared multi-tenant Soroban policy; one deploy per ledger (POLICY_CONTRACT_ID_TESTNET / _MAINNET) |
Full phase status and stack map: docs/ARCHITECTURE.md.
Switching the NetworkChip (dashboard) updates User.preferredNetwork and reloads the Hub against that ledger.
| Testnet | Mainnet | |
|---|---|---|
| Agents | Own rows + Privy wallets | Separate twin agents (not auto-cloned) |
| Policy / treasury / history | Scoped to network=testnet | Scoped to network=mainnet |
| On-chain policy | CAWKC7IEHVKM5V5JVXJE4HNWCM5CHZZHFYH33W5O7EEEQIND6TJ3CD2F | CCPXPACO3V2FISPN5CY5LGFSU7XI5QBVMHOC25ITJVTCIF2P3OCNILWU |
| Blend | TestnetV2 (XLM) | Fixed + YieldBlox (XLM + USDC) |
| Fianza / TrustLine credit | Available | Not enabled until Fianza pubnet API |
MCP tokens bound to an agent always use that agent’s ledger, not the owner’s NetworkChip preference.
Deploy notes and invoke examples: contracts/policy/README.md. Schema backfill SQL: apps/nebula-hub/prisma/sql/20260725_network_isolation.sql.
nebula/
├── apps/
│ ├── nebula-hub/ # Custody + treasury Hub (dashboard + APIs + /mcp)
│ └── landing/ # Marketing site → hub public/landing
├── packages/
│ ├── nebulamcp-core/ # nebulamcp-core (shared schemas)
│ └── nebulamcp/ # nebulamcp-stdio (bin: nebulamcp)
├── contracts/policy/ # Soroban policy + treasury-band contract
└── docs/ # Architecture, structure, setup guides
Layout details: docs/STRUCTURE.md.
Prerequisites: Node 18+, pnpm 10+, and a Supabase Postgres database.
pnpm install
# Hub locally (needs apps/nebula-hub/.env.local — copy from .env.example)
pnpm --filter nebulamcp-core build
pnpm --filter nebula-hub dev # → http://localhost:3000
# Optional: marketing site alone
pnpm --filter nebulamcp-core build && pnpm --filter nebula-landing build
pnpm --filter nebula-landing preview
Avoid running local Hub and production against the same Supabase project at once — they share the Prisma pool and can time out.
Env template: apps/nebula-hub/.env.example — copy to apps/nebula-hub/.env.local.
Database: Supabase Postgres — see docs/SUPABASE.md. Apply apps/nebula-hub/supabase/hub.sql, then the network-isolation SQL if upgrading an older DB.
Minimum for a working Hub:
| Group | Variables |
|---|---|
| Database | DATABASE_URL, DIRECT_URL |
| Privy custody | NEXT_PUBLIC_PRIVY_APP_ID, PRIVY_APP_ID, PRIVY_APP_SECRET, PRIVY_AUTHORIZATION_PRIVATE_KEY |
| App origin | NEXT_PUBLIC_APP_URL, APP_BASE_URL |
| Wallet sign-in | WALLET_SESSION_SECRET (HMAC for Freighter/EOA SIWS — required in production) |
| Deploy default ledger | STELLAR_NETWORK=testnet (per-user NetworkChip overrides this) |
On-chain policy (recommended for production):
| Variable | Ledger | Contract |
|---|---|---|
POLICY_CONTRACT_ID_TESTNET | testnet | CAWKC7IEHVKM5V5JVXJE4HNWCM5CHZZHFYH33W5O7EEEQIND6TJ3CD2F |
POLICY_CONTRACT_ID_MAINNET | mainnet | CCPXPACO3V2FISPN5CY5LGFSU7XI5QBVMHOC25ITJVTCIF2P3OCNILWU |
Legacy POLICY_CONTRACT_ID is still accepted as a testnet-only fallback. It is never applied to mainnet.
Optional: MAINNET_ENABLED=0 (kill-switch), TAEL_PARTNER_SIGN_URL / TAEL_HMAC_SECRET (partner signing), Upstash Redis (rate limits). The template documents every variable.
nbl_live_… token.Never put a Stellar secret key in MCP config — only
NEBULA_TOKEN.
Published: nebulamcp-stdio (depends on nebulamcp-core). Use this when the client only speaks local stdio MCP — it runs npx and forwards tools to the Hub. You do not need it for Claude Code or custom agents that can call HTTP.
{
"mcpServers": {
"nebula": {
"command": "npx",
"args": ["-y", "nebulamcp-stdio"],
"env": {
"NEBULA_TOKEN": "nbl_live_…",
"NEBULA_HUB": "https://www.nebulaonchain.xyz"
}
}
}
}
Package docs: packages/nebulamcp/README.md.
No npm install — point the client at Hub Streamable HTTP:
POST https://www.nebulaonchain.xyz/mcp
Authorization: Bearer nbl_live_…
Claude Code:
claude mcp add --transport http nebula https://www.nebulaonchain.xyz/mcp \
-s user \
--header "Authorization: Bearer nbl_live_…"
OAuth DCR for hosted connectors is also on the Hub (/api/oauth/register → /authorize → /oauth/token). More: docs/MCP-DEV.md.
| Capability | Tools / surface |
|---|---|
| Treasury | Blend deposit/withdraw, liquid band, auto-yield on activity |
| Credit | Fianza / TrustLine revenue-underwritten USDC credit (testnet only): trustline_* |
| Wallet | Balances, identity, fund (testnet), transfer |
| Policy | Caps, allow/deny lists; on-chain check_spend when that ledger’s contract id is set |
| Swap | XLM ↔ Circle USDC on Stellar DEX (get_swap_quote, swap) |
| Confirmations | Human approve flow + await_confirmation (ledger-stamped) |
| x402 | Pay-walled HTTP via Stellar USDC |
| MPP | Open session → fetch → close / settle (per network) |
| Reputation | Stellar8004-backed agent reputation (Hub-provisioned) |
Tael Protocol — Nebula's capabilities are listed on Tael so Tael agents can discover and call them, paying per call in USDC on Stellar. Read-only capabilities are live; agent-spend signing (Tael card via partner_callback) is rolling out next.
TrustLine / Fianza — revenue-underwritten, uncollateralized USDC credit for AI agents on Stellar (testnet). Nebula MCP exposes trustline_* tools; the Hub signs with Privy instead of handing agents a secret key (SDK v0.2).
| Doc | Contents |
|---|---|
| ARCHITECTURE.md | Phase status, stack map |
| STRUCTURE.md | Repo layout |
| SUPABASE.md | Database setup |
| MCP-DEV.md | MCP testing (x402, MPP, confirmations) |
| contracts/policy | Soroban policy + treasury-band API + testnet/mainnet deploy |
| packages/nebulamcp | stdio MCP client |
This is a pnpm workspace. Before opening a PR:
pnpm --filter nebula-hub run typecheck # tsc --noEmit
pnpm --filter nebula-hub run build # prisma generate + next build
Keep private keys and .env.local out of commits (only .env.example is tracked).
Run Claude Code as an MCP server so any agent can delegate coding tasks to it
Browser automation using accessibility snapshots instead of screenshots
Google's universal MCP server supporting PostgreSQL, MySQL, MongoDB, Redis, and 10+ databases
Official GitHub integration for repos, issues, PRs, and CI/CD workflows