[main] feat: README.md 도구 섹션 자동 업데이트 기능 추가

🚀 Breaking Changes:
- README.md의 도구 섹션이 자동으로 업데이트됩니다.

📝 Details:
- index.ts에서 도구 정보를 추출하여 README.md의 특정 섹션을 업데이트하는 스크립트 추가
- package.json에 도구 생성 스크립트 명령어 추가
This commit is contained in:
simple
2025-04-25 00:11:34 +09:00
parent 340a5ffdc8
commit 95d8118ea5
3 changed files with 96 additions and 237 deletions

277
README.md
View File

@ -41,239 +41,44 @@ When using with the Claude App, you need to set up your API key and URLs directl
## Tools 🛠️ ## Tools 🛠️
1. `create_or_update_file` +<!-- TOOLS-START -->
1. `create_or_update_file` - Create or update a single file in a GitLab project
- Create or update a single file in a GitLab project. 📝 2. `search_repositories` - Search for GitLab projects
- Inputs: 3. `create_repository` - Create a new GitLab project
- `project_id` (string): Project ID or namespace/project_path 4. `get_file_contents` - Get the contents of a file or directory from a GitLab project
- `file_path` (string): Path to create/update the file 5. `push_files` - Push multiple files to a GitLab project in a single commit
- `content` (string): File content 6. `create_issue` - Create a new issue in a GitLab project
- `commit_message` (string): Commit message 7. `create_merge_request` - Create a new merge request in a GitLab project
- `branch` (string): Branch to create/update the file in 8. `fork_repository` - Fork a GitLab project to your account or specified namespace
- `previous_path` (optional string): Previous file path when renaming a file 9. `create_branch` - Create a new branch in a GitLab project
- Returns: File content and commit details 10. `get_merge_request` - Get details of a merge request
11. `get_merge_request_diffs` - Get the changes/diffs of a merge request
2. `push_files` 12. `update_merge_request` - Update a merge request
13. `create_note` - Create a new note (comment) to an issue or merge request
- Push multiple files in a single commit. 📤 14. `mr_discussions` - List discussion items for a merge request
- Inputs: 15. `update_merge_request_note` - Modify an existing merge request thread note
- `project_id` (string): Project ID or namespace/project_path 16. `list_issues` - List issues in a GitLab project with filtering options
- `branch` (string): Branch to push to 17. `get_issue` - Get details of a specific issue in a GitLab project
- `files` (array): Array of files to push, each with `file_path` and `content` properties 18. `update_issue` - Update an issue in a GitLab project
- `commit_message` (string): Commit message 19. `delete_issue` - Delete an issue from a GitLab project
- Returns: Updated branch reference 20. `list_issue_links` - List all issue links for a specific issue
21. `get_issue_link` - Get a specific issue link
3. `search_repositories` 22. `create_issue_link` - Create an issue link between two issues
23. `delete_issue_link` - Delete an issue link
- Search for GitLab projects. 🔍 24. `list_namespaces` - List all namespaces available to the current user
- Inputs: 25. `get_namespace` - Get details of a namespace by ID or path
- `search` (string): Search query 26. `verify_namespace` - Verify if a namespace path exists
- `page` (optional number): Page number (default: 1) 27. `get_project` - Get details of a specific project
- `per_page` (optional number): Results per page (default: 20, max: 100) 28. `list_projects` - List projects accessible by the current user
- Returns: Project search results 29. `list_labels` - List labels for a project
30. `get_label` - Get a single label from a project
4. `create_repository` 31. `create_label` - Create a new label in a project
32. `update_label` - Update an existing label in a project
- Create a new GitLab project. 33. `delete_label` - Delete a label from a project
- Inputs: 34. `list_group_projects` - List projects in a GitLab group with filtering options
- `name` (string): Project name 35. `list_wiki_pages` - List wiki pages in a GitLab project
- `description` (optional string): Project description 36. `get_wiki_page` - Get details of a specific wiki page
- `visibility` (optional string): Project visibility level (public, private, internal) 37. `create_wiki_page` - Create a new wiki page in a GitLab project
- `initialize_with_readme` (optional boolean): Initialize with README 38. `update_wiki_page` - Update an existing wiki page in a GitLab project
- Returns: Details of the created project 39. `delete_wiki_page` - Delete a wiki page from a GitLab project
<!-- TOOLS-END -->
5. `get_file_contents`
- Get the contents of a file or directory. 📂
- Inputs:
- `project_id` (string): Project ID or namespace/project_path
- `file_path` (string): Path to the file/directory
- `ref` (optional string): Branch, tag, or commit SHA (default: default branch)
- Returns: File/directory content
6. `create_issue`
- Create a new issue. 🐛
- Inputs:
- `project_id` (string): Project ID or namespace/project_path
- `title` (string): Issue title
- `description` (string): Issue description
- `assignee_ids` (optional number[]): Array of assignee IDs
- `milestone_id` (optional number): Milestone ID
- `labels` (optional string[]): Array of labels
- Returns: Details of the created issue
7. `create_merge_request`
- Create a new merge request. 🚀
- Inputs:
- `project_id` (string): Project ID or namespace/project_path
- `title` (string): Merge request title
- `description` (string): Merge request description
- `source_branch` (string): Branch with changes
- `target_branch` (string): Branch to merge into
- `allow_collaboration` (optional boolean): Allow collaborators to push commits to the source branch
- `draft` (optional boolean): Create as a draft merge request
- Returns: Details of the created merge request
8. `fork_repository`
- Fork a project. 🍴
- Inputs:
- `project_id` (string): Project ID or namespace/project_path to fork
- `namespace` (optional string): Namespace to fork into (default: user namespace)
- Returns: Details of the forked project
9. `create_branch`
- Create a new branch. 🌿
- Inputs:
- `project_id` (string): Project ID or namespace/project_path
- `name` (string): New branch name
- `ref` (optional string): Ref to create the branch from (branch, tag, commit SHA, default: default branch)
- Returns: Created branch reference
10. `get_merge_request`
- Get details of a merge request.
- Inputs:
- `project_id` (string): Project ID or namespace/project_path
- `merge_request_iid` (number): Merge request IID
- Returns: Merge request details
11. `get_merge_request_diffs`
- Get changes (diffs) of a merge request. diff
- Inputs:
- `project_id` (string): Project ID or namespace/project_path
- `merge_request_iid` (number): Merge request IID
- `view` (optional string): Diff view type ('inline' or 'parallel')
- Returns: Array of merge request diff information
12. `update_merge_request`
- Update a merge request. 🔄
- Inputs:
- `project_id` (string): Project ID or namespace/project_path
- `merge_request_iid` (number): Merge request IID
- `title` (optional string): New title
- `description` (string): New description
- `target_branch` (optional string): New target branch
- `state_event` (optional string): Merge request state change event ('close', 'reopen')
- `remove_source_branch` (optional boolean): Remove source branch after merge
- `allow_collaboration` (optional boolean): Allow collaborators to push commits to the source branch
- Returns: Updated merge request details
13. `create_note`
- Create a new note (comment) to an issue or merge request. 💬
- Inputs:
- `project_id` (string): Project ID or namespace/project_path
- `noteable_type` (string): Type of noteable ("issue" or "merge_request")
- `noteable_iid` (number): IID of the issue or merge request
- `body` (string): Note content
- Returns: Details of the created note
14. `list_projects`
- List accessible projects with rich filtering options 📊
- Inputs:
- Search/filtering:
- `search`
- `owned`
- `membership`
- `archived`
- `visibility`
- Features filtering:
- `with_issues_enabled`
- `with_merge_requests_enabled`
- Sorting:
- `order_by`
- `sort`
- Access control:
- `min_access_level`
- Pagination:
- `page`
- `per_page`
- `simple`
- Returns: Array of projects
15. `list_labels`
- List all labels for a project with filtering options 🏷️
- Inputs:
- `project_id` (string): Project ID or path
- `with_counts` (optional): Include issue and merge request counts
- `include_ancestor_groups` (optional): Include ancestor groups
- `search` (optional): Filter labels by keyword
- Returns: Array of labels
16. `get_label`
- Get a single label from a project
- Inputs:
- `project_id` (string): Project ID or path
- `label_id` (number/string): Label ID or name
- `include_ancestor_groups` (optional): Include ancestor groups
- Returns: label details
17. `create_label`
- Create a new label in an object 🏷️➕
- Inputs:
- `project_id` (string): Project ID or path
- `name` (string): Label name
- `color` (string): Color in hex format (e.g., "#FF0000")
- `description` (optional): Label description
- `priority` (optional): Label priority
- Returns: Created label details
18. `update_label`
- Update an existing label in a project 🏷️✏️
- Inputs:
- `project_id` (string): Project ID or path
- `label_id` (number/string): Label ID or name
- `new_name` (optional): New label name
- `color` (optional): New color in hex format
- `description` (optional): New description
- `priority` (optional): New priority
- Returns: Updated label details
19. `delete_label`
- Delete a label from a project 🏷️❌
- Inputs:
- `project_id` (string): Project ID or path
- `label_id` (number/string): Label ID or name
- Returns: Success message
14. `list_group_projects`
- List all projects in a GitLab group. 📂
- Inputs:
- `group_id` (string): Project ID or namespace/project_path
- Filtering options:
- `include_subgroups` (optional boolean): Include projects from subgroups
- `search` (optional string): Search term to filter projects
- `archived` (optional boolean): Filter for archived projects
- `visibility` (optional string): Filter by project visibility (public/internal/private)
- `with_programming_language` (optional string): Filter by programming language
- `starred` (optional boolean): Filter by starred projects
- Feature filtering:
- `with_issues_enabled` (optional boolean): Filter projects with issues feature enabled
- `with_merge_requests_enabled` (optional boolean): Filter projects with merge requests feature enabled
- `min_access_level` (optional number): Filter by minimum access level
- Pagination:
- `page` (optional number): Page number
- `per_page` (optional number): Results per page
- Sorting:
- `order_by` (optional string): Field to sort by
- `sort` (optional string): Sort direction (asc/desc)
- Additional data:
- `statistics` (optional boolean): Include project statistics
- `with_custom_attributes` (optional boolean): Include custom attributes
- `with_security_reports` (optional boolean): Include security reports
- Returns: List of projects
## Environment Variable Configuration
Before running the server, you need to set the following environment variables:
```
GITLAB_PERSONAL_ACCESS_TOKEN=your_gitlab_token
GITLAB_API_URL=your_gitlab_api_url # Default: https://gitlab.com/api/v4
GITLAB_READ_ONLY_MODE=true # Optional: Enable read-only mode
```
## License
MIT License

View File

@ -19,7 +19,8 @@
"build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"", "build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"",
"prepare": "npm run build", "prepare": "npm run build",
"watch": "tsc --watch", "watch": "tsc --watch",
"deploy": "npm publish --access public" "deploy": "npm publish --access public",
"generate-tools": "npx ts-node scripts/generate-tools-readme.ts"
}, },
"dependencies": { "dependencies": {
"@modelcontextprotocol/sdk": "1.8.0", "@modelcontextprotocol/sdk": "1.8.0",

View File

@ -0,0 +1,53 @@
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
async function main() {
const repoRoot = path.resolve(__dirname, '..');
const indexPath = path.join(repoRoot, 'index.ts');
const readmePath = path.join(repoRoot, 'README.md');
// 1. Read index.ts
const code = fs.readFileSync(indexPath, 'utf-8');
// 2. Extract allTools array block
const match = code.match(/const allTools = \[([\s\S]*?)\];/);
if (!match) {
console.error('Unable to locate allTools array in index.ts');
process.exit(1);
}
const toolsBlock = match[1];
// 3. Parse tool entries
const toolRegex = /name:\s*"([^"]+)",[\s\S]*?description:\s*"([^"]+)"/g;
const tools: { name: string; description: string }[] = [];
let m: RegExpExecArray | null;
while ((m = toolRegex.exec(toolsBlock)) !== null) {
tools.push({ name: m[1], description: m[2] });
}
// 4. Generate markdown
const lines = tools.map((tool, index) => {
return `${index + 1}. \`${tool.name}\` - ${tool.description}`;
});
const markdown = lines.join('\n');
// 5. Read README.md and replace between markers
const readme = fs.readFileSync(readmePath, 'utf-8');
const updated = readme.replace(
/<!-- TOOLS-START -->([\s\S]*?)<!-- TOOLS-END -->/,
`<!-- TOOLS-START -->\n${markdown}\n<!-- TOOLS-END -->`
);
// 6. Write back
fs.writeFileSync(readmePath, updated, 'utf-8');
console.log('README.md tools section updated.');
}
main().catch(err => {
console.error(err);
process.exit(1);
});