Skip to main content
Glama
lininn
by lininn
快速开始.md3.94 kB
# 🚀 快速开始指南 ## 1. 获取 API Token ### GitHub Token 1. 访问 [GitHub Settings](https://github.com/settings/tokens) 2. 点击 "Generate new token (classic)" 3. 选择权限: - `repo` (访问私有仓库) - `public_repo` (访问公开仓库) 4. 复制生成的 token ### GitLab Token 1. 访问 [GitLab Access Tokens](https://gitlab.com/-/profile/personal_access_tokens) 2. 创建新的 Personal Access Token 3. 选择权限:`api` 或 `read_api` 4. 复制生成的 token ## 2. 配置 Claude Desktop 打开 Claude Desktop 的 MCP 配置文件: **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json` **Windows:** `%APPDATA%\Claude\claude_desktop_config.json` 添加以下配置: ```json { "mcpServers": { "代码审查助手": { "command": "npx", "args": [ "-y", "gitlab-review-mcp", "--api-base-url=https://api.github.com", "--api-token=你的_github_token_这里" ], "alwaysAllow": [ "fetch_pull_request", "fetch_code_diff", "add_review_comment", "analyze_code_quality", "get_repository_info", "analyze_files_batch", "get_pull_request_files", "get_supported_languages", "get_language_rules", "get_server_config" ] } } } ``` **注意:** 将 `你的_github_token_这里` 替换为步骤1中获取的真实 token。 ## 3. 重启 Claude Desktop 保存配置文件后,重启 Claude Desktop 应用程序。 ## 4. 开始使用 重启后,你可以在对话中使用以下功能: ### 📄 分析 PR ``` 请帮我分析这个 PR:microsoft/vscode 的第 196892 号 Pull Request ``` ### 🔍 代码质量检查 ``` 请分析这段 JavaScript 代码的质量: console.log("Hello World"); var x = 1; eval("test"); ``` ### 📁 获取 PR 文件列表 ``` 请获取 microsoft/vscode PR #196892 中修改的文件列表 ``` ### 🔧 批量分析文件 ``` 请分析以下文件的代码质量: 1. index.js: console.log('test'); 2. utils.py: print('hello') ``` ### 💬 添加 PR 评论 ``` 请在 microsoft/vscode PR #196892 的 src/index.js 文件第42行添加评论:"这里需要添加错误处理" ``` ## 5. 支持的命令示例 ### 基础功能 - "分析这个 GitHub 仓库:microsoft/vscode" - "获取 PR #123 的代码差异" - "检查这段代码的质量问题" - "获取支持的编程语言列表" ### 高级功能 - "批量分析多个文件的代码质量" - "获取 JavaScript 的所有分析规则" - "检查服务器配置和健康状态" ## 6. 切换到 GitLab 如果要使用 GitLab,只需修改配置: ```json "args": [ "-y", "gitlab-review-mcp", "--api-base-url=https://gitlab.com/api/v4", "--api-token=你的_gitlab_token_这里" ] ``` ## 故障排除 ### ❌ 配置不生效 1. 检查 JSON 格式是否正确 2. 确保文件路径正确 3. 重启 Claude Desktop ### ❌ API 认证失败 1. 确认 token 是否正确 2. 检查 token 权限设置 3. 验证 API 地址是否正确 ### ❌ 网络连接问题 1. 检查网络连接 2. 尝试增加超时时间:`--timeout=60000` 3. 检查防火墙设置 ## 💡 使用技巧 1. **组合使用:** 先获取 PR 文件列表,再逐个分析代码质量 2. **批量处理:** 一次性分析多个文件,获得整体代码质量报告 3. **规则定制:** 使用 `get_language_rules` 了解可用规则,然后在分析时指定特定规则 4. **健康检查:** 定期使用 `get_server_config` 检查服务状态 ## 🎯 常用场景 ### 代码审查工作流 1. 获取 PR 文件列表 2. 分析关键文件的代码质量 3. 添加具体的审查评论 4. 获取整个 PR 的代码差异 ### 代码质量检查 1. 获取支持的语言和规则 2. 批量分析项目文件 3. 查看详细的质量报告 4. 根据建议优化代码 现在你可以开始使用这个强大的代码审查助手了!🎉

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lininn/gitlab-review-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server