mcp-cos-upload 1.1.3 → 1.1.4

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 (3) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/src/cos.js +4 -4
package/README.md CHANGED
@@ -72,7 +72,7 @@ COS_CDN_DOMAIN=cdn.example.com
72
72
  > **Note:** The `.env` file contains secrets — never commit it. Use `.env.example` as a reference template.
73
73
 
74
74
  The server only reads one file:
75
- 1. Project root `.env` (`/path/to/mcp-cos-upload/.env`)
75
+ 1. `process.cwd()/.env`
76
76
 
77
77
  It does **not** read:
78
78
  1. MCP `env` configuration
@@ -247,7 +247,7 @@ This happens when using `npx -y mcp-cos-upload` directly — npm outputs package
247
247
 
248
248
  ### Missing COS_SECRET_ID or COS_SECRET_KEY
249
249
 
250
- The server only reads the project root `.env`. If that file does not exist, or if it is missing `COS_SECRET_ID` / `COS_SECRET_KEY`, tool calls will return a clear error telling you to fix that single file.
250
+ The server only reads `process.cwd()/.env`. If that file does not exist, or if it is missing `COS_SECRET_ID` / `COS_SECRET_KEY`, tool calls will return a clear error telling you which path it tried and what the current working directory was.
251
251
 
252
252
  ### MCP not working after code changes
253
253
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-cos-upload",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "MCP server for uploading files to Tencent Cloud COS",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/cos.js CHANGED
@@ -1,11 +1,9 @@
1
1
  // mcp-cos-upload - COS client configuration
2
2
  import COS from "cos-nodejs-sdk-v5";
3
3
  import { readFileSync, existsSync } from "fs";
4
- import { join, dirname } from "path";
5
- import { fileURLToPath } from "url";
4
+ import { join } from "path";
6
5
 
7
- const __dirname = dirname(fileURLToPath(import.meta.url));
8
- const PROJECT_ENV_PATH = join(__dirname, "..", ".env");
6
+ const PROJECT_ENV_PATH = join(process.cwd(), ".env");
9
7
 
10
8
  function parseEnvFile(filePath) {
11
9
  const env = {};
@@ -35,6 +33,7 @@ function getMissingCredentialMessage() {
35
33
  return [
36
34
  "[mcp-cos-upload] ❌ 未找到配置文件",
37
35
  `只会读取项目根目录 .env: ${PROJECT_ENV_PATH}`,
36
+ `当前工作目录: ${process.cwd()}`,
38
37
  "请在该文件中设置:",
39
38
  "COS_SECRET_ID=your_secret_id",
40
39
  "COS_SECRET_KEY=your_secret_key",
@@ -46,6 +45,7 @@ function getMissingCredentialMessage() {
46
45
  return [
47
46
  "[mcp-cos-upload] ❌ .env 缺少 COS_SECRET_ID 或 COS_SECRET_KEY",
48
47
  `只读取此文件: ${PROJECT_ENV_PATH}`,
48
+ `当前工作目录: ${process.cwd()}`,
49
49
  "请补全以下字段:",
50
50
  "COS_SECRET_ID=your_secret_id",
51
51
  "COS_SECRET_KEY=your_secret_key",