Use the MCP server
Connect an MCP client with an agent token to rent, generate and read receipts as tools, or with no token to rent a GPU over x402 from a wallet.
Shader runs an MCP server at https://api.shader.win/mcp, over stateless streamable HTTP. A client signs in with an agent token and gets eight tools. You need a key made in Create an agent key and credits in its wallet. Each tool calls the same service as the matching API route, so headroom, the key's caps and the errors are the same as over HTTP.
#Connect a client
Make a key
Create an agent key on Agents and copy its token.
Add the server
Add the server to your MCP client's configuration, with the token in the
Authorizationheader:{ "mcpServers": { "shader": { "url": "https://api.shader.win/mcp", "headers": { "Authorization": "Bearer shdr_<YOUR_AGENT_TOKEN>" } } } }The Agents page shows the same snippet. The server takes agent tokens only, not wallet sessions; a request without one answers 401 with
WWW-Authenticate: Bearer realm="shader".
#The tools
A tool answers with one text item holding the JSON of its result. A failed call answers with isError: true and the API error body, so an agent sees CREDITS_TOO_LOW or AGENT_CAP_EXCEEDED with the same fields as over HTTP.
#list_gpus
Every GPU model with its id, price and free machines. Result: GpuCatalog.
No arguments.
#rent_gpu
Launches a GPU, like POST /instances. Result: InstanceDetail.
| Argument | Type | Meaning |
|---|---|---|
gpu | string | Catalog id, such as h100-sxm-80gb. |
ssh_public_key (optional) | string | Your SSH public key. Without one, a password is generated. |
#get_instance
One instance with its meter, connection details and last settlement. Result: InstanceDetail.
| Argument | Type | Meaning |
|---|---|---|
instance_id | string | Instance id from rent_gpu. |
#stop_gpu
Stops an instance; the last stretch settles. Result: StopInstanceResponse.
| Argument | Type | Meaning |
|---|---|---|
instance_id | string | Instance id from rent_gpu. |
#get_balance
The credit balance, plus agentKey with the key's address, both caps and spentTodayBaseUnits. Result: CreditBalance.
No arguments.
#generate
Starts a generation, like POST /jobs. For voice, prompt is the text to speak. A video without outputSeconds in options runs for 4 seconds. Result: Job.
| Argument | Type | Meaning |
|---|---|---|
kind | one of "image", "video", "voice", "asset3d" | image, video, voice or asset3d; for list_receipts, a receipt kind. |
prompt | string | What to generate, or the text to speak for voice. |
options (optional) | object (free form) | The kind's options, as in the generation request. |
#get_job
One job with its progress, file and receipt. Result: Job.
| Argument | Type | Meaning |
|---|---|---|
job_id | string | Job id from generate. |
#list_receipts
The wallet's receipts, newest first, 24 unless limit says otherwise. Result: ReceiptPage.
| Argument | Type | Meaning |
|---|---|---|
kind (optional) | one of "deposit", "rental_settle", "generation", "x402" | Only receipts of this kind: deposit, rental_settle, generation or x402. |
limit (optional) | integer | How many, 1 to 100. |
#Work with the tools
Check what it can spend
get_balancereturns the credit balance and the key's per-request cap, per-day cap and what it spent today.Rent
list_gpusgives the models and their ids.rent_gpuwith agpuid and, optionally, an SSH public key launches one. The answer carries the instance id, its state and, once it is running, the SSH command and the Jupyter link.Watch and stop
get_instancereads the meter and the last settlement.stop_gpustops the machine and settles the last stretch.Generate
generatewith akindand apromptstarts a job. For voice,promptis the text to speak.get_jobreads its progress, and once it isdone, the file and its receipt.Account for it
list_receiptsreturns what the key's wallet was charged, newest first.
#Rent with no token
An MCP client that can pay x402 can rent a GPU with nothing but a wallet holding USDC, following the x402 MCP transport. With no token the server lists only the tools below.
Connect without a token
Add the server with its URL alone:
{ "mcpServers": { "shader": { "url": "https://api.shader.win/mcp" } } }Ask for the rental
Call
rent_gpuwithgpuandmax_seconds. The result hasisError: trueand thePaymentRequiredquote instructuredContent, with the same JSON incontent[0].text: the locked rate, the ceiling and the memo, as in Rent a GPU over x402.Pay
Sign the channel
openfor that ceiling, then callrent_gpuagain with the payment in_meta["x402/payment"].Use and stop it
The result carries the instance with SSH and Jupyter, the stop token, and the settlement in
_meta["x402/payment-response"]. Read it withget_instance, add time withextend_gpu, and end it withstop_gpu, each withinstance_idandstop_token.
#list_gpus (no token)
The GPU catalog.
No arguments.
#rent_gpu (no token)
Rents a GPU over x402. Called without payment it returns isError: true with the PaymentRequired quote; called again with the payment in _meta["x402/payment"] it launches and returns the instance, the stop token and _meta["x402/payment-response"].
| Argument | Type | Meaning |
|---|---|---|
gpu | string | Catalog id, such as h100-sxm-80gb. |
ssh_public_key (optional) | string | Your SSH public key. Without one, a password is generated. |
max_seconds (optional) | integer | Longest the rental may run, in seconds. |
#extend_gpu (no token)
Extends an x402 rental with another channel at its locked rate, paid the same way as rent_gpu.
| Argument | Type | Meaning |
|---|---|---|
instance_id | string | Instance id from rent_gpu. |
stop_token | string | The rental's stop token, shdrstop_…. |
seconds | integer | Seconds to add. |
#stop_gpu (no token)
Stops an x402 rental with its stop token; the answer has each channel's charge and refund.
| Argument | Type | Meaning |
|---|---|---|
instance_id | string | Instance id from rent_gpu. |
stop_token | string | The rental's stop token, shdrstop_…. |
#get_instance (no token)
One x402 rental, read with its stop token.
| Argument | Type | Meaning |
|---|---|---|
instance_id | string | Instance id from rent_gpu. |
stop_token | string | The rental's stop token, shdrstop_…. |
#What happened
The call
Each tool call ran the same service as the matching API route, under the key's wallet.
Admission
A rental or a generation was checked against the key's caps before it started.
Settlement
A rental settled every 60 seconds with the key named on each line; a generation settled once when its file was ready.
#The receipt
Every charge is a Receipt event naming the key. list_receipts returns them; on Receipts, filter by the key. Receipts explains the fields.
#If it fails
| What you see | Why | Next |
|---|---|---|
HTTP 401 with WWW-Authenticate | No agent token, or a wallet session token | Send Authorization: Bearer shdr_… |
isError with AGENT_CAP_EXCEEDED | The job's cost, or a rental's rate for 1 hour, is above the per-request cap | Pick a smaller job or GPU, or raise the cap |
isError with AGENT_DAILY_CAP_EXCEEDED | Not enough of the day's cap is left | Wait for 00:00 UTC or raise the cap |
isError with CREDITS_TOO_LOW | The wallet's credits do not cover headroom or the estimate | The wallet owner adds credits |
isError with AGENT_TOKEN_REVOKED or AGENT_KEY_REVOKED | The key was revoked | Make a new key |