@baitong-dev/skills-mcp 0.0.4 → 0.0.6
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 +11 -34
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -12,9 +12,9 @@ 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.6';
|
|
16
16
|
function getSkillsRootDir() {
|
|
17
|
-
const dir =
|
|
17
|
+
const dir = mcp_helpers_1.MCP_SKILLS_DIR;
|
|
18
18
|
if (!fs_1.default.existsSync(dir)) {
|
|
19
19
|
fs_1.default.mkdirSync(dir, {
|
|
20
20
|
recursive: true
|
|
@@ -73,25 +73,19 @@ function registerLoadSkill(server) {
|
|
|
73
73
|
.slice(0, 3)
|
|
74
74
|
.join(', ');
|
|
75
75
|
const hint = examples.length > 0 ? ` (e.g., ${examples}, ...)` : '';
|
|
76
|
-
server.registerTool('
|
|
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.
|
|
76
|
+
server.registerTool('skill', {
|
|
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
|
-
toolInfo: mcp_helpers_1.
|
|
88
|
+
toolInfo: mcp_helpers_1.ToolInfoSchema
|
|
95
89
|
})
|
|
96
90
|
}, async ({ skillName }) => {
|
|
97
91
|
if (metadata.length === 0) {
|
|
@@ -116,15 +110,16 @@ ${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
117
|
const result = {
|
|
124
|
-
title: `Loaded
|
|
118
|
+
title: `Loaded ${skillName}`,
|
|
125
119
|
metadata: {
|
|
126
120
|
name: skillName,
|
|
127
|
-
dir: skillCwd
|
|
121
|
+
dir: skillCwd,
|
|
122
|
+
format: 'markdown'
|
|
128
123
|
},
|
|
129
124
|
output: `Base directory for this skill: ${skillCwd}
|
|
130
125
|
|
|
@@ -136,23 +131,6 @@ ${json.__content}`
|
|
|
136
131
|
};
|
|
137
132
|
});
|
|
138
133
|
}
|
|
139
|
-
function registerRefreshSkills(server) {
|
|
140
|
-
server.registerTool('reload_skills', {
|
|
141
|
-
description: `Reload skills metadata. Especially after creating a new skill.`, // 尤其在创建技能后要调用下重新加载技能
|
|
142
|
-
inputSchema: zod_1.default.object({
|
|
143
|
-
toolInfo: mcp_helpers_1.Tool.Info
|
|
144
|
-
})
|
|
145
|
-
}, async () => {
|
|
146
|
-
return {
|
|
147
|
-
content: [
|
|
148
|
-
{
|
|
149
|
-
type: 'text',
|
|
150
|
-
text: `Skills metadata reloaded.`
|
|
151
|
-
}
|
|
152
|
-
]
|
|
153
|
-
};
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
134
|
// 创建MCP服务器实例
|
|
157
135
|
const server = new mcp_js_1.McpServer({
|
|
158
136
|
name: MCP_NAME,
|
|
@@ -164,7 +142,6 @@ const server = new mcp_js_1.McpServer({
|
|
|
164
142
|
});
|
|
165
143
|
// 注册所有工具
|
|
166
144
|
registerLoadSkill(server);
|
|
167
|
-
registerRefreshSkills(server);
|
|
168
145
|
async function main() {
|
|
169
146
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
170
147
|
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.6",
|
|
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.7"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"typescript": "^5.9.2"
|