SDK Examples
Use the typed clients on your server. Start with source search, then add chat when you need a generated answer.
Install From a Checkout
Run these commands from the Madeenan repository root. The npm command creates a local package archive. Install that archive in your server application. These instructions do not require a registry release.
Set MADEENAN_API_KEY in your server environment. Never commit it or use a NEXT_PUBLIC_ variable for it. The JavaScript client uses the native Fetch API; use Node.js 22 or supply a compatible fetch adapter.
Search and Read a Source
Results are grouped by source type. A group can be empty. Preserve the reference, translation, grading, and metadata when you display a source. A retrieved passage is evidence to review, not a religious ruling.
Stream an Answer
Render citations from the source and done events. Handle an error event separately from an HTTP failure. Hosted chat uses Madeenan's model configuration and quota; see the Model Key Policy. Do not retry chat automatically: another request can consume more usage.
Cancel Requests and Handle Errors
Keep the request ID for support. Do not log API keys, provider keys, or private request text. Network and cancellation errors can come from the Fetch API rather than MadeenanError.
Use Python
Use AsyncMadeenanClient in an async application. Both clients support source lookups, chat, streaming, and structured errors.
Security note
For assistant tools instead of application code, follow MCP Setup. See Attribution before displaying source content.