@baitong-dev/todo-mcp 0.0.1 → 0.0.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.
- package/dist/index.js +21 -21
- package/package.json +5 -2
package/dist/index.js
CHANGED
|
@@ -36,9 +36,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
/**
|
|
40
|
-
* Todo MCP Server v1.0
|
|
41
|
-
*/
|
|
42
39
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
43
40
|
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
44
41
|
const fs = __importStar(require("fs"));
|
|
@@ -48,7 +45,7 @@ const todowrite_txt_1 = __importDefault(require("../todowrite.txt"));
|
|
|
48
45
|
const todoread_txt_1 = __importDefault(require("../todoread.txt"));
|
|
49
46
|
const mcp_helpers_1 = require("@baitong-dev/mcp-helpers");
|
|
50
47
|
const MCP_NAME = 'Todo MCP';
|
|
51
|
-
const MCP_VERSION = '0.0.
|
|
48
|
+
const MCP_VERSION = '0.0.3';
|
|
52
49
|
function getTodoDir() {
|
|
53
50
|
const dir = path_1.default.join(mcp_helpers_1.MCP_HOME_DIR, 'todos');
|
|
54
51
|
if (!fs.existsSync(dir)) {
|
|
@@ -98,30 +95,30 @@ server.registerTool('todowrite', {
|
|
|
98
95
|
description: todowrite_txt_1.default,
|
|
99
96
|
inputSchema: zod_1.default.object({
|
|
100
97
|
todos: zod_1.default.array(todoInfo).describe('The updated todo list'),
|
|
101
|
-
|
|
102
|
-
.string()
|
|
103
|
-
.describe('The session ID to update the todo list for, fixed filling: slot') // 固定填写 "slot"
|
|
98
|
+
toolInfo: mcp_helpers_1.Tool.Info
|
|
104
99
|
})
|
|
105
100
|
}, async (args) => {
|
|
106
|
-
setTodoList(args.sessionId, args.todos);
|
|
101
|
+
setTodoList(args.toolInfo.sessionId, args.todos);
|
|
102
|
+
const todos = args.todos;
|
|
107
103
|
const result = {
|
|
108
|
-
title: `${
|
|
109
|
-
|
|
104
|
+
title: `${todos.filter(x => x.status !== 'completed').length} todos`,
|
|
105
|
+
metadata: {
|
|
106
|
+
todos
|
|
107
|
+
},
|
|
108
|
+
output: JSON.stringify(todos, null, 2)
|
|
110
109
|
};
|
|
111
110
|
return {
|
|
112
|
-
content: [{ type: 'text', text:
|
|
111
|
+
content: [{ type: 'text', text: result.output }],
|
|
113
112
|
structuredContent: result
|
|
114
113
|
};
|
|
115
114
|
});
|
|
116
115
|
server.registerTool('todoread', {
|
|
117
116
|
description: todoread_txt_1.default,
|
|
118
117
|
inputSchema: zod_1.default.object({
|
|
119
|
-
|
|
120
|
-
.string()
|
|
121
|
-
.describe('The session ID to read the todo list for, fixed filling: slot') // 固定填写 "slot"
|
|
118
|
+
toolInfo: mcp_helpers_1.Tool.Info
|
|
122
119
|
})
|
|
123
120
|
}, async (args) => {
|
|
124
|
-
const todos = getTodoList(args.sessionId);
|
|
121
|
+
const todos = getTodoList(args.toolInfo.sessionId);
|
|
125
122
|
const result = {
|
|
126
123
|
title: `${todos.filter(x => x.status !== 'completed').length} todos`,
|
|
127
124
|
todos
|
|
@@ -131,9 +128,12 @@ server.registerTool('todoread', {
|
|
|
131
128
|
structuredContent: result
|
|
132
129
|
};
|
|
133
130
|
});
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
131
|
+
async function main() {
|
|
132
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
133
|
+
await server.connect(transport);
|
|
134
|
+
console.error(`${MCP_NAME} Server v${MCP_VERSION} running`);
|
|
135
|
+
}
|
|
136
|
+
main().catch(error => {
|
|
137
|
+
console.error('Fatal error in main():', error);
|
|
138
|
+
process.exit(1);
|
|
139
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baitong-dev/todo-mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"bin": {
|
|
6
6
|
"@baitong-dev/todo-mcp": "./dist/index.js"
|
|
@@ -19,7 +19,10 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
21
21
|
"zod": "^4.3.4",
|
|
22
|
-
"@baitong-dev/mcp-helpers": "0.0.
|
|
22
|
+
"@baitong-dev/mcp-helpers": "0.0.5"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"typescript": "^5.9.2"
|
|
23
26
|
},
|
|
24
27
|
"publishConfig": {
|
|
25
28
|
"access": "public",
|