@energyatit/mcp-server 0.2.1 → 0.2.3

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.
Files changed (2) hide show
  1. package/dist/index.js +19 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -51,6 +51,18 @@ function resolveDemoPath(path) {
51
51
  }
52
52
  return path;
53
53
  }
54
+ // ─── Region code mapping ──────────────────────────────────────────────────
55
+ const regionCodeMap = {
56
+ "AE-DXB": "UAE", "AE-AUH": "UAE", "AE": "UAE",
57
+ "SA": "Saudi", "SA-RIY": "Saudi",
58
+ "US": "US", "DE": "DE",
59
+ "UAE": "UAE", "Saudi": "Saudi",
60
+ "PJM": "PJM", "ERCOT": "ERCOT", "CAISO": "CAISO",
61
+ "MISO": "MISO", "SPP": "SPP", "NYISO": "NYISO",
62
+ };
63
+ function resolveRegion(input) {
64
+ return regionCodeMap[input] ?? input;
65
+ }
54
66
  // ─── HTTP helpers ──────────────────────────────────────────────────────────
55
67
  async function autoProvisionSandbox() {
56
68
  try {
@@ -441,20 +453,20 @@ server.tool("get_site_reliability", "Get reliability score for a site", {
441
453
  }
442
454
  });
443
455
  server.tool("get_grid_capacity", "Get grid capacity for a region", {
444
- region: z.string().describe("Region code (e.g. AE-DXB, PH-LUZ)"),
456
+ region: z.string().describe("Region code (e.g. UAE, Saudi, PJM, ERCOT, CAISO, MISO, SPP, NYISO, DE). Also accepts AE-DXB → UAE, SA → Saudi."),
445
457
  }, async ({ region }) => {
446
458
  try {
447
- return text(await apiGet(`/api/v1/intel/grid/${region}/capacity`));
459
+ return text(await apiGet(`/api/v1/intel/grid/${resolveRegion(region)}/capacity`));
448
460
  }
449
461
  catch (e) {
450
462
  return errorResult(e);
451
463
  }
452
464
  });
453
465
  server.tool("get_grid_trends", "Get grid capacity trends for a region", {
454
- region: z.string().describe("Region code"),
466
+ region: z.string().describe("Region code (e.g. UAE, Saudi, PJM, ERCOT, CAISO). Also accepts AE-DXB → UAE, SA → Saudi."),
455
467
  }, async ({ region }) => {
456
468
  try {
457
- return text(await apiGet(`/api/v1/intel/grid/${region}/trends`));
469
+ return text(await apiGet(`/api/v1/intel/grid/${resolveRegion(region)}/trends`));
458
470
  }
459
471
  catch (e) {
460
472
  return errorResult(e);
@@ -503,10 +515,11 @@ server.tool("get_integration_status", "Get status of all integrations (Modbus, O
503
515
  }
504
516
  });
505
517
  server.tool("get_grid_prices", "Get current grid electricity prices", {
506
- region: z.string().optional().describe("Region code"),
518
+ region: z.string().optional().describe("Region code (e.g. UAE, Saudi, PJM). Also accepts AE-DXB → UAE."),
507
519
  }, async ({ region }) => {
508
520
  try {
509
- const path = region ? `/api/v1/integrations/grid-prices/${region}` : "/api/v1/integrations/grid-prices";
521
+ const resolved = region ? resolveRegion(region) : undefined;
522
+ const path = resolved ? `/api/v1/integrations/grid-prices/${resolved}` : "/api/v1/integrations/grid-prices";
510
523
  return text(await apiGet(path));
511
524
  }
512
525
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@energyatit/mcp-server",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "MCP server for EnergyAtIt — connect Claude, GPT, or any MCP client to energy grid data",
5
5
  "type": "module",
6
6
  "bin": {