A high-performance native library for reading Magic: The Gathering Arena game memory. Extract player data, card collections, inventory, and more directly from the running game process.
- Cross-platform - Windows and Linux support with prebuilt binaries
- Node.js bindings - First-class npm package powered by napi-rs
- Memory introspection - Browse assemblies, classes, instances, and dictionaries
- Zero runtime dependencies - Pure Rust core with no external requirements
npm install mtga-reader
# or
yarn add mtga-readerconst mtga = require('mtga-reader');
// Check if MTGA is running and read card collection
if (mtga.findPidByName('MTGA')) {
const cards = mtga.readData('MTGA', [
'WrapperController',
'<Instance>k__BackingField',
'<InventoryManager>k__BackingField',
'_inventoryServiceWrapper',
'<Cards>k__BackingField',
'_entries',
]);
console.log(`You have ${cards.length} unique cards!`);
}Note: Reading game memory requires administrator/root privileges.
| Function | Description |
|---|---|
readData(processName, path) |
Traverse a path of fields from a root class |
readClass(processName, address) |
Read a managed class at a memory address |
readGenericInstance(processName, address) |
Read a generic instance at an address |
findPidByName(processName) |
Check if a process exists |
isAdmin() |
Check for administrator privileges |
This repository includes two test projects for development and debugging:
A React-based web interface for exploring MTGA memory structures interactively.
# Start the HTTP server (requires admin privileges)
cargo run --bin http_server_simple
# In another terminal, start the UI
cd debug-ui
npm install && npm run devBrowse assemblies, inspect classes, read static instances, and explore dictionaries through a visual interface at http://localhost:3000.
A standalone Node.js test project demonstrating the native addon API.
cd node-test
npm install
npm run build
npm test # Run as administratorTests the full API including assembly enumeration, class inspection, and data reading paths.
- Rust toolchain (stable)
- Node.js 16+
- MTGA installed and running (for testing)
# Development build
yarn build:debug
# Production build
yarn build# Run with MTGA open (requires admin)
cargo run --bin debugTests in lib.rs require MTGA to be running and cannot be automated in CI.
All releases are automated via GitHub Actions:
npm version patch|minor|major
git push --follow-tagsThis triggers the napi-rs workflow which builds binaries for all platforms and publishes to npm.
This is a Rust port of Unity Spy, adapted for MTGA. The codebase reads Mono runtime structures directly from memory, enabling access to game state without log file parsing.
References: