note-mcp-server 1.0.0 → 2.1.0
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/README.md +3 -3
- package/index.js +31 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,10 +105,10 @@ socialite_id=eyJpdiI6I…
|
|
|
105
105
|
|
|
106
106
|
| 工具 | 說明 |
|
|
107
107
|
|------|------|
|
|
108
|
-
| `list_notes` | GET
|
|
109
|
-
| `read_note` | GET
|
|
108
|
+
| `list_notes` | GET 列表,支援 `search` 關鍵字及 `limit`(預設 3) |
|
|
109
|
+
| `read_note` | GET 單筆,支援 `c_id` 或 `last` |
|
|
110
110
|
| `create_note` | POST 新增,`content` 必填,`title` 可選 |
|
|
111
|
-
| `update_note` | POST 修改,`c_id
|
|
111
|
+
| `update_note` | POST 修改,`c_id` 必填,支援 `content`、`title`、`append`、`prepend` |
|
|
112
112
|
| `delete_note` | POST 刪除,`c_id` + `action=delete` |
|
|
113
113
|
| `upload_image` | multipart,`image_base64`、可選 `filename` |
|
|
114
114
|
| `send_push` | POST 推播,`message` 必填,`title` / `url` 可選 |
|
package/index.js
CHANGED
|
@@ -71,11 +71,12 @@ function resolveNotesApiBase() {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
const BASE_URL = resolveNotesApiBase();
|
|
74
|
+
const APP_NAME = firstEnv("app_name", "APP_NAME", "notes_app_name", "NOTES_APP_NAME") || "Personal Note Assistant";
|
|
74
75
|
|
|
75
76
|
const server = new Server(
|
|
76
77
|
{
|
|
77
|
-
name:
|
|
78
|
-
version: "1.0
|
|
78
|
+
name: `note-mcp-server (${APP_NAME})`,
|
|
79
|
+
version: "2.1.0",
|
|
79
80
|
},
|
|
80
81
|
{
|
|
81
82
|
capabilities: {
|
|
@@ -113,10 +114,14 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
113
114
|
tools: [
|
|
114
115
|
{
|
|
115
116
|
name: "list_notes",
|
|
116
|
-
description:
|
|
117
|
+
description: `列出 ${APP_NAME} 的筆記(GET 列表),支援 search 搜尋與 limit 截斷。`,
|
|
117
118
|
inputSchema: {
|
|
118
119
|
type: "object",
|
|
119
120
|
properties: {
|
|
121
|
+
search: {
|
|
122
|
+
type: "string",
|
|
123
|
+
description: "搜尋關鍵字(可選)",
|
|
124
|
+
},
|
|
120
125
|
limit: {
|
|
121
126
|
type: "number",
|
|
122
127
|
description: "最多回傳幾筆(預設 3)",
|
|
@@ -127,13 +132,13 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
127
132
|
},
|
|
128
133
|
{
|
|
129
134
|
name: "read_note",
|
|
130
|
-
description:
|
|
135
|
+
description: `從 ${APP_NAME} 讀取單筆筆記(GET ?c_id=)。亦可傳 c_id=last 讀取最新一筆。`,
|
|
131
136
|
inputSchema: {
|
|
132
137
|
type: "object",
|
|
133
138
|
properties: {
|
|
134
139
|
c_id: {
|
|
135
|
-
type: "
|
|
136
|
-
description: "筆記 ID(c_id
|
|
140
|
+
type: "string",
|
|
141
|
+
description: "筆記 ID(c_id)或 'last'",
|
|
137
142
|
},
|
|
138
143
|
},
|
|
139
144
|
required: ["c_id"],
|
|
@@ -154,15 +159,17 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
154
159
|
},
|
|
155
160
|
{
|
|
156
161
|
name: "update_note",
|
|
157
|
-
description:
|
|
162
|
+
description: `在 ${APP_NAME} 中修改筆記(POST:c_id、title、content)。亦支援 append/prepend 追加內容。`,
|
|
158
163
|
inputSchema: {
|
|
159
164
|
type: "object",
|
|
160
165
|
properties: {
|
|
161
166
|
c_id: { type: "number", description: "筆記 ID" },
|
|
162
|
-
content: { type: "string", description: "
|
|
167
|
+
content: { type: "string", description: "新內容(可選,若未傳則使用現有內容作為基底)" },
|
|
163
168
|
title: { type: "string", description: "新標題(可選)" },
|
|
169
|
+
append: { type: "string", description: "追加在結尾的內容(可選)" },
|
|
170
|
+
prepend: { type: "string", description: "追加在開頭的內容(可選)" },
|
|
164
171
|
},
|
|
165
|
-
required: ["c_id"
|
|
172
|
+
required: ["c_id"],
|
|
166
173
|
},
|
|
167
174
|
},
|
|
168
175
|
{
|
|
@@ -220,7 +227,11 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
220
227
|
switch (name) {
|
|
221
228
|
case "list_notes": {
|
|
222
229
|
const limit = Number(args.limit) > 0 ? Number(args.limit) : 3;
|
|
223
|
-
const
|
|
230
|
+
const params = {};
|
|
231
|
+
if (args.search) {
|
|
232
|
+
params.search = args.search;
|
|
233
|
+
}
|
|
234
|
+
const response = await axios.get(BASE_URL, { params });
|
|
224
235
|
const list = normalizeListPayload(response.data).slice(0, limit);
|
|
225
236
|
return {
|
|
226
237
|
content: [{ type: "text", text: JSON.stringify(list, null, 2) }],
|
|
@@ -228,7 +239,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
228
239
|
}
|
|
229
240
|
|
|
230
241
|
case "read_note": {
|
|
231
|
-
const cId =
|
|
242
|
+
const cId = args.c_id;
|
|
232
243
|
const response = await axios.get(BASE_URL, {
|
|
233
244
|
params: { c_id: cId },
|
|
234
245
|
});
|
|
@@ -255,11 +266,19 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
255
266
|
case "update_note": {
|
|
256
267
|
const payload = {
|
|
257
268
|
c_id: Number(args.c_id),
|
|
258
|
-
content: args.content,
|
|
259
269
|
};
|
|
270
|
+
if (args.content !== undefined) {
|
|
271
|
+
payload.content = args.content;
|
|
272
|
+
}
|
|
260
273
|
if (args.title !== undefined) {
|
|
261
274
|
payload.title = args.title;
|
|
262
275
|
}
|
|
276
|
+
if (args.append !== undefined) {
|
|
277
|
+
payload.append = args.append;
|
|
278
|
+
}
|
|
279
|
+
if (args.prepend !== undefined) {
|
|
280
|
+
payload.prepend = args.prepend;
|
|
281
|
+
}
|
|
263
282
|
const response = await axios.post(BASE_URL, payload, {
|
|
264
283
|
headers: { "Content-Type": "application/json" },
|
|
265
284
|
});
|
package/package.json
CHANGED