diff --git a/README.md b/README.md index 16d2a51..e32bc7d 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,7 @@ For single-tenant mode, configure environment variables: |----------|-------------|----------| | KONTENT_API_KEY | Your Kontent.ai Management API key | ✅ | | KONTENT_ENVIRONMENT_ID | Your environment ID | ✅ | +| KONTENT_MANAGE_API_URL | Kontent.ai Management API URL (defaults to https://manage.kontent.ai/) | ❌ | | PORT | Port for HTTP transport (defaults to 3001) | ❌ | ### Multi-Tenant Mode diff --git a/src/clients/kontentClients.ts b/src/clients/kontentClients.ts index 4ec8a01..dad359b 100644 --- a/src/clients/kontentClients.ts +++ b/src/clients/kontentClients.ts @@ -27,6 +27,9 @@ export const createMapiClient = ( ...(additionalHeaders || []), ]; + const manageApiUrl = + config?.manageApiUrl ?? process.env.KONTENT_MANAGE_API_URL; + return createManagementClient({ apiKey: apiKey ?? @@ -36,7 +39,7 @@ export const createMapiClient = ( environmentId ?? process.env.KONTENT_ENVIRONMENT_ID ?? throwError("KONTENT_ENVIRONMENT_ID is not set"), - baseUrl: config ? `${config.manageApiUrl}v2` : undefined, headers: allHeaders, + baseUrl: manageApiUrl && `${manageApiUrl}v2`, }); };