@baitong-dev/todo-mcp 0.0.1 → 0.0.2
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 +14 -18
- 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.2';
|
|
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,12 +95,10 @@ 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);
|
|
107
102
|
const result = {
|
|
108
103
|
title: `${args.todos.filter(x => x.status !== 'completed').length} todos`,
|
|
109
104
|
todos: args.todos
|
|
@@ -116,12 +111,10 @@ server.registerTool('todowrite', {
|
|
|
116
111
|
server.registerTool('todoread', {
|
|
117
112
|
description: todoread_txt_1.default,
|
|
118
113
|
inputSchema: zod_1.default.object({
|
|
119
|
-
|
|
120
|
-
.string()
|
|
121
|
-
.describe('The session ID to read the todo list for, fixed filling: slot') // 固定填写 "slot"
|
|
114
|
+
toolInfo: mcp_helpers_1.Tool.Info
|
|
122
115
|
})
|
|
123
116
|
}, async (args) => {
|
|
124
|
-
const todos = getTodoList(args.sessionId);
|
|
117
|
+
const todos = getTodoList(args.toolInfo.sessionId);
|
|
125
118
|
const result = {
|
|
126
119
|
title: `${todos.filter(x => x.status !== 'completed').length} todos`,
|
|
127
120
|
todos
|
|
@@ -131,9 +124,12 @@ server.registerTool('todoread', {
|
|
|
131
124
|
structuredContent: result
|
|
132
125
|
};
|
|
133
126
|
});
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
127
|
+
async function main() {
|
|
128
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
129
|
+
await server.connect(transport);
|
|
130
|
+
console.error(`${MCP_NAME} Server v${MCP_VERSION} running`);
|
|
131
|
+
}
|
|
132
|
+
main().catch(error => {
|
|
133
|
+
console.error('Fatal error in main():', error);
|
|
134
|
+
process.exit(1);
|
|
135
|
+
});
|
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.2",
|
|
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",
|