Member Junction
    Preparing search index...

    Configuration for a server extension instance.

    Loaded from the host serverExtensions[] in mj.config.cjs, and/or discovered from installed Open App server packages (MJ_SERVER_EXTENSIONS export or package.json memberjunction.serverExtensions). Host entries overlay discovered ones by DriverClass.

    Each entry corresponds to one extension instance. The DriverClass field is used to look up the registered class via ClassFactory.CreateInstance().

    // mj.config.cjs
    module.exports = {
    serverExtensions: [
    {
    Enabled: true,
    DriverClass: 'SlackMessagingExtension',
    RootPath: '/webhook/slack',
    Phase: 'pre-auth',
    Settings: {
    AgentID: '...',
    BotToken: process.env.SLACK_BOT_TOKEN,
    }
    }
    ]
    };
    interface ServerExtensionConfig {
        DriverClass: string;
        Enabled: boolean;
        OwnsCORS?: boolean;
        Phase?: ServerExtensionPhase;
        RootPath: string;
        Settings: Record<string, unknown>;
    }
    Index

    Properties

    DriverClass: string

    The @RegisterClass key used to look up this extension in ClassFactory. Must match the second argument of @RegisterClass(BaseServerExtension, 'DriverClass').

    Enabled: boolean

    Whether this extension is enabled. Disabled extensions are skipped during loading.

    OwnsCORS?: boolean

    When true, this extension owns the CORS policy for every request under its RootPath, and MJServer's global CORS middleware skips those paths. Defaults to false.

    Without this, MJServer's global CORS runs ahead of every extension. It reflects any allowed origin onto the extension's responses, including its refusals, and it answers every preflight (OPTIONS) with 204 itself, so the extension's own OPTIONS handler never runs. An extension with its own origin policy, such as a public pre-auth endpoint whose allowed origins are set per resource, cannot enforce that policy.

    With OwnsCORS: true:

    • no Access-Control-* header is added to any response under RootPath by MJServer;
    • preflight requests reach the extension's routes, so the extension must answer OPTIONS itself (for example with the cors package and an origin callback);
    • a path without CORS headers is not readable cross-origin, so an extension that forgets to answer is closed, not open.

    Matching follows Express mount semantics: case-insensitive, on a path-segment boundary (/ballot owns /ballot and /ballot/x, not /ballots). Disabled entries own nothing. MJServer's auth middleware passes OPTIONS through, so the flag also works for 'post-auth' extensions; their 401 responses then carry no CORS headers unless the extension adds them.

    Open Apps can set this in their published MJ_SERVER_EXTENSIONS entries; the host mj.config.cjs serverExtensions[] overlay can override it by DriverClass.

    Lifecycle phase for this extension. Defaults to the extension class's DefaultPhase (usually 'pre-auth') when not specified.

    RootPath: string

    URL path prefix for this extension's routes (e.g., '/webhook/slack'). The extension registers its routes under this prefix on the Express app.

    Settings: Record<string, unknown>

    Extension-specific configuration. The shape varies by extension type. For messaging adapters, this contains AgentID, BotToken, etc. The extension is responsible for parsing and validating its own settings.