note-mcp-server 2.3.1 → 2.3.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/index.js +29 -7
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -14,8 +14,10 @@ import FormData from "form-data";
14
14
 
15
15
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
16
16
 
17
+ // 優先載入專案目錄 (cwd) 的 .env,以支援不同專案自由切換
18
+ loadEnv({ path: path.join(process.cwd(), ".env") });
19
+ // 如果專案目錄沒有設定,則退回讀取全域的 .env
17
20
  loadEnv({ path: path.join(__dirname, ".env") });
18
-
19
21
  /**
20
22
  * MCP 須由 Cursor 依 mcp.json 啟動;勿在終端機手動跑本檔當成「掛載 MCP」。
21
23
  *
@@ -76,7 +78,7 @@ const APP_NAME = firstEnv("app_name", "APP_NAME", "notes_app_name", "NOTES_APP_N
76
78
  const server = new Server(
77
79
  {
78
80
  name: `note-mcp-server (${APP_NAME})`,
79
- version: "2.3.0",
81
+ version: "2.3.3",
80
82
  },
81
83
  {
82
84
  capabilities: {
@@ -172,14 +174,18 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
172
174
  {
173
175
  name: "create_note",
174
176
  description: withSecurityNotice(
175
- `在 ${APP_NAME} 中新增筆記。內容請優先使用簡潔的 AdminLTE 4 card 結構。`
177
+ `在 ${APP_NAME} 中新增筆記。內容請優先使用簡潔的 AdminLTE 4 card 結構。\nAI 行為:除非用戶明確要求,否則不要傳 tags(勿自行推測、分類或補加標籤)。`
176
178
  ),
177
179
  inputSchema: {
178
180
  type: "object",
179
181
  properties: {
180
182
  content: { type: "string", description: "HTML 或純文字內容" },
181
183
  title: { type: "string", description: "標題(可選)" },
182
- tags: { type: "string", description: "標籤,多個標籤以逗號分隔(可選)" },
184
+ tags: {
185
+ type: "string",
186
+ description:
187
+ "標籤,多個以逗號分隔(可選;僅當用戶明確要求設定標籤時才傳,勿主動填寫)",
188
+ },
183
189
  },
184
190
  required: ["content"],
185
191
  },
@@ -187,15 +193,28 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
187
193
  {
188
194
  name: "update_note",
189
195
  description: withSecurityNotice(
190
- `在 ${APP_NAME} 中修改筆記。內容請優先使用簡潔的 AdminLTE 4 card 結構,避免嵌套破版,支援以 append/prepend 追加內容。`
196
+ `在 ${APP_NAME} 中修改筆記。內容請優先使用簡潔的 AdminLTE 4 card 結構,避免嵌套破版,支援以 append/prepend 追加內容。\nAI 行為:除非用戶明確要求,否則不要傳 tags、add_tags(勿自行推測或補加標籤);亦不要傳 title,除非用戶明確要求變更標題。\n標籤語意:tags=整包覆寫既有標籤;add_tags=在既有標籤上追加(逗號分隔),勿刪除未提及的標籤。用戶只要「多加幾個標籤」時請用 add_tags,勿用 tags。`
191
197
  ),
192
198
  inputSchema: {
193
199
  type: "object",
194
200
  properties: {
195
201
  c_id: { type: "number", description: "筆記 ID" },
196
202
  content: { type: "string", description: "新內容(可選,若未傳則使用現有內容作為基底)" },
197
- title: { type: "string", description: "新標題(可選)" },
198
- tags: { type: "string", description: "新標籤,多個標籤以逗號分隔(可選)" },
203
+ title: {
204
+ type: "string",
205
+ description:
206
+ "新標題(可選;僅當用戶明確要求變更標題時才傳,勿為「優化」或推測而擅自改標題)",
207
+ },
208
+ tags: {
209
+ type: "string",
210
+ description:
211
+ "新標籤,多個以逗號分隔(可選;僅當用戶明確要求「整包重設」標籤時才傳,會覆寫既有全部標籤;勿主動填寫)",
212
+ },
213
+ add_tags: {
214
+ type: "string",
215
+ description:
216
+ "僅追加標籤,多個以逗號分隔(可選;與既有標籤合併、不覆寫未列出的標籤。僅當用戶明確要求「在現有標籤上多加」時才傳;勿主動填寫)",
217
+ },
199
218
  append: { type: "string", description: "追加在結尾的內容(可選)" },
200
219
  prepend: { type: "string", description: "追加在開頭的內容(可選)" },
201
220
  },
@@ -350,6 +369,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
350
369
  if (args.tags !== undefined) {
351
370
  payload.tags = args.tags;
352
371
  }
372
+ if (args.add_tags !== undefined && args.add_tags !== "") {
373
+ payload.add_tags = args.add_tags;
374
+ }
353
375
  if (args.append !== undefined) {
354
376
  payload.append = args.append;
355
377
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "note-mcp-server",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "description": "MCP (stdio) server for Notes API v2 — list/read/write notes, upload images, Web Push from Cursor and compatible clients.",
5
5
  "main": "index.js",
6
6
  "bin": {