@baitong-dev/skills-mcp 0.0.3 → 0.0.5
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 -34
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ const mcp_helpers_1 = require("@baitong-dev/mcp-helpers");
|
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
13
13
|
const yamlFront = require('yaml-front-matter');
|
|
14
14
|
const MCP_NAME = 'Skills MCP';
|
|
15
|
-
const MCP_VERSION = '0.0.
|
|
15
|
+
const MCP_VERSION = '0.0.5';
|
|
16
16
|
function getSkillsRootDir() {
|
|
17
17
|
const dir = path_1.default.join(mcp_helpers_1.MCP_HOME_DIR, 'skills');
|
|
18
18
|
if (!fs_1.default.existsSync(dir)) {
|
|
@@ -74,21 +74,15 @@ function registerLoadSkill(server) {
|
|
|
74
74
|
.join(', ');
|
|
75
75
|
const hint = examples.length > 0 ? ` (e.g., ${examples}, ...)` : '';
|
|
76
76
|
server.registerTool('load_skill', {
|
|
77
|
-
description:
|
|
78
|
-
? 'Load a specialized skill that provides domain-specific instructions and workflows. No skills are currently available.'
|
|
79
|
-
: `Load a specialized skill that provides domain-specific instructions and workflows.
|
|
77
|
+
description: `Load a specialized skill that provides domain-specific instructions and workflows.
|
|
80
78
|
|
|
81
79
|
When you recognize that a task matches one of the available skills listed below, use this tool to load the full skill instructions.
|
|
82
80
|
|
|
83
81
|
The skill will inject detailed instructions, workflows, and access to bundled resources (scripts, references, templates) into the conversation context.
|
|
84
82
|
|
|
85
|
-
|
|
83
|
+
Available skills are listed in system-reminder messages in the conversation.
|
|
86
84
|
|
|
87
|
-
Invoke this tool to load a skill when a task matches one of the available skills listed
|
|
88
|
-
|
|
89
|
-
Available skills:
|
|
90
|
-
|
|
91
|
-
${metadata.map(skill => `- ${skill.name}: ${skill.description}`).join('\n')}`,
|
|
85
|
+
Invoke this tool to load a skill when a task matches one of the available skills listed.`,
|
|
92
86
|
inputSchema: zod_1.default.object({
|
|
93
87
|
skillName: zod_1.default.string().describe(`The name of the skill from available skills${hint}`),
|
|
94
88
|
toolInfo: mcp_helpers_1.Tool.Info
|
|
@@ -116,36 +110,23 @@ ${metadata.map(skill => `- ${skill.name}: ${skill.description}`).join('\n')}`,
|
|
|
116
110
|
]
|
|
117
111
|
};
|
|
118
112
|
}
|
|
119
|
-
// 返回skill
|
|
113
|
+
// 返回skill元数据,只包含name和description
|
|
120
114
|
const skillCwd = getSkillCwd(skillName);
|
|
121
115
|
const skillFilePath = getSkillFilePath(skillName);
|
|
122
116
|
const json = readSkillJson(skillFilePath);
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
117
|
+
const result = {
|
|
118
|
+
title: `Loaded skill: ${skillName}`,
|
|
119
|
+
metadata: {
|
|
120
|
+
name: skillName,
|
|
121
|
+
dir: skillCwd
|
|
122
|
+
},
|
|
123
|
+
output: `Base directory for this skill: ${skillCwd}
|
|
128
124
|
|
|
129
125
|
${json.__content}`
|
|
130
|
-
}
|
|
131
|
-
]
|
|
132
126
|
};
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
function registerRefreshSkills(server) {
|
|
136
|
-
server.registerTool('reload_skills', {
|
|
137
|
-
description: `Reload skills metadata. Especially after creating a new skill.`, // 尤其在创建技能后要调用下重新加载技能
|
|
138
|
-
inputSchema: zod_1.default.object({
|
|
139
|
-
toolInfo: mcp_helpers_1.Tool.Info
|
|
140
|
-
})
|
|
141
|
-
}, async () => {
|
|
142
127
|
return {
|
|
143
|
-
content: [
|
|
144
|
-
|
|
145
|
-
type: 'text',
|
|
146
|
-
text: `Skills metadata reloaded.`
|
|
147
|
-
}
|
|
148
|
-
]
|
|
128
|
+
content: [{ type: 'text', text: result.output }],
|
|
129
|
+
structuredContent: result
|
|
149
130
|
};
|
|
150
131
|
});
|
|
151
132
|
}
|
|
@@ -160,7 +141,6 @@ const server = new mcp_js_1.McpServer({
|
|
|
160
141
|
});
|
|
161
142
|
// 注册所有工具
|
|
162
143
|
registerLoadSkill(server);
|
|
163
|
-
registerRefreshSkills(server);
|
|
164
144
|
async function main() {
|
|
165
145
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
166
146
|
await server.connect(transport);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baitong-dev/skills-mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"bin": {
|
|
6
6
|
"@baitong-dev/skills-mcp": "./dist/index.js"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"commander": "^14.0.3",
|
|
20
20
|
"yaml-front-matter": "^4.1.1",
|
|
21
21
|
"zod": "^4.3.4",
|
|
22
|
-
"@baitong-dev/mcp-helpers": "0.0.
|
|
22
|
+
"@baitong-dev/mcp-helpers": "0.0.6"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"typescript": "^5.9.2"
|