ring-skills-mcp 1.0.6 → 1.0.7

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.
Files changed (3) hide show
  1. package/README.md +25 -13
  2. package/dist/index.js +48 -20
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -5,7 +5,7 @@ An MCP (Model Context Protocol) service for fetching and installing company Skil
5
5
  ## Features
6
6
 
7
7
  - **list_skills** - Fetch company Skills list, supports search and pagination
8
- - **install_skill** - Install skill to local project by skill name
8
+ - **install_skill** - Install skill to local project by gitUrl (supports GitHub and GitLab)
9
9
 
10
10
  ## Installation
11
11
 
@@ -20,8 +20,7 @@ npm run build
20
20
 
21
21
  | Variable | Description | Default |
22
22
  |----------|-------------|---------|
23
- | `SKILLS_API_HOST` | API server address | `SKILLS_API_HOST` |
24
- | `SKILLS_REPO` | Skills repository path | `anthropics/skills` |
23
+ | `SKILLS_API_HOST` | API server address | None |
25
24
  | `SKILLS_AUTH_TOKEN` | API authentication token (required) | None |
26
25
 
27
26
  ## Usage in Cursor
@@ -38,7 +37,6 @@ Add the following MCP configuration in Cursor settings:
38
37
  "args": ["ring-skills-mcp@latest"],
39
38
  "env": {
40
39
  "SKILLS_API_HOST": "http://your-api-host:8000",
41
- "SKILLS_REPO": "your-org/skills-repo",
42
40
  "SKILLS_AUTH_TOKEN": "your-auth-token-here"
43
41
  }
44
42
  }
@@ -55,8 +53,7 @@ Add the following MCP configuration in Cursor settings:
55
53
  "command": "node",
56
54
  "args": ["/path/to/ring-skills-mcp/dist/index.js"],
57
55
  "env": {
58
- "SKILLS_API_HOST": "SKILLS_API_HOST",
59
- "SKILLS_REPO": "your-org/skills-repo",
56
+ "SKILLS_API_HOST": "http://your-api-host:8000",
60
57
  "SKILLS_AUTH_TOKEN": "your-auth-token-here"
61
58
  }
62
59
  }
@@ -73,8 +70,7 @@ Add the following MCP configuration in Cursor settings:
73
70
  "command": "npx",
74
71
  "args": ["tsx", "/path/to/ring-skills-mcp/src/index.ts"],
75
72
  "env": {
76
- "SKILLS_API_HOST": "SKILLS_API_HOST",
77
- "SKILLS_REPO": "your-org/skills-repo",
73
+ "SKILLS_API_HOST": "http://your-api-host:8000",
78
74
  "SKILLS_AUTH_TOKEN": "your-auth-token-here"
79
75
  }
80
76
  }
@@ -102,17 +98,33 @@ Search for skills containing "pdf"
102
98
 
103
99
  ### install_skill
104
100
 
105
- Install the specified skill to local project.
101
+ Install the specified skill to local project by gitUrl.
106
102
 
107
103
  **Parameters:**
108
- - `skillName` (required): Name of the skill to install
104
+ - `gitUrl` (required): Git URL of the skill. Supports both GitHub and GitLab URLs.
109
105
  - `projectPath` (required): Project path where the skill will be installed. Please provide the project root directory path of the currently opened file in IDE
110
- - `targetDir` (optional): Installation target directory, default is `skills`
111
- - `repo` (optional): Skills repository path
106
+ - `targetDir` (optional): Installation target directory, default is `.claude/skills`
107
+
108
+ **Supported URL Formats:**
109
+
110
+ | Platform | URL Format | Installation Method |
111
+ |----------|------------|---------------------|
112
+ | GitHub | `https://github.com/{owner}/{repo}/tree/{branch}/{path}` | `npx degit` (fast, no git history) |
113
+ | GitLab | `https://{host}/{owner}/{repo}/-/tree/{branch}/{path}` | `git sparse-checkout` (supports private repos) |
114
+
115
+ **Example URLs:**
116
+ ```
117
+ # GitHub
118
+ https://github.com/anthropics/skills/tree/main/skills/docx
119
+
120
+ # GitLab (self-hosted)
121
+ https://git.ringcentral.com/ai-testing/aiter-skills/-/tree/main/.agent/skills/nova-scripts-generator
122
+ ```
112
123
 
113
124
  **Example usage:**
114
125
  ```
115
- Install pdf skill to /Users/xxx/my-project project
126
+ Install skill from GitHub URL to /Users/xxx/my-project
127
+ Install skill from GitLab URL to /Users/xxx/my-project
116
128
  ```
117
129
 
118
130
  ## Development
package/dist/index.js CHANGED
@@ -98,18 +98,43 @@ function parseGitUrl(gitUrl) {
98
98
  return null;
99
99
  }
100
100
  /**
101
- * Build degit source path from git URL info
101
+ * Install Skill from GitHub using degit
102
102
  */
103
- function buildDegitSource(urlInfo) {
104
- if (urlInfo.type === "github") {
105
- // GitHub: owner/repo/path#branch
106
- return `${urlInfo.owner}/${urlInfo.repo}/${urlInfo.skillPath}#${urlInfo.branch}`;
107
- }
108
- else if (urlInfo.type === "gitlab") {
109
- // GitLab (self-hosted): host:owner/repo/path#branch
110
- return `${urlInfo.host}:${urlInfo.owner}/${urlInfo.repo}/${urlInfo.skillPath}#${urlInfo.branch}`;
111
- }
112
- return "";
103
+ async function installFromGitHub(urlInfo, destPath) {
104
+ // GitHub: owner/repo/path#branch
105
+ const sourcePath = `${urlInfo.owner}/${urlInfo.repo}/${urlInfo.skillPath}#${urlInfo.branch}`;
106
+ const command = `npx degit ${sourcePath} ${destPath}`;
107
+ const { stdout, stderr } = await execAsync(command);
108
+ const output = stdout || stderr || "Installation completed";
109
+ return `✅ Skill "${urlInfo.skillName}" has been successfully installed to ${destPath}\n\nSource: ${sourcePath}\n${output}`;
110
+ }
111
+ /**
112
+ * Install Skill from GitLab using git sparse-checkout
113
+ * For private GitLab repositories that degit doesn't support
114
+ */
115
+ async function installFromGitLab(urlInfo, destPath) {
116
+ const skillsDir = path.dirname(destPath);
117
+ const tempDir = `temp-${urlInfo.skillName}-${Date.now()}`;
118
+ const repoUrl = `https://${urlInfo.host}/${urlInfo.owner}/${urlInfo.repo}.git`;
119
+ // Build command sequence:
120
+ // 1. Create target directory
121
+ // 2. Clone with sparse checkout
122
+ // 3. Set sparse-checkout path
123
+ // 4. Move skill folder to destination
124
+ // 5. Cleanup temp directory
125
+ const commands = [
126
+ `mkdir -p ${skillsDir}`,
127
+ `cd ${skillsDir}`,
128
+ `git clone --depth 1 --filter=blob:none --sparse ${repoUrl} ${tempDir}`,
129
+ `cd ${tempDir}`,
130
+ `git sparse-checkout set ${urlInfo.skillPath}`,
131
+ `cd ..`,
132
+ `mv ${tempDir}/${urlInfo.skillPath} ${urlInfo.skillName}`,
133
+ `rm -rf ${tempDir}`,
134
+ ].join(" && ");
135
+ const { stdout, stderr } = await execAsync(commands);
136
+ const output = stdout || stderr || "Installation completed";
137
+ return `✅ Skill "${urlInfo.skillName}" has been successfully installed to ${destPath}\n\nSource: ${repoUrl} (${urlInfo.skillPath})\n${output}`;
113
138
  }
114
139
  /**
115
140
  * Install Skill to specified project using gitUrl
@@ -121,15 +146,18 @@ async function installSkillFromGitUrl(gitUrl, projectPath, targetDir = ".claude/
121
146
  }
122
147
  const skillName = urlInfo.skillName;
123
148
  const destPath = path.join(projectPath, targetDir, skillName);
124
- const sourcePath = buildDegitSource(urlInfo);
125
- if (!sourcePath) {
126
- throw new Error(`Could not build degit source from URL: ${gitUrl}`);
127
- }
128
- const command = `npx degit ${sourcePath} ${destPath}`;
129
149
  try {
130
- const { stdout, stderr } = await execAsync(command);
131
- const output = stdout || stderr || "Installation completed";
132
- return `✅ Skill "${skillName}" has been successfully installed to ${destPath}\n\nSource: ${sourcePath}\n${output}`;
150
+ if (urlInfo.type === "github") {
151
+ // Use degit for GitHub (faster, no git history)
152
+ return await installFromGitHub(urlInfo, destPath);
153
+ }
154
+ else if (urlInfo.type === "gitlab") {
155
+ // Use git sparse-checkout for GitLab (supports private repos)
156
+ return await installFromGitLab(urlInfo, destPath);
157
+ }
158
+ else {
159
+ throw new Error(`Unsupported git URL type: ${gitUrl}`);
160
+ }
133
161
  }
134
162
  catch (error) {
135
163
  if (error instanceof Error) {
@@ -208,7 +236,7 @@ server.tool("list_skills", "Fetch company Skills list. You can search for specif
208
236
  }
209
237
  });
210
238
  // Register tool: Install Skill
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.", {
239
+ server.tool("install_skill", "Install skill to local project by gitUrl. Uses npx degit for GitHub repositories and git sparse-checkout for GitLab repositories. Project path is required, which can be the project path of the currently opened file in IDE.", {
212
240
  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."),
213
241
  projectPath: z
214
242
  .string()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ring-skills-mcp",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "MCP service for fetching and installing company Skills",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",