Skip to main content

基于MCP协议的代码检索工具

Project description

MCP代码索引器 (MCP Code Indexer)

基于模型上下文协议(Model Context Protocol)的智能代码检索工具,为AI大语言模型提供高效精确的代码库检索能力。

English Version

项目简介

MCP代码索引器是一个专为AI大语言模型设计的代码检索工具。它通过向量化索引和语义理解,帮助AI更好地理解和分析代码库,显著提升代码相关任务的处理效率和准确性。

项目地址:https://github.com/zxfgds/mcp-code-indexer

主要特性

  • 智能代码检索

    • 基于语义的代码搜索,理解代码含义而不仅是关键字匹配
    • 支持跨语言代码检索
    • 智能代码片段提取,自动识别完整的代码上下文
  • 代码分析能力

    • 代码结构分析(类、函数、依赖关系)
    • 代码质量评估
    • 文档和注释提取
    • 相似代码检测
    • 代码度量统计
    • 项目依赖分析
  • 优化的上下文处理

    • 智能Token消耗控制,减少不必要的上下文信息
    • 结构化的代码上下文提供
    • 多项目并行索引和检索支持
    • 持久化项目识别,避免重复索引
  • 完整MCP协议支持

    • 符合MCP数据交互规范
    • 提供丰富的工具集
    • 支持异步操作和进度反馈

应用场景

Claude Desktop应用

  • 增强代码理解:帮助Claude更准确地理解用户的代码库,提供更精准的建议和解答
  • 智能代码导航:快速定位相关代码片段,提高问答效率
  • 代码质量改进:通过代码分析功能,提供更专业的代码优化建议
  • 项目依赖管理:帮助理解和管理项目依赖关系
  • 文档生成辅助:基于代码注释和结构分析,协助生成技术文档

VSCode扩展

  • 实时代码分析:在编辑器中直接获取代码分析结果
  • 智能代码推荐:基于项目上下文提供更准确的代码建议
  • 重构辅助:识别可优化的代码模式,辅助代码重构
  • 依赖关系可视化:直观展示代码依赖关系
  • 团队协作增强:帮助团队成员更好地理解代码库

安装说明

  1. 安装依赖
pip install -r requirements.txt
  1. 安装工具
python setup.py install

配置说明

Claude Desktop配置

编辑配置文件:%APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "code-indexer": {
      "command": "python",
      "args": ["-m", "server.app"],
      "cwd": "安装目录路径",
      "env": {},
      "disabled": false,
      "alwaysAllow": []
    }
  }
}

VSCode扩展配置

编辑配置文件:%APPDATA%\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\cline_mcp_settings.json

{
  "mcpServers": {
    "code-indexer": {
      "command": "python",
      "args": ["-m", "server.app"],
      "cwd": "安装目录路径",
      "env": {},
      "disabled": false,
      "alwaysAllow": []
    }
  }
}

使用说明

基本功能

  1. 项目识别
使用identify_project工具识别项目
  1. 索引项目
使用index_project工具索引项目代码
  1. 搜索代码
使用search_code工具搜索相关代码片段

高级功能

  1. 获取代码结构
使用get_code_structure工具分析代码结构
  1. 分析代码质量
使用analyze_code_quality工具评估代码质量
  1. 提取文档
使用extract_documentation工具提取代码文档
  1. 查找相似代码
使用find_similar_code工具检测相似代码
  1. 获取代码度量
使用get_code_metrics工具获取代码统计数据
  1. 分析依赖关系
使用analyze_dependencies工具分析项目依赖

项目价值

  1. 提升AI代码理解能力

    • 更准确的代码语义理解
    • 更全面的项目上下文把握
    • 更智能的代码相关建议
  2. 优化开发体验

    • 减少重复工作
    • 提高代码质量
    • 加速开发流程
  3. 增强团队协作

    • 便于代码审查
    • 提升代码可维护性
    • 促进知识共享
  4. 降低资源消耗

    • 优化Token使用
    • 提高响应速度
    • 减少计算开销

贡献指南

欢迎提交Issue和代码贡献。

许可证

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iflow_mcp_zxfgds_mcp_code_indexer-0.1.1.tar.gz (58.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file iflow_mcp_zxfgds_mcp_code_indexer-0.1.1.tar.gz.

File metadata

  • Download URL: iflow_mcp_zxfgds_mcp_code_indexer-0.1.1.tar.gz
  • Upload date:
  • Size: 58.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_zxfgds_mcp_code_indexer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 38eaad9b91175de7377ee3ce7fcd9b8fe7016103bd8efc2c40c1160b25d2dc26
MD5 e1f382020980cf34e29f122c0f6d736e
BLAKE2b-256 a203d2852b10d3604a2a37b980e35faddce07f51b823adad2929e068245eecaf

See more details on using hashes here.

File details

Details for the file iflow_mcp_zxfgds_mcp_code_indexer-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_zxfgds_mcp_code_indexer-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 71.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_zxfgds_mcp_code_indexer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9cf0ec6c4a7eb6b05bc1201b739b23f454ca80b0cf04920048e99588551f628b
MD5 ab76a0a006dd660b0631d8d9db8e6bf8
BLAKE2b-256 793dd9e8a28b03670f4876ff313b1971b1634cc2a2ed0b8bfbf3a302562c684e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page