A smartcard and NFC IDE
Card Spy works with smartcards and NFC tags through any PC/SC reader. Send APDUs, explore cards, write scripts in TypeScript, and record a card to replay without it.
Card explorer
Explore a card
Explore reads the ATR, the payment applications with their records, counters and transaction log, and the memory and NDEF messages of NFC tags. It also checks for common applications such as PIV, OpenPGP and FIDO.
Values are shown with their names and decoded where the format is known: dates, amounts, currencies, country codes, CVM lists and ISO 7816-4 file control parameters.
APDU console
Send APDUs and read the responses
Type a command in hex, or a shortcut such as select 1PAY.SYS.DDF01. The trace
lists the exchanges from the console, the explorer and scripts, with the command name, status
word and timing. Select one to see the header fields, what the status word means and the
response as a TLV tree. Hovering over a tag highlights its bytes in the hex dump.
On T=0 cards, Card Spy sends GET RESPONSE after 61xx and retries with the
right length after 6Cxx. Both show up in the trace.
Scripts
Scripts in TypeScript
Scripts use a small card API, with type checking and completion in the editor. Run one against any reader, or step through it with F10: Card Spy stops before each APDU and highlights the line that sends it.
const fci = (await card.select('A0000000031010')).expectOk();
log(fci.tlv());
AI agents
Let an agent use your readers
Card Spy has a Model Context Protocol server. Turn it on, and an agent such as Claude Code can list your readers, send APDUs, explore a card, run scripts and work with virtual cards.
Everything it sends appears in the trace beside your own commands, tagged
mcp, so you can see what it did and pick up where it left off.
In Card Spy 3.1 and later.
What's on the card in the reader?
It's a Visa debit card with one payment application, A0000000031010,
labelled VISA DEBIT, listed in the contact payment directory.
The records give the card number 4761 7390 0101 0010 in the name TEST/CARDHOLDER, valid from January 2024 to December 2029, issued in the UK in pounds. It prefers an offline plaintext PIN, then online PIN, then signature.
The PIN has 3 tries left. The transaction counter is at 42, and the card's own log holds its last three transactions, the latest for £12.50.
Things to ask
- What's on this card?
- Which applications does it have, and how do their records differ?
- Write a script that reads every record and lists the tags it finds, and run it.
- Why did my last SELECT come back 6A82?
- Record this card, so I can carry on without the reader.
- Make a virtual card that answers like a PIV card, and test my script against it.
Set it up
- Turn it on. Click MCP in the status bar and tick Let agents on this computer connect.
-
Tell your agent. The dialog shows a command that adds Card Spy to
Claude Code. Copy it and run it in a terminal. Any other client that speaks MCP over
HTTP needs the same URL and
Authorizationheader. - Ask. Start a new session, put a card in a reader or insert a virtual one, and ask what's on it.
Card Spy has to be running for the agent to reach it.
Real cards are read-only
An agent can read a card in a hardware reader, but a command that could change it, such as a PIN try or a write, isn't sent unless you allow it. Virtual cards take anything. Exploring a payment card does advance its transaction counter, as it does when you do it.
Only on your computer
The server is off until you turn it on. It listens on this computer alone, needs a token that Card Spy makes for you, and turns web pages away.
What leaves your computer
What an agent reads from a card, such as a card number or a name, goes to the company that runs its model. A PIN you typed yourself is hidden from an agent reading the trace.
Virtual cards
Save a session with a real card as a virtual card and replay it without the card. Virtual cards are JSON files you can edit and keep in version control. Two demo cards are included.
Readers
Works with contact and contactless PC/SC readers, such as the ACR122U. NFC tags like NTAG and MIFARE Ultralight are read with the reader's storage card commands.
Decoding
EMV and ISO 7816 tag dictionaries, NDEF, a list of known AIDs and status word meanings, including Java Card's. When a card rejects a command, Card Spy suggests the likely reason.
Download
To build from source, clone https://github.com/tomkp/card-spy and run
npm install then npm run dev. The
README has more.