Skip to main content
Glama

code-index-mcp

代码索引 MCP

用于代码索引、搜索和分析的模型上下文协议服务器。

什么是代码索引 MCP?

代码索引 MCP 是一款专用的 MCP 服务器,提供智能代码索引和分析功能。它支持大型语言模型与您的代码存储库进行交互,从而提供实时洞察并导航复杂的代码库。

该服务器与模型上下文协议(MCP) 集成,这是 AI 模型与外部工具和数据源交互的标准化方式。

主要特点

  • 项目索引:递归扫描目录以构建可搜索的代码文件索引
  • 代码搜索:查找代码库中的模式、函数定义和引用
  • 文件分析:获取有关文件结构、导入和复杂性的详细信息
  • 智能过滤:自动忽略构建目录、依赖项和非代码文件
  • 持久存储:缓存索引以提高跨会话的性能

支持的文件类型

该服务器支持多种编程语言和文件扩展名,包括:

  • Python(.py)
  • JavaScript/TypeScript(.js、.ts、.jsx、.tsx)
  • Java(.java)
  • C/C++(.c、.cpp、.h、.hpp)
  • C#(.cs)
  • 前往(.go)
  • Ruby(.rb)
  • PHP(.php)
  • Swift(.swift)
  • Kotlin (.kt)
  • Rust(.rs)
  • Scala(.scala)
  • Shell 脚本(.sh、.bash)
  • Web 文件(.html、.css、.scss)
  • 文档/配置(.md、.json、.xml、.yml、.yaml)

安装

先决条件

  • Python 3.8 或更高版本
  • uv包管理器(推荐)

使用 uvx(推荐)

安装和使用 code-index-mcp 最简单的方法是使用 uvx:

uvx code-index-mcp

使用 pip

或者,您可以通过 pip 安装:

pip install code-index-mcp

安装后,您可以将其作为模块运行:

python -m code_index_mcp

与 Claude Desktop 集成

将其添加到您的 Claude 设置( ~/Library/Application Support/Claude/claude_desktop_config.json ):

{ "mcpServers": { "code-index": { "command": "uvx", "args": [ "code-index-mcp" ] } } }

添加配置后,重新启动 Claude Desktop,Code Index MCP 工具即可使用。

可用工具

核心工具

  • set_project_path :设置索引的基本项目路径。
  • search_code :在索引文件中搜索代码匹配。
  • find_files :在项目中查找与给定模式匹配的文件。
  • get_file_summary :获取特定文件的摘要,包括行数、函数、导入等。
  • refresh_index :刷新项目索引。
  • get_settings_info :获取有关项目设置的信息。

实用工具

  • create_temp_directory :创建用于存储索引数据的临时目录。
  • check_temp_directory :检查用于存储索引数据的临时目录。
  • clear_settings :清除所有设置和缓存数据。

Claude 的示例用法

以下是一些如何使用 Claude 代码索引 MCP 的示例:

设置项目路径

Please set the project path to C:\Users\username\projects\my-python-project

搜索代码模式

Search the code for all occurrences of "def process_data" in Python files

获取文件摘要

Give me a summary of the main.py file in the project

查找特定类型的所有文件

Find all JavaScript files in the project

发展

从源代码构建

  1. 克隆存储库:
git clone https://github.com/username/code-index-mcp.git cd code-index-mcp
  1. 安装依赖项:
uv sync
  1. 在本地运行服务器:
uv run code_index_mcp

调试

您可以使用 MCP 检查器来调试服务器:

npx @modelcontextprotocol/inspector uvx code-index-mcp

执照

MIT 许可证

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

语言

-
security - not tested
A
license - permissive license
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

模型上下文协议 (MCP) 服务器,可帮助大型语言模型以最少的设置索引、搜索和分析代码存储库

  1. 什么是代码索引 MCP?
    1. 主要特点
      1. 支持的文件类型
        1. 安装
          1. 先决条件
          2. 使用 uvx(推荐)
          3. 使用 pip
        2. 与 Claude Desktop 集成
          1. 可用工具
            1. 核心工具
            2. 实用工具
          2. Claude 的示例用法
            1. 设置项目路径
            2. 搜索代码模式
            3. 获取文件摘要
            4. 查找特定类型的所有文件
          3. 发展
            1. 从源代码构建
          4. 调试
            1. 执照
              1. 贡献
                1. 语言

                  Related MCP Servers

                  • -
                    security
                    A
                    license
                    -
                    quality
                    A Model Context Protocol server that enables LLMs to read, search, and analyze code files with advanced caching and real-time file watching capabilities.
                    Last updated -
                    2
                    15
                    JavaScript
                    MIT License
                    • Linux
                    • Apple
                  • -
                    security
                    F
                    license
                    -
                    quality
                    A smart code retrieval tool based on Model Context Protocol that provides efficient and accurate code repository search capabilities for large language models.
                    Last updated -
                    Python
                  • -
                    security
                    A
                    license
                    -
                    quality
                    A Model Context Protocol (MCP) compliant server that allows Large Language Models (LLMs) to search and retrieve content from microCMS APIs.
                    Last updated -
                    TypeScript
                    MIT License
                  • -
                    security
                    A
                    license
                    -
                    quality
                    A Model Context Protocol (MCP) server that scrapes, indexes, and searches documentation for third-party software libraries and packages, supporting versioning and hybrid search.
                    Last updated -
                    231
                    129
                    TypeScript
                    MIT License
                    • Apple

                  View all related MCP servers

                  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/johnhuang316/code-index-mcp'

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