Skip to content

Custom agents

nuez uses standard MCP (Streamable HTTP) on a single POST /mcp endpoint. Any MCP client library can connect to it — just point it at that URL with your API key as a Bearer token.

import asyncio
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
async def main():
async with streamablehttp_client(
"https://sandbox-mcp.nuez.app/mcp",
headers={"Authorization": "Bearer nz_YOUR_KEY_HERE"},
) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
# Check balance
result = await session.call_tool("get_balance", {})
print(result)
# Send a payout
result = await session.call_tool("request_payout", {
"amount": 1000,
"destination": "0000003100010000123456",
"destination_kind": "CBU",
"note": "Payment for services",
"idempotency_key": "unique-key-per-payout",
})
print(result)
asyncio.run(main())

TypeScript (with @modelcontextprotocol/sdk)

Section titled “TypeScript (with @modelcontextprotocol/sdk)”
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
const transport = new StreamableHTTPClientTransport(
new URL("https://sandbox-mcp.nuez.app/mcp"),
{
requestInit: {
headers: { Authorization: "Bearer nz_YOUR_KEY_HERE" },
},
}
);
const client = new Client({ name: "my-agent", version: "1.0.0" });
await client.connect(transport);
const balance = await client.callTool({ name: "get_balance", arguments: {} });
console.log(balance);

MCP over Streamable HTTP is just JSON-RPC 2.0 over POST. You don’t need an SDK to call it:

Terminal window
curl -X POST https://sandbox-mcp.nuez.app/mcp \
-H "Authorization: Bearer nz_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

Every result comes back as result.content[0].text (a JSON string to parse yourself) — see MCP setup.