For AI Agents

xStocker Agent API

A stateless HTTP API that lets AI agents build Solana transactions to trade tokenized U.S. stocks (xStocks). An agent with its own wallet signs and sends the transaction itself; for a person with Phantom or another Solana wallet, the agent hands over a Solana Pay link or QR code and the person approves it in their own wallet. No account. No API key. No OAuth.

View asset list → agent.json MCP server npm SDK → npm MCP →

Supported Assets

NVDAx NVIDIA
TSLAx Tesla
AAPLx Apple
MSFTx Microsoft
AMZNx Amazon
GOOGLx Alphabet
METAx Meta
SPYx SP500

Plus many more tokenized stocks and ETFs, kept up to date automatically. Full machine-readable list: xstocker.com/agent/assets.json — a static file, no API call needed.

How It Works

01
Discover assets
Read xstocker.com/agent/assets.json — a static file listing every tradable xStock and its mint address. No API call needed; cache it.
02
Build an order
POST api.xstocker.com/agent/build-order with a wallet, asset, and amount. Get back an unsigned transaction.
03
Sign
An agent with its own signer signs the transaction. A person gets a Solana Pay link or QR and approves it in their own wallet, e.g. Phantom. xStocker never holds keys or funds.
04
Verify on-chain
GET api.xstocker.com/agent/order/{signature} confirms the trade landed on Solana.

Core Endpoints

GET xstocker.com/agent/assets.json Static file: tradable xStocks with mint addresses (no API call)
POST api.xstocker.com/agent/build-order Build an unsigned buy or sell transaction
GET xstocker.com/agent/pay?asset=&amount=&side=&pay_token=&partner= Solana Pay transaction request (wallet GET + POST), works in Phantom
GET api.xstocker.com/agent/order/{signature} Check on-chain confirmation status
GET api.xstocker.com/agent/partners/check?wallet= Check a wallet can receive referral fees (no registration)
POST api.xstocker.com/agent/mcp MCP server (Streamable HTTP)
GET xstocker.com/.well-known/agent.json Machine-readable service description

Examples

Buy
POST api.xstocker.com/agent/build-order { "wallet": "USER_SOLANA_ADDRESS", "asset": "NVDAx", "amount": 100, "pay_token": "USDC", "side": "buy" } → 200 OK { "status": "ready", "transaction": "base64_transaction", "details": { "side": "buy", "asset": "NVDAx", "amountIn": "100 USDC", "expectedOut": "0.470123 NVDAx", "fee": "0.500000 USDC" }, "solanaPayUrl": "solana:https%3A%2F%2Fxstocker.com%2Fagent%2Fpay%3Fasset%3DNVDAx%26amount%3D100..." }
Sell
POST api.xstocker.com/agent/build-order { "wallet": "USER_SOLANA_ADDRESS", "asset": "NVDAx", "amount": 0.5, "pay_token": "USDC", "side": "sell" } → 200 OK { "status": "ready", "transaction": "base64_transaction", "details": { "side": "sell", "asset": "NVDAx", "amountIn": "0.5 NVDAx", "expectedOut": "212.340000 USDC", "fee": "1.061700 USDC" } }

On a sell, amount is in the units your wallet shows (xStocks are scaled-UI tokens, so this can differ from the raw on-chain amount). Up to 8 decimals; pass it as a number or a string. The API converts it to the exact on-chain amount and never sells more than the wallet holds.

Sell everything
POST api.xstocker.com/agent/build-order { "wallet": "USER_SOLANA_ADDRESS", "asset": "NVDAx", "amount": "max", "side": "sell" } // "max" sells the entire balance: the API reads the exact on-chain balance itself. // details.amountIn shows how much was sold. "max" works on sells only.
With a referral partner

No registration, no API key, no claiming. A partner is just a Solana wallet address: pass it as partner and the partner's fee is sent to that wallet, on-chain, in the same transaction as the trade. The trader pays it on top of the standard fee (0.25% by default; USDC trades go to the partner's USDC token account, SOL trades to the wallet).

POST api.xstocker.com/agent/build-order { "wallet": "...", "asset": "NVDAx", "amount": 100, "partner": "PARTNER_WALLET_ADDRESS" } → details.partnerFee: { "applied": true, "bps": 25, "amount": "0.25 USDC", "destination": "..." } // Works in the Solana Pay link too (partner= is added to it automatically), including in Phantom. // Check a wallet can receive fees (it needs a USDC token account for USDC trades): GET api.xstocker.com/agent/partners/check?wallet=PARTNER_WALLET_ADDRESS → { "usdc": { "ready": true }, "sol": { "ready": true }, "fee_bps": 25 } // If the partner account can't receive the fee, the trade is still built normally // and details.partnerFee says why: { "applied": false, "reason": "partner_usdc_account_missing" }

Solana Pay (for people with a wallet)

When a person, not the agent, holds the wallet, skip the signing step: give them a solana: link or QR code. Their wallet (Phantom and other Solana Pay wallets) opens it, shows the trade, and the person approves it. The transaction is built at the moment the wallet asks for it, so it never expires while the person decides. The link is served from xstocker.com and works in Phantom without a security warning.

// 1. Build the link yourself — no API call needed: const url = "https://xstocker.com/agent/pay?asset=NVDAx&amount=100&side=buy&pay_token=USDC"; const link = "solana:" + encodeURIComponent(url); // link = solana:https%3A%2F%2Fxstocker.com%2Fagent%2Fpay%3Fasset%3DNVDAx%26amount%3D100%26side%3Dbuy%26pay_token%3DUSDC // With a referral partner: add partner= (any Solana wallet address). Its fee is paid on-chain in the same transaction. const urlWithPartner = url + "&partner=PARTNER_WALLET_ADDRESS"; const linkWithPartner = "solana:" + encodeURIComponent(urlWithPartner); // linkWithPartner = solana:https%3A%2F%2Fxstocker.com%2Fagent%2Fpay%3Fasset%3DNVDAx%26amount%3D100%26side%3Dbuy%26pay_token%3DUSDC%26partner%3DPARTNER_WALLET_ADDRESS // 2. Show it as a link or a QR code. build-order / MCP build_order also return it as solanaPayUrl. // Parameters: asset, amount, side (buy|sell), pay_token (USDC|SOL), // partner (optional referral wallet, paid on-chain in the same transaction). // Sell: amount is in the units the wallet shows, or "max" for the whole balance. // Slippage: 0.5%.

Under the hood this is the standard Solana Pay transaction request: the wallet sends GET (label and icon), then POST with {"account": "WALLET_ADDRESS"} and receives a base64 transaction to sign.

Embed the widget (for websites)

Add a “Buy xStocks” widget to any website with one iframe. Visitors scan the QR code with their wallet or copy the Solana Pay link: no wallet connection, no sign-up, and the buyer approves the trade in their own wallet. Add your Solana wallet as partner to earn 0.25% of every purchase made through your widget, paid on-chain in the same transaction.

You can customize
  • Partner wallet: earn 0.25% of every purchase
  • Theme: auto, dark or light
  • Language: English by default, 10 languages
  • Size: width and height
Set by xStocker
  • Quick buttons: the current top 5 xStocks
  • Payment in USDC or SOL
  • Search covers every xStock
Auto follows the visitor’s light or dark system setting.
Texts of the widget. Add the language that matches your site.
Live preview
partnerOptional. Your Solana wallet. It receives 0.25% of each purchase, on-chain, in the same transaction. The wallet needs a USDC token account to receive fees on USDC purchases.
themeauto (default), dark or light.
langen (default), ru, es, pt, de, fr, it, zh, ja or ar. Arabic switches the widget to right-to-left.
stocksNot configurable. The quick buttons always show the current top 5 xStocks by holders, and search covers every xStock.
size640 px wide is recommended; the widget adapts down to about 280 px (below 560 px the QR code moves under the controls and it gets taller). Use the height the configurator shows, or let the page size it automatically with the snippet below.

Optional: automatic height. The widget reports its height to the page that embeds it:

window.addEventListener('message', function (e) { if (e.origin === 'https://xstocker.com' && e.data && e.data.type === 'xstocker-embed-height') { document.getElementById('xstocker-widget').style.height = e.data.height + 'px'; } });

MCP Server

Connect any MCP-compatible assistant (Claude, Cursor, and others) directly — no code, no API key. The server is stateless and non-custodial: it prepares orders, it never executes them and never sees a private key.

// Remote MCP server (Streamable HTTP) https://api.xstocker.com/agent/mcp // Local (stdio) server for Claude Desktop, Cursor and other stdio clients: { "mcpServers": { "xstocker": { "command": "npx", "args": ["-y", "@xstocker/mcp"] } } } // Optional: add your referral partner wallet to every build_order { "mcpServers": { "xstocker": { "command": "npx", "args": ["-y", "@xstocker/mcp"], "env": { "XSTOCKER_PARTNER_WALLET": "YOUR_WALLET_ADDRESS" } } } }

The local server is the @xstocker/mcp package on npm, also listed in the official MCP Registry as com.xstocker/agent-mcp.

→ @xstocker/mcp on npm

list_assetsTradable xStocks and accepted pay tokens
build_orderQuote and Solana Pay link for a buy or sell — nothing is executed
get_order_statusOn-chain status of a signed transaction
check_partnerCheck a wallet can receive referral fees

npm SDK

A thin TypeScript wrapper over every endpoint above — no need to hand-roll fetch calls.

npm install @xstocker/agent-sdk import { xstocker } from "@xstocker/agent-sdk"; const { assets } = await xstocker.getAssets(); const order = await xstocker.buildOrder({ wallet: "USER_SOLANA_ADDRESS", asset: "NVDAx", amount: 100, side: "buy", // or "sell" (amount: "max" sells the whole balance) payToken: "USDC", // or "SOL" }); const status = await xstocker.getOrderStatus(signature);

→ @xstocker/agent-sdk on npm

→ @xstocker/mcp on npm

Design Principles

Non-custodial. xStocker never holds user funds or private keys.
No accounts. No registration, no API keys, no OAuth flow required to trade.
Stateless trades. Every build-order request is self-contained.
Verifiable. Every trade settles and is confirmable on Solana.
⚠ Trading tokenized equities involves risk, including loss of principal. xStocks are issued by Backed Finance AG and are not available to U.S. citizens or residents. Prices, quotes, and execution are provided by Jupiter. xStocker does not custody funds or provide investment advice.