MCPcopy Index your code
hub / github.com/ChiriVulpes/scryfall-sdk

github.com/ChiriVulpes/scryfall-sdk @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
221 symbols 385 edges 17 files 6 documented · 3%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

scryfall-sdk

npm GitHub issues Travis

A Node.js SDK for Scryfall written in Typescript.

As of August 8th, 2024, all features described in the Scryfall documentation should be supported. If you see something that isn't, make an issue!

Installation

npm install scryfall-sdk

Using a node.js version older than v18?

Install the axios dependency alongside scryfall-sdk and it will automatically use it.

Basic Example Usage

import * as Scry from "scryfall-sdk";

// ...in some function somewhere...
const chalice = await Scry.Cards.byName("Chalice of the Void");
console.log(chalice.name, chalice.set); // "Chalice of the Void", "a25"

const prints = await chalice.getPrints();
console.log(prints.length); // 7

[!IMPORTANT]
Scryfall requires that all applications provide an agent, except if they are executing from web browser JavaScript.

If this is true for your application, you must set your agent before making any requests: ts Scry.setAgent("MyAmazingAppName", "1.0.0");

Full Documentation

scryfall-sdk supports all features of Scryfall, along with automatically paginating through results, downloading bulk data streams, and more. See the documentation for information on everything you can do.

Know the endpoint you want, but not sure what it looks like in scryfall-sdk? Well, you're in luck: Scryfall-SDK Equivalents for Scryfall Routes

Contributing

Thanks for wanting to help out! Here's the setup you'll have to do:

git clone https://github.com/ChiriVulpes/scryfall-sdk
cd scryfall-sdk
npm install

You can now make changes to the repository.

To compile, then test:

gulp build

To compile and then test on every file change:

gulp watch

MIT License

Copyright 2017-2024 Chiri Vulpes

Extension points exported contracts — how you extend this code

CardFaceMethods (Interface)
(no doc) [2 implementers]
src/api/Cards.ts
RetryStrategy (Interface)
(no doc) [1 implementers]
src/util/MagicQuerier.ts
Migration (Interface)
(no doc)
src/api/Migrations.ts
ICache (Interface)
(no doc)
src/util/Cached.ts
SearchOptions (Interface)
(no doc)
src/api/Cards.ts
MagicArray (Interface)
(no doc)
src/util/MagicEmitter.ts
ImageUris (Interface)
(no doc)
src/api/Cards.ts
Data (Interface)
(no doc)
src/util/MagicQuerier.ts

Core symbols most depended-on inside this repo

byId
called by 45
src/api/Sets.ts
waitForAll
called by 18
src/util/MagicEmitter.ts
on
called by 15
src/util/EventEmitter.ts
search
called by 12
src/api/Sets.ts
byName
called by 12
src/api/Sets.ts
collection
called by 10
src/api/Cards.ts
queryCard
called by 9
src/api/Cards.ts
all
called by 8
src/api/Sets.ts

Shape

Method 121
Function 32
Class 28
Interface 21
Enum 19

Languages

TypeScript100%

Modules by API surface

src/api/Cards.ts71 symbols
src/api/Catalog.ts19 symbols
src/util/MagicEmitter.ts18 symbols
src/util/EventEmitter.ts18 symbols
src/util/MagicQuerier.ts15 symbols
src/api/Sets.ts15 symbols
gulpfile.ts13 symbols
src/util/Cached.ts12 symbols
src/api/BulkData.ts11 symbols
src/api/Rulings.ts8 symbols
src/Scry.ts7 symbols
src/api/Symbology.ts6 symbols

For agents

$ claude mcp add scryfall-sdk \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page