MCP Codebase Index 标志

MCP Codebase Index

社区
NgoTaiCo

AI-powered semantic search for your codebase in GitHub Copilot, Kiro, and other MCP-compatible editors

发布者NgoTaiCo
代码仓库mcp-codebase-index
语言TypeScript
复刻数
2
星标数
20
可用工具
1
传输类型stdio
分类
链接
  • 将工具接入 AI 工作流

    MCP Codebase Index 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 1 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 20 个 Star 和 2 个 Fork。

MCP Codebase Index Server

AI-powered semantic search for your codebase in GitHub Copilot, Kiro, and other MCP-compatible editors

npm version License: MIT

A Model Context Protocol (MCP) server that enables AI editors to search and understand your codebase using Google's Gemini embeddings and Qdrant vector storage.

Supported Editors:

  • ✅ VS Code with GitHub Copilot
  • ✅ VS Code with Roo Cline
  • ✅ GitHub Copilot CLI
  • ✅ Google Gemini CLI
  • ✅ Kiro AI Editor
  • ✅ Any MCP-compatible editor

📚 Quick Navigation

🚀 Getting Started

💻 For Developers

🔧 Resources


✨ Features

  • 🔍 Semantic Search - Find code by meaning, not just keywords
  • 🎯 Smart Chunking - Automatically splits code into logical functions/classes
  • 🔄 Incremental Indexing - Only re-indexes changed files (90%+ time savings)
  • 💾 Auto-save Checkpoints - Saves progress every 10 files, resume anytime
  • 📊 Real-time Progress - Track indexing with ETA and performance metrics
  • ⚡ Parallel Processing - 25x faster indexing with batch execution
  • 🔄 Real-time Watch - Auto-updates index on file changes
  • 🌐 Multi-language - Supports 15+ programming languages
  • ☁️ Vector Storage - Uses Qdrant for persistent storage
  • 🤖 Prompt Enhancement - AI-powered query improvement (optional)
  • � Vector Visualization - 2D/3D UMAP visualization of your codebase
  • 🏗️ Modular Architecture - Clean handler separation for maintainability
  • �📦 Simple Setup - Just 4 environment variables

🚀 Quick Start

Prerequisites

  1. Gemini API Key - Get free at Google AI Studio
  2. Qdrant Cloud Account - Sign up free at cloud.qdrant.io

Installation

Choose your environment:

Step 1: Open MCP Configuration in VS Code

  1. Open GitHub Copilot Chat (Ctrl+Alt+I / Cmd+Alt+I)
  2. Click Settings icon → MCP Servers → MCP Configuration (JSON)

Step 2: Add this configuration to mcp.json:

json
{
  "servers": {
    "codebase": {
      "command": "npx",
      "args": ["-y", "@ngotaico/mcp-codebase-index"],
      "env": {
        "REPO_PATH": "/absolute/path/to/your/project",
        "GEMINI_API_KEY": "AIzaSyC...",
        "QDRANT_URL": "https://your-cluster.gcp.cloud.qdrant.io:6333",
        "QDRANT_API_KEY": "eyJhbGci..."
      },
      "type": "stdio"
    }
  }
}

Step 3: Restart VS Code

The server will automatically:

  • Connect to Qdrant Cloud
  • Index your codebase
  • Watch for file changes

📖 Detailed instructions:


📖 Usage

Search Your Codebase

Ask GitHub Copilot:

"Find the authentication logic"
"Show me how database connections are handled"
"Where is error logging implemented?"

Visualize Your Codebase

Ask GitHub Copilot:

"Visualize my codebase"
"Show me how my code is organized"
"Visualize authentication code"

📖 Complete guide: Vector Visualization Guide

Check Indexing Status

"Check indexing status"
"Show me detailed indexing progress"

📖 More examples: Testing Guide

📊 Vector Visualization

See your codebase in 2D/3D space - Understand semantic relationships and code organization visually.

What is Vector Visualization?

Vector visualization transforms your codebase's 768-dimensional embeddings into interactive 2D or 3D visualizations using UMAP dimensionality reduction. This allows you to:

  • 🎨 Explore semantic relationships - Similar code clusters together
  • 🔍 Understand architecture - See your codebase structure at a glance
  • 🎯 Debug search results - Visualize why certain code was retrieved
  • 📈 Track code organization - Identify modules, patterns, and outliers

Quick Start

Visualize entire codebase:

User: "Visualize my codebase"

Result: Interactive clusters showing:
- API Controllers & Routes (28%)
- Database Models (23%)
- Authentication (19%)
- Business Logic (18%)
- Test Suites (12%)

Export as HTML:

User: "Export visualization as HTML"

Result: Standalone HTML file with:
- Interactive hover, zoom, pan
- Click clusters to highlight
- Modern gradient UI
- Works offline

Understanding the Visualization

Colors and Clusters:

  • Each color represents a semantic cluster (module/functionality)
  • Points close together = similar in meaning
  • Distance reflects semantic similarity
  • Outliers indicate unique/specialized code

Common Cluster Patterns:

  • Blue: Frontend/UI components
  • Orange: API endpoints and routes
  • Green: Database models and queries
  • Red: Authentication and security
  • Purple: Tests and validation
  • Gray: Utilities and helpers

Use Cases

  1. 🏗️ Architecture Understanding

    • Visualize to see module boundaries
    • Identify tightly coupled code
    • Find opportunities for refactoring
  2. 🔍 Code Discovery

    • Locate related functionality visually
    • Find all code touching a feature
    • Discover cross-cutting concerns
  3. 🐛 Search Debugging

    • Understand why results were retrieved
    • See semantic relationships
    • Refine queries based on visualization
  4. 👥 Team Onboarding

    • Export HTML for new developers
    • Visual guide to codebase structure
    • Interactive exploration tool
  5. ✅ Refactoring Validation

    • Visualize before/after refactoring
    • Verify improved code organization
    • Track architecture evolution

Performance

Collection SizeProcessing TimeRecommended maxVectors
Small (<500 vectors)~1s500
Medium (500-2K)~4s1000
Large (2K-10K)~15s2000
Very Large (>10K)~30s3000

Tips:

  • Use 2D for faster processing (40% faster than 3D)
  • Limit maxVectors for large codebases
  • Export HTML for offline exploration

📖 Learn More

For detailed documentation including:

  • Complete tool reference
  • Interpretation guide
  • Technical details (UMAP, clustering)
  • Troubleshooting
  • Best practices
  • Advanced use cases

See: Vector Visualization Guide


🎯 Prompt Enhancement (Optional)

TL;DR: Prompt enhancement is a transparent background tool that automatically improves search quality. Just ask naturally - no need to mention "enhance" in your prompts.

Quick Overview

When enabled (PROMPT_ENHANCEMENT=true), the AI automatically:

  1. Enhances your search query with codebase context
  2. Searches with the improved query
  3. Continues with your original request (implement, fix, explain, etc.)

Good Prompts ✅

✅ "Find authentication logic and add 2FA support"
✅ "Locate payment flow and fix the timeout issue"
✅ "Search for profile feature and add bio field"

Why these work: Clear goal (find + action) → AI knows what to do

Bad Prompts ❌

❌ "Enhance and search for authentication"
❌ "Use prompt enhancement to find profile"

Why these fail: No clear action → AI stops after search

Key Principle

Prompt enhancement is invisible infrastructure.

Just tell the AI what you want to accomplish. It will automatically use enhancement to improve search quality behind the scenes.

Think of it like autocomplete: You don't say "use autocomplete" - you just type and it helps automatically.

📖 Learn More

For detailed guide including:

  • Technical details and architecture
  • Configuration options
  • Real-world examples (TypeScript, Python, Dart, etc.)
  • Performance tips and optimization
  • Troubleshooting and FAQ
  • Advanced use cases

See: Prompt Enhancement Guide


🎛️ Configuration

Required Variables

json
{
  "env": {
    "REPO_PATH": "/Users/you/Projects/myapp",
    "GEMINI_API_KEY": "AIzaSyC...",
    "QDRANT_URL": "https://xxx.gcp.cloud.qdrant.io:6333",
    "QDRANT_API_KEY": "eyJhbGci..."
  }
}

Optional Variables

json
{
  "env": {
    "QDRANT_COLLECTION": "my_project",
    "WATCH_MODE": "true",
    "BATCH_SIZE": "50",
    "EMBEDDING_MODEL": "text-embedding-004",
    "PROMPT_ENHANCEMENT": "true"
  }
}

📖 Full configuration guide: Setup Guide


🌍 Supported Languages

Python • TypeScript • JavaScript • Dart • Go • Rust • Java • Kotlin • Swift • Ruby • PHP • C • C++ • C# • Shell • SQL • HTML • CSS


📊 Performance

MetricValue
Indexing Speed~25 files/min
Search Latency<100ms
Incremental Savings90%+ time reduction
Parallel Processing25 chunks/sec

📖 Performance details: Main Documentation


🐛 Troubleshooting

Server not appearing?

  1. Check Copilot Chat → Settings → MCP Servers → Show Output
  2. Verify all 4 env variables are set
  3. Ensure REPO_PATH is absolute path

Can't connect to Qdrant?

bash
curl -H "api-key: YOUR_KEY" \
  https://YOUR_CLUSTER.gcp.cloud.qdrant.io:6333/collections

Indexing too slow?

  • Large repos take 5-10 minutes initially
  • Subsequent runs only index changed files (90%+ faster)

📖 More troubleshooting: Main Documentation


📁 Project Structure

mcp-codebase-index/
├── docs/                    # All documentation
│   ├── README.md           # Main documentation
│   ├── SETUP.md            # Setup guide
│   ├── CHANGELOG.md        # Version history
│   ├── NAVIGATION.md       # Navigation guide
│   ├── guides/             # Detailed guides
│   └── planning/           # Development planning
│
├── src/                     # Source code
│   ├── core/               # Core business logic
│   ├── storage/            # Data persistence
│   ├── enhancement/        # Prompt enhancement
│   ├── visualization/      # Vector visualization
│   ├── mcp/                # MCP server
│   │   ├── server.ts      # Server orchestration (1237 lines)
│   │   ├── handlers/      # Modular handlers (1045 lines)
│   │   ├── templates/     # HTML templates
│   │   └── types/         # Handler types
│   ├── types/              # Type definitions
│   └── index.ts            # Entry point
│
├── config/                  # Configuration files
├── .data/                   # Runtime data (gitignored)
├── package.json
└── README.md               # This file

📖 Detailed structure: Project Structure | Source Code Structure


🔧 Development

Build

bash
npm run build

Run Locally

bash
npm run dev

Test

bash
npm test

📖 Development guide: Source Code Structure


🤝 Contributing

Contributions welcome! Check out:


📄 License

MIT © NgoTaiCo


📞 Support


⭐ If you find this useful, please star the repo!

安装

TypingMind
{
  "mcpServers": {
    "mcp-codebase-index": {
      "command": "npx",
      "args": [
        "-y",
        "@ngotaico/mcp-codebase-index"
      ],
      "env": {
        "REPO_PATH": "<REPO_PATH>",
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}

可用工具

  • search_codebase

    Search your codebase using natural language queries. Returns relevant code snippets with file paths and line numbers.

将 MCP Codebase Index MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 MCP Codebase Index 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请保持终端窗口及其中的进程运行。
3

将 MCP Codebase Index 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 MCP Codebase Index MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "mcp-codebase-index": {
      "command": "npx",
      "args": [
        "-y",
        "@ngotaico/mcp-codebase-index"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 MCP Codebase Index MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 MCP Codebase Index MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 MCP Codebase Index 帮我完成这项任务吗?
MCP Codebase Index
当然。我已阅读。
以下是我使用 MCP Codebase Index 得到的结果。

常见问题

MCP Codebase Index MCP 服务器有什么用途?

MCP Codebase Index 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 MCP Codebase Index MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您可以让 Claude、ChatGPT、Gemini 等不同 AI 模型,或您在 TypingMind 中配置的其他模型使用 MCP Codebase Index,而无需为每个模型单独配置 MCP 服务器。

为什么在 TypingMind 中使用 MCP Codebase Index MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是优秀的大语言模型聊天前端之一。连接 MCP Codebase Index 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 MCP Codebase Index MCP 连接到 TypingMind?

MCP Codebase Index 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

MCP Codebase Index MCP 在 TypingMind 中提供哪些工具?

MCP Codebase Index 提供 1 个 MCP 工具,您可以在 TypingMind 的插件页面启用这些工具,然后在聊天中使用,或将其分配给 AI 智能体。

使用 MCP Codebase Index MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行掌控模型提供商、API 密钥、提示词和 MCP 配置。如果 MCP Codebase Index 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

Codebase Index Status

Collection: codebase (0 vectors)

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇