Receive the NCPDP SCRIPT message from your Surescripts-connected routing layer; SCRIPT messages arrive as XML conforming to the NCPDP SCRIPT standard schema (version 10.6 or 2017071 depending on your trading partner agreement)
Parse the Message header to extract the sender and receiver DEA or NCPDP provider ID, message ID, and sent time for deduplication and acknowledgment
Extract the patient demographics from the Patient element and match to your internal patient record; use multiple identifiers (name, date of birth, address) for matching because a single identifier is often insufficient
Read the MedicationPrescribed element to capture drug name, NDC or RxNorm code, SIG instructions, quantity, days supply, refills authorized, and DAW (dispense as written) code
Extract the Prescriber element for the ordering provider's NPI, DEA number, and contact information, and the Pharmacy element for the dispensing pharmacy's NCPDP ID
Send a Status message back through Surescripts within the required acknowledgment window (typically within seconds for real-time SCRIPT) to confirm receipt
Known gotchas
NCPDP SCRIPT access requires a Surescripts network agreement — you cannot connect directly to NCPDP; all SCRIPT traffic is routed through the Surescripts network or a certified intermediary
SIG instructions in SCRIPT are structured as a coded SigText element, not free text; rendering them into human-readable label instructions requires a SIG parser that handles NCPDP's structured SIG format
Controlled substance prescriptions transmitted via SCRIPT require EPCS (Electronic Prescribing of Controlled Substances) compliance including prescriber identity proofing and two-factor authentication at prescribing time
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp