This repository is an MCP server for Scryfall-backed Magic: The Gathering workflows. Contributions should improve correctness, Scryfall compliance, maintainability, or developer ergonomics without expanding the project into unrelated MTG tooling.
- Install dependencies with
npm install. - Copy
.env.exampleto.envif you need to override defaults. - Start local development with
npm run dev. - Run validation before opening a pull request:
npm run lintnpm run type-checknpm test
- Keep TypeScript strict and avoid
any. - Use the existing
ScryfallClient, rate limiting, and cache layers instead of bypassing them. - Prefer focused changes over large speculative refactors.
- Use Pino logging instead of
console. - Preserve or improve Scryfall API compliance.
- Add or update Vitest coverage for behavior changes.
- Keep tests in
tests/**/*.test.ts. - If a change affects tool contracts, include both success and failure-path coverage.
- For large cached payloads, avoid
JSON.stringify()as a hot-path size estimator. Prefer explicit size hints or cheap approximate sizing. - Cache keys must include every input that can change returned data, ordering, pagination, or upstream request parameters.
- Backoff and retry timing should have one owner. Avoid sleeping in both the failing request path and the next-request scheduling path.
- Cache hits should avoid structural mutations unless a benchmark shows they are necessary.
- If a heuristic assumes concurrency, verify it matches the actual scheduler and rate limiter.
- For large remote JSON payloads, prefer streamed processing over full in-memory materialization when the response shape allows it.
- Use TDD for performance-sensitive refactors: write a characterization test first, then refactor under that test.
- Use a clear summary that explains the user-visible or maintainer-visible change.
- Link related issues when applicable.
- Mention any compliance, caching, or rate-limiting implications.
- Include representative examples when tool output changes.
- Update
README.mdwhen setup, usage, or exposed capabilities change. - Keep internal planning artifacts and AI-assistant instruction files out of the public repository.