ifc-gitlab-mcp-server
v0.1.3GitLab MCP Server - 提供项目搜索、代码搜索、文件读取、引用查找等工具
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_projects
根据关键字搜索 GitLab 项目,获取 project_id。 Args: query: 搜索关键字(项目名称或路径)
| Parameter | Type | Description |
|---|---|---|
query * | string |
search_code
在 GitLab 项目中搜索代码(scope=blobs)。 返回匹配的文件名和代码行,用于定位代码位置。 找到目标行号后,可使用 get_file_content 读取上下文。 Args: project_id: 项目 ID(通过 list_projects 获取) query: 搜索关键字 ref: 分支或 tag 名称,默认 "master",生产使用‘master’,测试使用‘test’
| Parameter | Type | Description |
|---|---|---|
project_id * | integer | |
query * | string | |
ref | string |
get_file_content
获取 GitLab 项目中文件的指定行范围内容。 建议先通过 search_code 定位行号,再用此工具读取前后上下文。 单次最多返回 500 行,避免超出上下文窗口。 Args: project_id: 项目 ID file_path: 文件路径(如 "src/main.py") ref: 分支或 tag 名称,默认 "main" start_line: 起始行号(从 1 开始),默认 1 end_line: 结束行号,默认 200
| Parameter | Type | Description |
|---|---|---|
file_path * | string | |
project_id * | integer | |
end_line | integer | |
ref | string | |
start_line | integer |
find_references
查找项目中对某个 symbol 的引用(import 语句和函数调用)。 内部自动搜索 import 和 symbol( 两种模式,帮 LLM 快速定位谁引用了该 symbol。 Args: project_id: 项目 ID symbol: 要查找的符号名(类名、函数名等) ref: 分支或 tag 名称,默认 "main"
| Parameter | Type | Description |
|---|---|---|
project_id * | integer | |
symbol * | string | |
ref | string |
get_project_dependencies
获取 Maven 项目的依赖列表(从 pom.xml 解析)。 用于快速定位项目依赖的其他 ifc 自研项目,缩小代码搜索范围。 支持多模块项目:自动检测并递归读取子模块的 pom.xml。 Args: project_id: 项目 ID(通过 list_projects 获取) ref: 分支或 tag 名称,None 时自动检测默认分支 filter_ifc: 是否只返回 ifc 开头的依赖,默认 True include_modules: 是否包含子模块的依赖,默认 True
| Parameter | Type | Description |
|---|---|---|
project_id * | integer | |
filter_ifc | boolean | |
include_modules | boolean | |
ref | string |
find_dependency_project
根据类名在项目的依赖中查找对应的项目。 结合 pom.xml 依赖分析和代码搜索,精确定位类所在的依赖项目。 工作流程: 1. 从 pom.xml 获取 ifc 依赖列表 2. 在依赖项目中搜索类名 3. 返回匹配的项目及代码位置 Args: project_id: 源项目 ID class_name: 类名(全限定或简单类名) ref: 分支或 tag 名称,None 时自动检测默认分支
| Parameter | Type | Description |
|---|---|---|
class_name * | string | |
project_id * | integer | |
ref | string |
resolve_class_to_project
根据类名搜索 GitLab,找到定义该类的项目。 支持全限定类名(如 com.fintech.ifc.trade.service.TradeService) 或简单类名(如 TradeService)。 工作流程: 1. 从全限定类名提取简单类名,或直接使用简单类名 2. 在 GitLab 全局搜索代码(scope=blobs) 3. 从搜索结果中提取项目信息 4. 可选:进一步搜索类定义(class XXX 或 public class XXX) Args: class_name: 类名(全限定或简单类名) search_definition: 是否搜索类定义(class XXX),默认 True…
| Parameter | Type | Description |
|---|---|---|
class_name * | string | |
search_definition | boolean |
search_class_across_projects
跨项目搜索类,返回所有包含该类的项目及位置。 先搜索匹配 project_query 的项目,然后在这些项目中搜索类。 Args: class_name: 类名(全限定或简单类名) project_query: 项目搜索关键字,默认 "ifc"(搜索所有 ifc 项目)
| Parameter | Type | Description |
|---|---|---|
class_name * | string | |
project_query | string |