ring-skills-mcp 1.0.5 → 1.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 +15 -84
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8,7 +8,6 @@ import path from "path";
|
|
|
8
8
|
const execAsync = promisify(exec);
|
|
9
9
|
// Configuration
|
|
10
10
|
const DEFAULT_API_HOST = process.env.SKILLS_API_HOST || "";
|
|
11
|
-
const DEFAULT_SKILLS_REPO = process.env.SKILLS_REPO || "anthropics/skills";
|
|
12
11
|
const DEFAULT_AUTH_TOKEN = process.env.SKILLS_AUTH_TOKEN || "";
|
|
13
12
|
// Create MCP server
|
|
14
13
|
const server = new McpServer({
|
|
@@ -139,29 +138,6 @@ async function installSkillFromGitUrl(gitUrl, projectPath, targetDir = ".claude/
|
|
|
139
138
|
throw new Error("Failed to install Skill: Unknown error");
|
|
140
139
|
}
|
|
141
140
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Install Skill to specified project using skill name and repo
|
|
144
|
-
*/
|
|
145
|
-
async function installSkillFromRepo(skillName, projectPath, targetDir = ".claude/skills", repo = DEFAULT_SKILLS_REPO) {
|
|
146
|
-
// Convert skill name to lowercase
|
|
147
|
-
const normalizedName = skillName.toLowerCase();
|
|
148
|
-
// Build full installation path
|
|
149
|
-
const destPath = path.join(projectPath, targetDir, normalizedName);
|
|
150
|
-
// Build degit command
|
|
151
|
-
const sourcePath = `${repo}/skills/${normalizedName}`;
|
|
152
|
-
const command = `npx degit ${sourcePath} ${destPath}`;
|
|
153
|
-
try {
|
|
154
|
-
const { stdout, stderr } = await execAsync(command);
|
|
155
|
-
const output = stdout || stderr || "Installation completed";
|
|
156
|
-
return `✅ Skill "${normalizedName}" has been successfully installed to ${destPath}\n${output}`;
|
|
157
|
-
}
|
|
158
|
-
catch (error) {
|
|
159
|
-
if (error instanceof Error) {
|
|
160
|
-
throw new Error(`Failed to install Skill: ${error.message}`);
|
|
161
|
-
}
|
|
162
|
-
throw new Error("Failed to install Skill: Unknown error");
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
141
|
// Register tool: Fetch Skills list
|
|
166
142
|
server.tool("list_skills", "Fetch company Skills list. You can search for specific skills using the search parameter. Authorization token is required for authentication.", {
|
|
167
143
|
host: z
|
|
@@ -232,9 +208,8 @@ server.tool("list_skills", "Fetch company Skills list. You can search for specif
|
|
|
232
208
|
}
|
|
233
209
|
});
|
|
234
210
|
// Register tool: Install Skill
|
|
235
|
-
server.tool("install_skill", "Install skill to local project by
|
|
236
|
-
|
|
237
|
-
gitUrl: z.string().optional().describe("Git URL of the skill (e.g., 'https://github.com/anthropics/skills/tree/main/skills/webapp-testing'). The skill name will be extracted from this URL. Either skillName or gitUrl must be provided."),
|
|
211
|
+
server.tool("install_skill", "Install skill to local project by gitUrl. Uses npx degit to download skill template from remote repository. Project path is required, which can be the project path of the currently opened file in IDE.", {
|
|
212
|
+
gitUrl: z.string().describe("Git URL of the skill (e.g., 'https://github.com/anthropics/skills/tree/main/skills/webapp-testing'). The skill name will be extracted from this URL."),
|
|
238
213
|
projectPath: z
|
|
239
214
|
.string()
|
|
240
215
|
.optional()
|
|
@@ -243,11 +218,7 @@ server.tool("install_skill", "Install skill to local project by skill name or gi
|
|
|
243
218
|
.string()
|
|
244
219
|
.optional()
|
|
245
220
|
.describe("Installation target directory, default: .claude/skills"),
|
|
246
|
-
|
|
247
|
-
.string()
|
|
248
|
-
.optional()
|
|
249
|
-
.describe(`Skills repository path, default: ${DEFAULT_SKILLS_REPO}`),
|
|
250
|
-
}, async ({ skillName, gitUrl, projectPath, targetDir, repo }) => {
|
|
221
|
+
}, async ({ gitUrl, projectPath, targetDir }) => {
|
|
251
222
|
// Check if project path is provided
|
|
252
223
|
if (!projectPath) {
|
|
253
224
|
return {
|
|
@@ -260,63 +231,23 @@ server.tool("install_skill", "Install skill to local project by skill name or gi
|
|
|
260
231
|
isError: true,
|
|
261
232
|
};
|
|
262
233
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
},
|
|
274
|
-
],
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
catch (error) {
|
|
278
|
-
return {
|
|
279
|
-
content: [
|
|
280
|
-
{
|
|
281
|
-
type: "text",
|
|
282
|
-
text: `❌ Error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
283
|
-
},
|
|
284
|
-
],
|
|
285
|
-
isError: true,
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
else if (skillName) {
|
|
290
|
-
// Install from repo using skill name
|
|
291
|
-
try {
|
|
292
|
-
const result = await installSkillFromRepo(skillName, projectPath, targetDir || ".claude/skills", repo || DEFAULT_SKILLS_REPO);
|
|
293
|
-
return {
|
|
294
|
-
content: [
|
|
295
|
-
{
|
|
296
|
-
type: "text",
|
|
297
|
-
text: result,
|
|
298
|
-
},
|
|
299
|
-
],
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
catch (error) {
|
|
303
|
-
return {
|
|
304
|
-
content: [
|
|
305
|
-
{
|
|
306
|
-
type: "text",
|
|
307
|
-
text: `❌ Error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
308
|
-
},
|
|
309
|
-
],
|
|
310
|
-
isError: true,
|
|
311
|
-
};
|
|
312
|
-
}
|
|
234
|
+
try {
|
|
235
|
+
const result = await installSkillFromGitUrl(gitUrl, projectPath, targetDir || ".claude/skills");
|
|
236
|
+
return {
|
|
237
|
+
content: [
|
|
238
|
+
{
|
|
239
|
+
type: "text",
|
|
240
|
+
text: result,
|
|
241
|
+
},
|
|
242
|
+
],
|
|
243
|
+
};
|
|
313
244
|
}
|
|
314
|
-
|
|
245
|
+
catch (error) {
|
|
315
246
|
return {
|
|
316
247
|
content: [
|
|
317
248
|
{
|
|
318
249
|
type: "text",
|
|
319
|
-
text:
|
|
250
|
+
text: `❌ Error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
320
251
|
},
|
|
321
252
|
],
|
|
322
253
|
isError: true,
|