🧠 IFS云MCP服务器
基于AI的模型上下文协议服务器,用于智能IFS Cloud代码库分析
一个复杂的模型上下文协议(MCP)服务器,通过全面分析、PageRank重要性排名和智能代码搜索功能,为AI代理提供对IFS Cloud代码库的深入理解。
______________________________________________________________________
✨ 主要特点
🎯 智能代码分析
- 综合文件分析:提取API调用、过程/函数名称和依赖关系
- PageRank排名:根据依赖关系网络分析确定最重要的文件
- 参考图:映射文件间依赖关系以了解体系结构
- 多格式支持:手柄
.plsql,.entity,.client,.projection,.fragment,以及更多
📦 版本管理
- ZIP导入:从ZIP文件导入完整的IFS Cloud版本
- 多个版本:管理不同IFS Cloud版本并在它们之间切换
- 隔离分析:每个版本都维护单独的分析数据
- 智能提取:自动筛选和组织支持的文件类型
🔍 高级混合搜索与发现
- 双查询混合搜索:单独的语义和词汇查询用于精度控制
- BGE-M3语义搜索:使用最先进的嵌入技术进行人工智能驱动的理解
- BM25S词汇搜索:API名称、函数和关键字的快速精确匹配
- FlashRank融合:神经重新排序智能地结合了语义和词汇结果
- 三种搜索模式:通过MCP工具提供全面、仅语义或仅词汇
- PageRank重要性:按依赖关系网络中的重要性排列的文件
- CUDA加速:GPU驱动的语义搜索,实现最高性能
______________________________________________________________________
🚀 快速开始
1. 安装
git clone https://github.com/graknol/ifs-cloud-core-mcp-server.git
cd ifs-cloud-core-mcp-server
uv sync2. 导入IFS云版本
# Import an IFS Cloud ZIP file
uv run python -m src.ifs_cloud_mcp_server.main import "IFS_Cloud_25.1.0.zip" --version "25.1.0"3. 分析代码库
# Perform comprehensive analysis
uv run python -m src.ifs_cloud_mcp_server.main analyze --version "25.1.0"
# Calculate PageRank importance scores
uv run python -m src.ifs_cloud_mcp_server.main calculate-pagerank --version "25.1.0"4. 启动MCP服务器
# Start server with analyzed version
uv run python -m src.ifs_cloud_mcp_server.main server --version "25.1.0"______________________________________________________________________
📋 CLI命令参考
版本管理
# Import a ZIP file
uv run python -m src.ifs_cloud_mcp_server.main import --version
# Download pre-built indexes from GitHub (fastest setup)
uv run python -m src.ifs_cloud_mcp_server.main download --version [--force]
# List all versions
uv run python -m src.ifs_cloud_mcp_server.main list
# Delete a version
uv run python -m src.ifs_cloud_mcp_server.main delete --version [--force]分析命令
# Analyze codebase (extract dependencies, API calls, etc.)
uv run python -m src.ifs_cloud_mcp_server.main analyze --version [--max-files N] [--force]
# Calculate PageRank importance scores
uv run python -m src.ifs_cloud_mcp_server.main calculate-pagerank --version
# Create embeddings for semantic search (uses BGE-M3 model)
uv run python -m src.ifs_cloud_mcp_server.main embed --version [--max-files N]
# Create test embeddings (top 10 files for quick testing)
uv run python -m src.ifs_cloud_mcp_server.main embed --version --max-files 10服务器操作
# Start MCP server
uv run python -m src.ifs_cloud_mcp_server.main server --version
# Start web UI (if available)
uv run python -m src.ifs_cloud_mcp_server.web_ui______________________________________________________________________
� MCP搜索工具
该服务器为AI代理提供了三种复杂的搜索工具:
搜索ifs_降级 -综合混合搜索
// Full hybrid search with separate semantic and lexical queries
search_ifs_codebase(
query: "validation logic", // Main query (fallback for both)
semantic_query: "business rules", // For FAISS semantic search
lexical_query: "Check_Insert___", // For BM25S exact matching
max_results: 10, // Number of results
explain: true // Include scoring explanations
)search_ifs_semantic -人工智能驱动的理解
// Pure semantic search using BGE-M3 embeddings
search_ifs_semantic(
semantic_query: "customer credit validation patterns",
max_results: 10,
explain: true
)search_ifs_lexical -精确的API和关键字匹配
// Pure lexical search using BM25S
search_ifs_lexical(
lexical_query: "Customer_API.Get_Credit_Limit___",
max_results: 10,
explain: true
)主要特点:
- 双查询处理:针对语义搜索和词汇搜索优化了不同的查询
- BGE-M3嵌入:1024个维度向量,具有8192个标记上下文
- CUDA加速:GPU驱动的语义搜索(如果可用)
- FlashRank融合:神经重新排序以获得最佳结果排序
- PageRank集成:重要性加权结果评分
- 详细说明:透明度方面的可选评分细分
______________________________________________________________________
�🔧 MCP客户端配置
克劳德桌面
添加到您的Claude Desktop配置中:
{
"mcpServers": {
"ifs-cloud": {
"command": "uv",
"args": [
"run",
"python",
"-m",
"src.ifs_cloud_mcp_server.main",
"server",
"--version",
"25.1.0"
],
"cwd": "/path/to/ifs-cloud-core-mcp-server"
}
}
}其他MCP客户端
# Standard MCP server startup
uv run python -m src.ifs_cloud_mcp_server.main server --version "25.1.0"______________________________________________________________________
📊 分析输出
系统生成综合分析数据:
相关性分析
- API调用:每个文件调用哪些API
- 参考图:文件到文件依赖关系映射
- 传入链接:每个文件依赖多少个文件
PageRank评分
- 重要性排名:按网络中心性排列的文件
- 基础API:基础结构文件(FndSession、Site等)排名最高
- 业务逻辑:按使用模式排列的域特定文件
文件元数据
- 文件大小和类型:基本文件特征
- 程序/函数名称:代码结构分析
- 改变信息:摘自评论和标题
______________________________________________________________________
🎯 智能工作流示例
AI代理搜索工作流程
💬 User: "Find customer credit validation patterns in IFS Cloud"
🧠 AI Agent automatically uses hybrid search:
1️⃣ **Semantic Search** (search_ifs_semantic):
Query: "customer credit validation business rules"
→ BGE-M3 finds conceptually similar code patterns
→ Returns files with credit checking logic, validation routines
2️⃣ **Lexical Search** (search_ifs_lexical):
Query: "Customer_API Credit_Limit Check_Credit"
→ BM25S finds exact API names and function calls
→ Returns specific implementation methods
3️⃣ **Hybrid Fusion** (search_ifs_codebase):
Semantic: "credit validation patterns"
Lexical: "Customer_API.Check_Credit___"
→ FlashRank combines both approaches intelligently
→ PageRank boosts important foundation files
✅ Result: Comprehensive understanding across:
- Business logic patterns (semantic)
- Exact API implementations (lexical)
- Architectural importance (PageRank)
- Perfect architectural consistency!快速设置工作流 ⚡ _(推荐)_
# 1. Import IFS Cloud version
uv run python -m src.ifs_cloud_mcp_server.main import "IFS_Cloud_25.1.0.zip"
# 2. Download pre-built indexes from GitHub (if available)
uv run python -m src.ifs_cloud_mcp_server.main download --version "25.1.0"
# 3. Start MCP server immediately
uv run python -m src.ifs_cloud_mcp_server.main server --version "25.1.0"结果:几分钟内即可准备就绪,而不是几个小时! ⚡
完成安装工作流程 _(如果下载不可用)_
# 1. Import IFS Cloud version
uv run python -m src.ifs_cloud_mcp_server.main import "IFS_Cloud_25.1.0.zip"
# 2. Analyze the codebase (extract dependencies, API calls)
uv run python -m src.ifs_cloud_mcp_server.main analyze --version "25.1.0"
# 3. Calculate importance rankings (PageRank network analysis)
uv run python -m src.ifs_cloud_mcp_server.main calculate-pagerank --version "25.1.0"
# 4. Build BM25S lexical search index
uv run python -m src.ifs_cloud_mcp_server.main reindex-bm25s --version "25.1.0"
# 5. Optional: Create semantic embeddings (BGE-M3 model, ~5-10 minutes)
uv run python -m src.ifs_cloud_mcp_server.main embed --version "25.1.0"
# 6. Start MCP server with full hybrid search capabilities
uv run python -m src.ifs_cloud_mcp_server.main server --version "25.1.0"结果:AI代理现在可以在IFS Cloud代码库中进行全面的混合搜索!
______________________________________________________________________
📁 支持的文件类型
| 文件类型 | 目的 | 分析功能 |
|---|---|---|
.plsql | PL/SQL业务逻辑 | API调用、过程、函数 |
.entity | 数据实体定义 | 实体关系 |
.client | 用户界面组件 | UI模式、命令 |
.projection | 数据访问层 | 查询、操作 |
.fragment | 全栈组件 | 完整的集成模式 |
.views | 数据库视图 | 数据结构 |
.storage | 存储定义 | 数据库映射 |
______________________________________________________________________
🏗️ 建筑
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ AI Client │◄──►│ MCP Server │◄──►│ Analysis Data │
│ (Claude, etc.) │ │ │ │ (JSON/JSONL) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
▼
┌─────────────────┐
│ Hybrid Search │
│ • BGE-M3 FAISS │
│ • BM25S Lexical │
│ • FlashRank │
│ • PageRank │
└─────────────────┘搜索架构详细信息
Query Input
│
▼
┌─────────────────┐
│ Query Processor │ ◄─── Semantic Query + Lexical Query
│ • Intent detect │
│ • Query split │
└─────────────────┘
│
▼
┌─────────────────┐ ┌─────────────────┐
│ FAISS Search │ │ BM25S Search │
│ • BGE-M3 embed │ │ • Exact match │
│ • Semantic sim │ │ • Keyword score │
│ • CUDA accel │ │ • Fast retrieval│
└─────────────────┘ └─────────────────┘
│ │
└─────────┬─────────────────┘
▼
┌─────────────────┐
│ FlashRank Fusion│
│ • Neural rerank │
│ • Score fusion │
│ • PageRank boost│
└─────────────────┘
▼
Final Ranked Results______________________________________________________________________
📈 演出
搜索性能
- 混合搜索响应:对于CUDA加速的大多数查询,\
🧠 Intelligent Context Analysis 📊 Deep Code Analysis
• Automatic pattern discovery
• Business requirement understanding
• Existing API identification
• Best practice recommendations
• PLSQL business logic analysis
• Client UI pattern recognition
• Projection data model mapping
• Fragment full-stack understanding
📦 Version Management ⚡ High Performance
• ZIP file import/extraction
• Multiple version support
• Isolated environments
• Easy switching between versions
• 1000+ files/second indexing
•
______________________________________________________________________
📁 支持的IFS云文件
| 文件类型 | 目的 | 人工智能理解 |
|---|---|---|
.plsql | 业务逻辑 | API、验证、业务规则 |
.entity | 数据模型 | 实体关系、属性 |
.client | 用户界面 | UI模式、命令、导航 |
.projection | 数据访问 | 查询、操作、数据表面 |
.fragment | 全栈组件 | 完整的UI到数据集成 |
.views, .storage | 数据库层 | 数据结构和访问模式 |
______________________________________________________________________
🎯 智能工作流示例
💬 User: "Add customer order validation to check credit limits"
🧠 AI Agent automatically:
1. Searches for "validation", "customer", "order", "credit" patterns
2. Finds existing CustomerOrder.plsql, validation methods
3. Analyzes business logic with PLSQL analyzer
4. Discovers Check_Insert___ validation patterns
5. Identifies existing Customer_API methods
6. Generates implementation matching your exact patterns
✅ Result: Perfect architectural consistency!______________________________________________________________________
📋 命令参考
数据库元数据提取
# Extract metadata from your database (recommended)
export IFS_DB_PASSWORD="secure_password"
uv run python -m src.ifs_cloud_mcp_server.main extract \
--host db-host --username ifsapp --service IFSCDEV 25.1.0
# Extract with connection string
uv run python -m src.ifs_cloud_mcp_server.main extract \
--connection "oracle://user:pass@host:1521/service" 25.1.0
# JSON output for automation
uv run python -m src.ifs_cloud_mcp_server.main extract \
--connection "oracle://..." --quiet --json 25.1.0ZIP管理
# Import IFS Cloud ZIP file
uv run python -m src.ifs_cloud_mcp_server.main import
# List available versions
uv run python -m src.ifs_cloud_mcp_server.main list
# Start server with specific version
uv run python -m src.ifs_cloud_mcp_server.main server --version 服务器管理
# Start MCP server (default - uses ./index)
uv run python -m src.ifs_cloud_mcp_server.main server
# Start with specific version
uv run python -m src.ifs_cloud_mcp_server.main server --version "25.1.0"
# Start with custom index path
uv run python -m src.ifs_cloud_mcp_server.main server --index-path ./my_index______________________________________________________________________
� MCP客户端配置
GitHub Copilot
{
"mcpServers": {
"ifs-cloud-intelligent-agent": {
"command": "uv",
"args": [
"run",
"python",
"-m",
"src.ifs_cloud_mcp_server.main",
"server",
"--version",
"24.2.1"
],
"cwd": "/path/to/ifs-cloud-core-mcp-server"
}
}
}克劳德桌面
{
"mcpServers": {
"ifs-cloud": {
"command": "uv",
"args": [
"run",
"python",
"-m",
"src.ifs_cloud_mcp_server.main",
"server",
"--version",
"24.2.1"
],
"cwd": "/path/to/ifs-cloud-core-mcp-server"
}
}
}______________________________________________________________________
📚 文档
- � 元数据提取CLI -从数据库中提取元数据
- �📖 ZIP索引详解 -分步导入示例
- 📋 ZIP索引说明 -完整的进口文件
- 🧠 智能代理指南 -AI代理如何工作
- 🌐 Web UI文档 -交互式探索界面
备注:所有元数据提取(包括GUI映射)现在都集成到主CLI中。使用 extract 命令从IFS Cloud数据库收集数据。______________________________________________________________________
🎉 结果
您的AI代理现在已 全面的IFS云智能 并将:
- ✅ 自动理解 您的特定IFS云模式
- ✅ 发现现有API 以及验证方法
- ✅ 生成一致的代码 与您的架构相匹配
- ✅ 遵循命名约定 以及业务规则模式
- ✅ 利用现有组件 而不是重新发明
- ✅ 保持质量标准 在所有实现中
使用真正了解IFS Cloud的AI改变您的开发工作流程! 🚀
______________________________________________________________________
_内置于❤️ IFS Cloud开发人员_
3. **打开浏览器:** 引导到 `http://localhost:5700` (或启动消息中显示的端口)并开始探索!
### 🔌 **MCP服务器模式** (用于AI集成)
1. **启动MCP服务器:**
For Claude Desktop or other MCP clients
uv run python -m src.ifs_cloud_mcp_server.main
2. **在Claude Desktop中配置:**
{ "mcpServers": { "ifs-cloud": { "command": "uv", "args": ["run", "python", "-m", "src.ifs_cloud_mcp_server.main"], "cwd": "/path/to/ifs-cloud-core-mcp-server" } } }
## 安装
Clone the repository
git clone https://github.com/graknol/ifs-cloud-core-mcp-server.git cd ifs-cloud-core-mcp-server
Install dependencies with UV (recommended)
uv sync
Or with pip
pip install -e .
For development
pip install -e ".[dev]"
### 🤖 **AI意图分类模型**
服务器使用FastAI模型进行智能查询分类。首次需要时,模型会自动从GitHub版本下载:
Models download automatically, but you can also:
Download manually
uv run python -m src.ifs_cloud_mcp_server.model_downloader
Train your own model (optional)
uv run python scripts/train_proper_fastai.py
Prepare model for release (maintainers)
uv run python scripts/prepare_model_release.py
**型号详细信息:**
- **尺寸**:约121MB(FastAI ULMFiT型号)
- **存储**:从GitHub版本下载(不在仓库中)
- **后备方案**:如果型号不可用,则性能会下降
- **GPU支持**:自动CUDA检测和加速
## 快速开始
Start the MCP server
ifs-cloud-mcp-server --port 8000 --index-path ./index
Index your IFS Cloud codebase
curl -X POST http://localhost:8000/index \ -H "Content-Type: application/json" \ -d '{"path": "/path/to/ifs/cloud/project"}'
Search for entities
curl -X POST http://localhost:8000/search \ -H "Content-Type: application/json" \ -d '{"query": "CustomerOrder", "type": "entity"}'
## 建筑
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ MCP Client │◄──►│ MCP Server │◄──►│ Tantivy Index │ └─────────────────┘ └─────────────────┘ └─────────────────┘ │ ▼ ┌─────────────────┐ │ File Processors │ │ - Entity │ │ - PL/SQL │ │ - Views │ │ - Storage │ │ - Fragment │ │ - Client │ │ - Projection │ └─────────────────┘
## 发展
Run tests
pytest
Format code
black src/ tests/
Lint code
ruff check src/ tests/
Type checking
mypy src/
## 演出
- **索引速度**:在典型硬件上约1000个文件/秒
- **搜索响应**:对于大多数查询,\<100ms
- **内存使用**:1GB代码库索引约200MB
- **增量更新**:实时文件更改跟踪
## 未来路线图
- 🤖 **人工智能集成**:FastAI/PyTorch用于语义搜索
- 🧠 **模式识别**:基于ML的代码模式检测
- 📈 **分析**:高级代码库见解和指标
- 🔗 **IDE集成**:VS Code和IntelliJ插件
## 许可证
根据许可文件中规定的条款进行许可。