智能代码分析服务器

IFS Cloud MCP Server是一款AI驱动的模型上下文协议服务器,提供深度代码分析、PageRank重要性排名和智能代码搜索功能,适用于IFS Cloud代码库的全面理解和智能搜索。

  • by graknol
  • Python
  • 本地部署
  • 9 星标
  • 更新于
在 GitHub 查看 graknol/ifs-cloud-core-mcp-server

使用说明

🧠 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 sync

2. 导入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 <zip_file> --version <version_name>

# Download pre-built indexes from GitHub (fastest setup)
uv run python -m src.ifs_cloud_mcp_server.main download --version <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 <version_name> [--force]

分析命令

# Analyze codebase (extract dependencies, API calls, etc.)
uv run python -m src.ifs_cloud_mcp_server.main analyze --version <version> [--max-files N] [--force]

# Calculate PageRank importance scores
uv run python -m src.ifs_cloud_mcp_server.main calculate-pagerank --version <version>

# Create embeddings for semantic search (uses BGE-M3 model)
uv run python -m src.ifs_cloud_mcp_server.main embed --version <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 <version> --max-files 10

服务器操作

# Start MCP server
uv run python -m src.ifs_cloud_mcp_server.main server --version <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加速的大多数查询,<100ms
  • BGE-M3嵌入生成:每次查询约50ms(GPU)/约200ms(CPU)
  • BM25S词汇搜索:10000多个文档中<10ms
  • FlashRank神经重新排名:前K候选融合<50ms
  • FAISS矢量搜索:<10ms,1024个暗BGE-M3嵌入

系统性能

  • 分析速度:现代硬件上每秒1000+个文件
  • 内存效率高:处理10000多个文件代码库
  • 可扩展的:版本隔离可防止数据冲突
  • GPU加速:用于语义搜索的CUDA自动检测

🛠️ 发展

# Install for development
uv sync --dev

# Run tests
uv run pytest

# Format code
uv run black src/ tests/

# Type checking
uv run mypy src/

📚 数据存储

系统将数据存储在具有单独索引的版本目录中:

%APPDATA%/ifs_cloud_mcp_server/               # Windows
~/.local/share/ifs_cloud_mcp_server/          # Linux/macOS
├── versions/
│   └── 25.1.0/
│       ├── source/              # Extracted files
│       ├── analysis/            # Analysis results
│       ├── ranked.jsonl         # PageRank results
│       ├── bm25s/              # BM25S lexical index
│       │   ├── index.h5        # BM25S index data
│       │   └── corpus.jsonl    # Document corpus
│       └── faiss/              # FAISS semantic index
│           ├── index.faiss     # Vector index
│           ├── embeddings.npy  # BGE-M3 embeddings
│           └── metadata.jsonl  # Document metadata
└── models/                     # Downloaded models
    └── bge-m3/                # BGE-M3 model cache

🔮 未来的增强功能

  • � 高级AI模型:与较新的嵌入模型(BGE-M4、E5-v3)集成
  • 🔍 查询理解:自然语言意图分类和查询扩展
  • 📊 可视化分析:交互式依赖关系图可视化
  • 🌐 web界面:通过搜索过滤增强基于浏览器的探索
  • 🚀 演出:进一步优化混合搜索管道
  • 🎯 专用搜索:特定领域的搜索模式(UI模式、业务逻辑等)

⭐ 标记此回购 • 🐛 报告问题 • 💬 讨论

内置于❤️ IFS Cloud开发人员

--connection "oracle://ifsapp:password@host:1521/IFSCDEV" 25.1.0 ```

📦 使用生产数据 (准备使用):

  • 具有预提取生产元数据的完整系统
  • 通过业务术语匹配和元数据丰富增强搜索
  • 可与真正的IFS Cloud文件一起使用
cd production
uv run python test_setup.py  # Verify production setup
uv run python demos/demo_real_files.py  # See the magic happen!

� 自定义ZIP导入 (对于特定版本):

# Import any IFS Cloud ZIP file to create versioned catalog
uv run python -m src.ifs_cloud_mcp_server.main import "IFS_Cloud_24.2.1.zip" --version "24.2.1"

3. 启动智能AI代理

# Start with your imported version
uv run python -m src.ifs_cloud_mcp_server.main server --version "24.2.1"

4. 连接GitHub副本

配置您的MCP客户端以连接到智能AI代理,体验真正了解IFS云模式的AI!


🔧 智能功能

🧠 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
• <100ms search response
• Intelligent caching system
• Batch processing optimization

📁 支持的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.0

ZIP管理

# Import IFS Cloud ZIP file
uv run python -m src.ifs_cloud_mcp_server.main import <zip_file> <version>

# 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 <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"
    }
  }
}

📚 文档

备注:所有元数据提取(包括GUI映射)现在都集成到主CLI中。使用 extract 命令从IFS Cloud数据库收集数据。


🎉 结果

您的AI代理现在已 全面的IFS云智能 并将:

  • ✅ 自动理解 您的特定IFS云模式
  • ✅ 发现现有API 以及验证方法
  • ✅ 生成一致的代码 与您的架构相匹配
  • ✅ 遵循命名约定 以及业务规则模式
  • ✅ 利用现有组件 而不是重新发明
  • ✅ 保持质量标准 在所有实现中

使用真正了解IFS Cloud的AI改变您的开发工作流程! 🚀


⭐ 标记此回购 • 📝 报告问题 • 💬 讨论

内置于❤️ IFS Cloud开发人员

```
  1. 打开浏览器: 引导到 http://localhost:5700 (或启动消息中显示的端口)并开始探索!

🔌 MCP服务器模式 (用于AI集成)

  1. 启动MCP服务器:
# For Claude Desktop or other MCP clients
uv run python -m src.ifs_cloud_mcp_server.main
  1. 在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插件

许可证

根据许可文件中规定的条款进行许可。