Integrate NCPDP SCRIPT NewRx e-prescribing into an EHR workflow, transmitting a structured electronic prescription to a pharmacy and handling the RxFill status update response
Construct an NCPDP SCRIPT NewRx XML message with required segments including Message Header (routing and version), Patient, Prescriber, Pharmacy, and Drug segments using NDC, RxNorm, or drug description fields
Look up the target pharmacy's NCPDP routing address (NCPDP Provider ID) in the Surescripts Directory using the pharmacy NPI or NCPDP ID to obtain the correct electronic routing destination
Transmit the NewRx message through the Surescripts network or connected SCRIPT-compliant switch, handling the synchronous network-level acknowledgment and Error response if the message fails routing or format validation
Store the prescription transmission record with status Sent and the network transaction ID, then implement a listener or polling mechanism to receive asynchronous RxFill notification messages from the pharmacy indicating dispense status
Process RxFill messages to update prescription status to Completely Dispensed, Partially Dispensed, or Not Dispensed and surface the fill status to the prescriber in the EHR
Known gotchas
NCPDP SCRIPT messages use a proprietary XML schema that differs from FHIR; the NCPDP FHIR Implementation Guide provides a FHIR-native wrapper but many active pharmacy connections still use legacy SCRIPT XML directly
Surescripts requires production network certification before live e-prescribing; test environment credentials and production credentials are separate and the certification process requires passing message validation test cases
Controlled substance e-prescribing (EPCS) requires additional DEA-mandated two-factor authentication for the prescriber at the time of signing and a separate EPCS-certified identity proofing workflow beyond standard Surescripts onboarding
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