note-mcp-server 1.0.0 → 2.0.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 +29 -11
- 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
|
@@ -75,7 +75,7 @@ const BASE_URL = resolveNotesApiBase();
|
|
|
75
75
|
const server = new Server(
|
|
76
76
|
{
|
|
77
77
|
name: "note-mcp-server",
|
|
78
|
-
version: "
|
|
78
|
+
version: "2.0.0",
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
capabilities: {
|
|
@@ -113,10 +113,14 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
113
113
|
tools: [
|
|
114
114
|
{
|
|
115
115
|
name: "list_notes",
|
|
116
|
-
description: "列出筆記(GET
|
|
116
|
+
description: "列出筆記(GET 列表),支援 search 搜尋與 limit 截斷。",
|
|
117
117
|
inputSchema: {
|
|
118
118
|
type: "object",
|
|
119
119
|
properties: {
|
|
120
|
+
search: {
|
|
121
|
+
type: "string",
|
|
122
|
+
description: "搜尋關鍵字(可選)",
|
|
123
|
+
},
|
|
120
124
|
limit: {
|
|
121
125
|
type: "number",
|
|
122
126
|
description: "最多回傳幾筆(預設 3)",
|
|
@@ -127,13 +131,13 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
127
131
|
},
|
|
128
132
|
{
|
|
129
133
|
name: "read_note",
|
|
130
|
-
description: "讀取單筆筆記(GET ?c_id
|
|
134
|
+
description: "讀取單筆筆記(GET ?c_id=)。亦可傳 c_id=last 讀取最新一筆。",
|
|
131
135
|
inputSchema: {
|
|
132
136
|
type: "object",
|
|
133
137
|
properties: {
|
|
134
138
|
c_id: {
|
|
135
|
-
type: "
|
|
136
|
-
description: "筆記 ID(c_id
|
|
139
|
+
type: "string",
|
|
140
|
+
description: "筆記 ID(c_id)或 'last'",
|
|
137
141
|
},
|
|
138
142
|
},
|
|
139
143
|
required: ["c_id"],
|
|
@@ -154,15 +158,17 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
154
158
|
},
|
|
155
159
|
{
|
|
156
160
|
name: "update_note",
|
|
157
|
-
description: "修改筆記(POST:c_id、title、content
|
|
161
|
+
description: "修改筆記(POST:c_id、title、content)。亦支援 append/prepend 追加內容。",
|
|
158
162
|
inputSchema: {
|
|
159
163
|
type: "object",
|
|
160
164
|
properties: {
|
|
161
165
|
c_id: { type: "number", description: "筆記 ID" },
|
|
162
|
-
content: { type: "string", description: "
|
|
166
|
+
content: { type: "string", description: "新內容(可選,若未傳則使用現有內容作為基底)" },
|
|
163
167
|
title: { type: "string", description: "新標題(可選)" },
|
|
168
|
+
append: { type: "string", description: "追加在結尾的內容(可選)" },
|
|
169
|
+
prepend: { type: "string", description: "追加在開頭的內容(可選)" },
|
|
164
170
|
},
|
|
165
|
-
required: ["c_id"
|
|
171
|
+
required: ["c_id"],
|
|
166
172
|
},
|
|
167
173
|
},
|
|
168
174
|
{
|
|
@@ -220,7 +226,11 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
220
226
|
switch (name) {
|
|
221
227
|
case "list_notes": {
|
|
222
228
|
const limit = Number(args.limit) > 0 ? Number(args.limit) : 3;
|
|
223
|
-
const
|
|
229
|
+
const params = {};
|
|
230
|
+
if (args.search) {
|
|
231
|
+
params.search = args.search;
|
|
232
|
+
}
|
|
233
|
+
const response = await axios.get(BASE_URL, { params });
|
|
224
234
|
const list = normalizeListPayload(response.data).slice(0, limit);
|
|
225
235
|
return {
|
|
226
236
|
content: [{ type: "text", text: JSON.stringify(list, null, 2) }],
|
|
@@ -228,7 +238,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
228
238
|
}
|
|
229
239
|
|
|
230
240
|
case "read_note": {
|
|
231
|
-
const cId =
|
|
241
|
+
const cId = args.c_id;
|
|
232
242
|
const response = await axios.get(BASE_URL, {
|
|
233
243
|
params: { c_id: cId },
|
|
234
244
|
});
|
|
@@ -255,11 +265,19 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
255
265
|
case "update_note": {
|
|
256
266
|
const payload = {
|
|
257
267
|
c_id: Number(args.c_id),
|
|
258
|
-
content: args.content,
|
|
259
268
|
};
|
|
269
|
+
if (args.content !== undefined) {
|
|
270
|
+
payload.content = args.content;
|
|
271
|
+
}
|
|
260
272
|
if (args.title !== undefined) {
|
|
261
273
|
payload.title = args.title;
|
|
262
274
|
}
|
|
275
|
+
if (args.append !== undefined) {
|
|
276
|
+
payload.append = args.append;
|
|
277
|
+
}
|
|
278
|
+
if (args.prepend !== undefined) {
|
|
279
|
+
payload.prepend = args.prepend;
|
|
280
|
+
}
|
|
263
281
|
const response = await axios.post(BASE_URL, payload, {
|
|
264
282
|
headers: { "Content-Type": "application/json" },
|
|
265
283
|
});
|
package/package.json
CHANGED