Install the SDK: `npm install @launchdarkly/node-server-sdk`
Initialize the client at application startup with your SDK key: `const client = ld.init(YOUR_SDK_KEY)`; call `await client.waitForInitialization()` before evaluating flags to ensure the flag ruleset is loaded
Evaluate a flag by calling `client.variation('your-flag-key', userContext, defaultValue)` where `userContext` contains a `key` (unique user or entity identifier) and any targeting attributes
Use `client.variationDetail()` if you need the evaluation reason (targeting rule matched, fallthrough, off, etc.) for logging or debugging
Stream flag changes automatically — the server-side SDK maintains a persistent connection to LaunchDarkly's streaming endpoint and updates flags in memory without requiring restart
Shut down cleanly with `client.close()` on process exit to flush any pending analytics events
Known gotchas
The SDK key is server-side only — never expose it to client-side code or bundle it into a browser build; use the client-side (browser) SDK key for front-end SDKs
If `waitForInitialization` times out (network unreachable), the SDK falls back to serving `defaultValue` for all flags — always choose safe default values that keep the application functional in degraded mode
LaunchDarkly charges per Monthly Active User (MAU) based on unique context keys sent to analytics — avoid using high-cardinality transient values (e.g., request IDs) as the context key
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