Build on Reliquary
Every tool an assistant uses through MCP is also a REST call: one POST a tool, its arguments as JSON. Use a personal key for a script of your own, or OAuth for an app other players sign in to.
Start with a key
- Sign in, open Assistant, and make a key under API keys: read and write, for the second example below. It is shown once.
- Call a tool with the key as a bearer token:
A read-only key runs the tools that change nothing. A read-and-write key runs every tool, as an assistant can. Revoke a key on the same page, and its next call is refused.
The tools
GET /api/v1/tools lists every tool with what it does, its access, and whether your key may run it. The OpenAPI document gives each tool's arguments as JSON Schema.
Each tool says whether it reads, adds, or changes or removes what is there. Three that delete, delete_deck, remove_holding and deallocate_all, answer with a dry run until you send confirm: true.
An error is JSON: a code, and a sentence that says what to do next. INVALID_INPUT 400, PLAN_LIMIT 402, FORBIDDEN 403, NOT_FOUND 404, OVERALLOCATED 409, RATE_LIMITED 429.
OAuth for an app
An app other players sign in to uses OAuth 2.1 with PKCE (S256). Register it at /oauth/register, or use the address of a client metadata document as its client id. A player approves it on a consent page and can disconnect it on their account page at any time.
Discovery /.well-known/oauth-authorization-server, authorize /oauth/authorize, token /oauth/token. The scope reliquary reaches every tool.
An assistant connects to the MCP server instead: Connect your assistant.
Partner apps
A store or an organiser that takes decklists can ask players for the partner scope. It reaches their decks only: it lists them, reads a list, makes or imports a deck, which is marked as the partner's, and freezes any of their decks (snapshot_deck), kept as a version the player sees. It never sees the collection and never deletes anything.
Only apps we approve may ask for it. Register your app, then write to support@reliquary.gg with its client id.
To look cards up without a player, use GET /api/v1/public/cards?card=…: the catalogue's card data and prices, up to 100 cards a request and 20 requests a minute from one address.
Legality in the player's language
A partner's snapshot_deck answer gives each legality issue its words beside the English message: one of the keys below and its params, so your app can write the sentence in the player's language. A card's name and a format's name in the values stay English. The keys are a contract: a key may be added, never renamed or removed, so show the message for a key you don't know.
bannedcard, formatnot_legalcard, formatcommander_banned_dccard, formatrestrictedcard, count, formatdeck_size_100count, formatdeck_size_60count, formatsideboardcount, formatsideboard_sizecount, formatsingletoncard, count, formatsingleton_limitcard, count, limitcopy_limitcard, count, limitno_commandercommander_not_in_listcardsideboard_companioncount, formatcompanion_not_in_sideboardcardcompanion_bannedcard, formatcompanion_uncheckedcardcompanion.not_companioncardcompanion.gyrudacards, companioncompanion.oboshcards, companioncompanion.kerugacards, companioncompanion.lurruscards, companioncompanion.jeganthacards, companioncompanion.kaheeracards, companioncompanion.umoricards, companioncompanion.zirdacards, companioncompanion.lutricards, companioncompanion.yorioncompanion, count, mininvalid_commandercardinvalid_commander_pdhcard, formatinvalid_commander_pdh_mtgocard, formattoo_many_commanderscountpair.partner_withcard, otherpair.no_matchcard, othercolor_identitycard, colorsproxies_casualcountproxies_tournamentcountunknown_cardscount, names
Webhooks
Reliquary calls an address of yours when something changes, so you need not ask. A player adds up to 3 addresses under Webhooks on the Assistant page, picks their events, and is shown each signing secret once.
import.finished: an import is done, waits for review, or failed.deck.list_changed: a deck's list or its commanders changed, or the deck was deleted.share_link.changed: a link was published, changed or revoked.circle.request_receivedandcircle.request_accepted: a player asked the player into their trade circle, or accepted the player’s request. The other player is named by their handle.swap.proposedandswap.answered: a friend proposed a swap to the player, approved or declined theirs, or took back one proposed to them. The data counts the cards each side gives, never which.
A call is a POST of JSON: the event's id, its type, a timestamp and its data, which holds ids and counts, never a card list. Read the cards with a tool, for a deck export_deck. A deck event counts the deck's claimed copies that are proxies, that are shared with another deck, and its own copies another deck also claims.
Each call is signed as Standard Webhooks signs it, so its libraries check it: the headers webhook-id, webhook-timestamp and webhook-signature. The signature is v1, followed by the base64 HMAC-SHA256 of id.timestamp.body, keyed with the base64-decoded bytes after whsec_. In Node:
Answer with a 2xx within 10 seconds. After any other answer, a redirect among them, or none, the call is tried again after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours and 12 hours, then given up, and the player's page shows the address as failing until a call goes through. An address failing for over a day is called once an event, without retries.
A call may come more than once, and calls may arrive out of order: keep the ids you have seen, and read the current state when one comes. A player's events past 60 a minute are not sent.
A partner app registers its own address for a player over its partner token: PUT /api/v1/webhook with the address as url answers with the secret, once. It hears deck.list_changed alone, without the claims and with made_by_you in place of source, and holds one address a player, counted among the player's addresses; registering again replaces it. GET reads it and DELETE removes it. The player sees it on their page and can remove it, and it is removed when they disconnect the app.
Limits
- A player's calls are counted per day, keys and assistants together: 2,000 calls a day, from 00:00 UTC.
- A partner app makes up to 120 calls a minute, whichever player it calls for.
- What a player's plan holds applies to every caller: past it, a call answers
PLAN_LIMIT.
What you show a player
- A copy that two decks use is shared. Wherever you show a deck, say so and name the other decks: the answers carry it as
shared_detailandalso_shared_with. - A proxy is never an owned real card. Name it wherever you show it, and leave it out of a value unless the player asks for it.
- Show a card's picture as Scryfall serves it, from Scryfall's address: never altered, cropped or covered.
Card data
Card data and pictures come from Scryfall. Reliquary is unofficial Fan Content permitted under the Fan Content Policy. Not approved/endorsed by Wizards. Portions of the materials used are property of Wizards of the Coast. ©Wizards of the Coast LLC.