@hasna/domains 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mcp/index.js CHANGED
@@ -31214,6 +31214,7 @@ __export(exports_http, {
31214
31214
  resolveMcpHttpPort: () => resolveMcpHttpPort,
31215
31215
  resetMcpHttpStateForTests: () => resetMcpHttpStateForTests,
31216
31216
  mcpHealthJson: () => mcpHealthJson,
31217
+ isStdioMode: () => isStdioMode,
31217
31218
  isHttpMode: () => isHttpMode,
31218
31219
  handleMcpHttpRequest: () => handleMcpHttpRequest,
31219
31220
  MCP_SERVER_NAME: () => MCP_SERVER_NAME,
@@ -31224,6 +31225,9 @@ import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/
31224
31225
  function isHttpMode(argv) {
31225
31226
  return argv.includes("--http") || process.env["MCP_HTTP"] === "1";
31226
31227
  }
31228
+ function isStdioMode(argv) {
31229
+ return argv.includes("--stdio") || process.env["MCP_STDIO"] === "1";
31230
+ }
31227
31231
  function resolveMcpHttpPort(argv) {
31228
31232
  const portIndex = argv.indexOf("--port");
31229
31233
  if (portIndex >= 0 && argv[portIndex + 1]) {
@@ -31265,7 +31269,7 @@ async function startHttpServer(buildServer, port) {
31265
31269
  return { port: server.port, stop: () => server.stop(true) };
31266
31270
  }
31267
31271
  function resetMcpHttpStateForTests() {}
31268
- var MCP_HTTP_HOST = "127.0.0.1", MCP_SERVER_NAME = "domains", DEFAULT_MCP_HTTP_PORT = 8814;
31272
+ var MCP_HTTP_HOST = "127.0.0.1", MCP_SERVER_NAME = "domains", DEFAULT_MCP_HTTP_PORT = 8859;
31269
31273
  var init_http = () => {};
31270
31274
 
31271
31275
  // src/mcp/index.ts
@@ -36958,17 +36962,38 @@ async function syncToLocalDb2(dbFns) {
36958
36962
  // src/lib/registrar.ts
36959
36963
  init_route53();
36960
36964
 
36965
+ // src/lib/cloudflare-auth.ts
36966
+ function resolveCloudflareConfig(env = process.env) {
36967
+ const accountId = env["CLOUDFLARE_ACCOUNT_ID"] || env["HASNAXYZ_CLOUDFLARE_LIVE_ACCOUNT_ID"] || undefined;
36968
+ if (env["CLOUDFLARE_API_TOKEN"]) {
36969
+ return { apiToken: env["CLOUDFLARE_API_TOKEN"], accountId };
36970
+ }
36971
+ if (env["CLOUDFLARE_API_KEY"] && env["CLOUDFLARE_EMAIL"]) {
36972
+ return { apiKey: env["CLOUDFLARE_API_KEY"], email: env["CLOUDFLARE_EMAIL"], accountId };
36973
+ }
36974
+ if (env["HASNAXYZ_CLOUDFLARE_LIVE_API_KEY"] && env["HASNAXYZ_CLOUDFLARE_LIVE_EMAIL"]) {
36975
+ return {
36976
+ apiKey: env["HASNAXYZ_CLOUDFLARE_LIVE_API_KEY"],
36977
+ email: env["HASNAXYZ_CLOUDFLARE_LIVE_EMAIL"],
36978
+ accountId
36979
+ };
36980
+ }
36981
+ return accountId ? { accountId } : {};
36982
+ }
36983
+ function cloudflareAuthHeaders(cfg) {
36984
+ if (cfg.apiToken)
36985
+ return { Authorization: `Bearer ${cfg.apiToken}` };
36986
+ if (cfg.apiKey && cfg.email)
36987
+ return { "X-Auth-Key": cfg.apiKey, "X-Auth-Email": cfg.email };
36988
+ throw new Error("Cloudflare credentials not configured. Set CLOUDFLARE_API_TOKEN, or CLOUDFLARE_API_KEY + CLOUDFLARE_EMAIL.");
36989
+ }
36990
+
36961
36991
  // src/lib/cloudflare.ts
36962
36992
  function getConfig3() {
36963
- return {
36964
- apiToken: process.env["CLOUDFLARE_API_TOKEN"],
36965
- accountId: process.env["CLOUDFLARE_ACCOUNT_ID"]
36966
- };
36993
+ return resolveCloudflareConfig();
36967
36994
  }
36968
36995
  function checkCredentials2(cfg) {
36969
- if (!cfg.apiToken) {
36970
- throw new Error("Cloudflare credentials not configured. Set CLOUDFLARE_API_TOKEN environment variable.");
36971
- }
36996
+ cloudflareAuthHeaders(cfg);
36972
36997
  }
36973
36998
  var CF_BASE = "https://api.cloudflare.com/client/v4";
36974
36999
  async function cfFetch(path, opts = {}) {
@@ -36977,7 +37002,7 @@ async function cfFetch(path, opts = {}) {
36977
37002
  const res = await fetch(`${CF_BASE}${path}`, {
36978
37003
  method: opts.method ?? "GET",
36979
37004
  headers: {
36980
- Authorization: `Bearer ${cfg.apiToken}`,
37005
+ ...cloudflareAuthHeaders(cfg),
36981
37006
  "Content-Type": "application/json"
36982
37007
  },
36983
37008
  body: opts.body ? JSON.stringify(opts.body) : undefined
@@ -38928,16 +38953,17 @@ function buildServer() {
38928
38953
  }
38929
38954
  async function main() {
38930
38955
  const argv = process.argv.slice(2);
38931
- if ((await Promise.resolve().then(() => (init_http(), exports_http))).isHttpMode(argv)) {
38932
- const { resolveMcpHttpPort: resolveMcpHttpPort2, startHttpServer: startHttpServer2 } = await Promise.resolve().then(() => (init_http(), exports_http));
38933
- const port = resolveMcpHttpPort2(argv);
38934
- await startHttpServer2(buildServer, port);
38935
- await new Promise(() => {});
38956
+ const { isStdioMode: isStdioMode2 } = await Promise.resolve().then(() => (init_http(), exports_http));
38957
+ if (isStdioMode2(argv)) {
38958
+ const transport = new StdioServerTransport;
38959
+ await buildServer().connect(transport);
38960
+ console.error("domains MCP server running on stdio");
38936
38961
  return;
38937
38962
  }
38938
- const transport = new StdioServerTransport;
38939
- await buildServer().connect(transport);
38940
- console.error("domains MCP server running on stdio");
38963
+ const { resolveMcpHttpPort: resolveMcpHttpPort2, startHttpServer: startHttpServer2 } = await Promise.resolve().then(() => (init_http(), exports_http));
38964
+ const port = resolveMcpHttpPort2(argv);
38965
+ await startHttpServer2(buildServer, port);
38966
+ await new Promise(() => {});
38941
38967
  }
38942
38968
  if (import.meta.main) {
38943
38969
  main().catch((error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/domains",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "Domain portfolio and DNS management for AI agents — CLI + MCP server with SQLite",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",