@latellu/atlas-mcp 1.0.4 → 1.0.5

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 +38 -19
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5,13 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
- }) : x)(function(x) {
11
- if (typeof require !== "undefined") return require.apply(this, arguments);
12
- throw Error('Dynamic require of "' + x + '" is not supported');
13
- });
14
- var __commonJS = (cb, mod) => function __require2() {
8
+ var __commonJS = (cb, mod) => function __require() {
15
9
  try {
16
10
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17
11
  } catch (e) {
@@ -3231,8 +3225,8 @@ var require_utils = __commonJS({
3231
3225
  }
3232
3226
  return ind;
3233
3227
  }
3234
- function removeDotSegments(path) {
3235
- let input = path;
3228
+ function removeDotSegments(path2) {
3229
+ let input = path2;
3236
3230
  const output = [];
3237
3231
  let nextSlash = -1;
3238
3232
  let len = 0;
@@ -3484,8 +3478,8 @@ var require_schemes = __commonJS({
3484
3478
  wsComponent.secure = void 0;
3485
3479
  }
3486
3480
  if (wsComponent.resourceName) {
3487
- const [path, query] = wsComponent.resourceName.split("?");
3488
- wsComponent.path = path && path !== "/" ? path : void 0;
3481
+ const [path2, query] = wsComponent.resourceName.split("?");
3482
+ wsComponent.path = path2 && path2 !== "/" ? path2 : void 0;
3489
3483
  wsComponent.query = query;
3490
3484
  wsComponent.resourceName = void 0;
3491
3485
  }
@@ -12536,6 +12530,30 @@ var StdioServerTransport = class {
12536
12530
  import { z as z2 } from "zod";
12537
12531
 
12538
12532
  // src/client.ts
12533
+ function detectMimeType(fileName) {
12534
+ const ext = fileName.slice(fileName.lastIndexOf(".")).toLowerCase();
12535
+ switch (ext) {
12536
+ case ".jpg":
12537
+ case ".jpeg":
12538
+ return "image/jpeg";
12539
+ case ".png":
12540
+ return "image/png";
12541
+ case ".gif":
12542
+ return "image/gif";
12543
+ case ".webp":
12544
+ return "image/webp";
12545
+ case ".mp4":
12546
+ return "video/mp4";
12547
+ case ".webm":
12548
+ return "video/webm";
12549
+ case ".mov":
12550
+ return "video/quicktime";
12551
+ case ".pdf":
12552
+ return "application/pdf";
12553
+ default:
12554
+ return "application/octet-stream";
12555
+ }
12556
+ }
12539
12557
  var AtlasClient = class {
12540
12558
  baseUrl;
12541
12559
  apiKey;
@@ -12543,8 +12561,8 @@ var AtlasClient = class {
12543
12561
  this.baseUrl = baseUrl;
12544
12562
  this.apiKey = apiKey;
12545
12563
  }
12546
- async request(path, options) {
12547
- const url = `${this.baseUrl}${path}`;
12564
+ async request(path2, options) {
12565
+ const url = `${this.baseUrl}${path2}`;
12548
12566
  const response = await fetch(url, {
12549
12567
  ...options,
12550
12568
  headers: {
@@ -12557,8 +12575,8 @@ var AtlasClient = class {
12557
12575
  }
12558
12576
  // Write requests to /api/v1/manage/* carry an Idempotency-Key so that
12559
12577
  // AI-agent-driven retries don't risk double-create/double-publish.
12560
- async writeRequest(path, options) {
12561
- return this.request(path, {
12578
+ async writeRequest(path2, options) {
12579
+ return this.request(path2, {
12562
12580
  ...options,
12563
12581
  headers: {
12564
12582
  "Idempotency-Key": crypto.randomUUID(),
@@ -12679,14 +12697,15 @@ var AtlasClient = class {
12679
12697
  }
12680
12698
  async uploadMedia(filePath, folder, altText) {
12681
12699
  const fs = await import("fs");
12682
- const path = await import("path");
12700
+ const path2 = await import("path");
12683
12701
  if (!fs.existsSync(filePath)) {
12684
12702
  throw new Error(`File not found: ${filePath}`);
12685
12703
  }
12686
- const fileName = path.basename(filePath);
12704
+ const fileName = path2.basename(filePath);
12687
12705
  const fileBuffer = fs.readFileSync(filePath);
12706
+ const mimeType = detectMimeType(fileName);
12688
12707
  const formData = new FormData();
12689
- formData.append("file", new Blob([fileBuffer]), fileName);
12708
+ formData.append("file", new Blob([fileBuffer], { type: mimeType }), fileName);
12690
12709
  if (folder) formData.append("folder", folder);
12691
12710
  if (altText) formData.append("alt_text", altText);
12692
12711
  const response = await fetch(`${this.baseUrl}/api/v1/manage/media/upload`, {
@@ -12702,11 +12721,11 @@ var AtlasClient = class {
12702
12721
  };
12703
12722
 
12704
12723
  // src/security.ts
12724
+ import path from "node:path";
12705
12725
  function validateFilePath(filePath, allowedPaths) {
12706
12726
  if (allowedPaths.length === 0) {
12707
12727
  return;
12708
12728
  }
12709
- const path = __require("path");
12710
12729
  const absPath = path.resolve(filePath);
12711
12730
  const isAllowed = allowedPaths.some((allowed) => {
12712
12731
  const absAllowed = path.resolve(allowed);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latellu/atlas-mcp",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },