AutoDev Codebase MCP Server

AutoDev Codebase MCP Server

HTTP-based server that provides semantic code search capabilities to IDEs through the Model Context Protocol, allowing efficient codebase exploration without repeated indexing.

Category
访问服务器

README

@autodev/codebase

<div align="center"> <img src="src/images/image1.png" width="300" alt="Image 1" style="margin: 0 10px;" /> <img src="src/images/image2.png" width="200" alt="Image 2" style="margin: 0 10px;" /> <img src="src/images/image3.png" height="150" alt="Image 3" style="margin: 0 10px;" /> </div>

<br />

A platform-agnostic code analysis library with semantic search capabilities and MCP (Model Context Protocol) server support. This library provides intelligent code indexing, vector-based semantic search, and can be integrated into various development tools and IDEs.

🚀 Features

  • Semantic Code Search: Vector-based code search using embeddings
  • MCP Server Support: HTTP-based MCP server for IDE integration
  • Terminal UI: Interactive CLI with rich terminal interface
  • Tree-sitter Parsing: Advanced code parsing and analysis
  • Vector Storage: Qdrant vector database integration
  • Flexible Embedding: Support for various embedding models via Ollama

📦 Installation

1. Install and Start Ollama

# Install Ollama (macOS)
brew install ollama

# Start Ollama service
ollama serve

# In a new terminal, pull the embedding model
ollama pull nomic-embed-text

2. Install and Start Qdrant

Start Qdrant using Docker:

# Start Qdrant container
docker run -p 6333:6333 -p 6334:6334 qdrant/qdrant

Or download and run Qdrant directly:

# Download and run Qdrant
wget https://github.com/qdrant/qdrant/releases/latest/download/qdrant-x86_64-unknown-linux-gnu.tar.gz
tar -xzf qdrant-x86_64-unknown-linux-gnu.tar.gz
./qdrant

3. Verify Services Are Running

# Check Ollama
curl http://localhost:11434/api/tags

# Check Qdrant
curl http://localhost:6333/collections

4. Install project locally

git clone https://github.com/anrgct/autodev-codebase
cd autodev-codebase
npm install
npm run build
npm link

🛠️ Usage

Command Line Interface

The CLI provides two main modes:

1. Interactive TUI Mode (Default)

# Basic usage: index your current folder as the codebase.
# Be cautious when running this command if you have a large number of files.
codebase


# With custom options
codebase --demo # Create a local demo directory and test the indexing service, recommend for setup
codebase --path=/my/project
codebase --path=/my/project --log-level=info

2. MCP Server Mode (Recommended for IDE Integration)

# Start long-running MCP server
cd /my/project
codebase mcp-server

# With custom configuration
codebase mcp-server --port=3001 --host=localhost
codebase mcp-server --path=/workspace --port=3002

IDE Integration (Cursor/Claude)

Configure your IDE to connect to the MCP server:

{
  "mcpServers": {
    "codebase": {
      "url": "http://localhost:3001/sse"
    }
  }
}

Library Usage

Node.js Usage

import { createNodeDependencies } from '@autodev/codebase/adapters/nodejs'
import { CodeIndexManager } from '@autodev/codebase'

const deps = createNodeDependencies({ 
  workspacePath: '/path/to/project',
  storageOptions: { /* ... */ },
  loggerOptions: { /* ... */ },
  configOptions: { /* ... */ }
})

const manager = CodeIndexManager.getInstance(deps)
await manager.initialize()
await manager.startIndexing()

🔧 CLI Options

Global Options

  • --path=<path> - Workspace path (default: current directory)
  • --demo - Create demo files in workspace
  • --ollama-url=<url> - Ollama API URL (default: http://localhost:11434)
  • --qdrant-url=<url> - Qdrant vector DB URL (default: http://localhost:6333)
  • --model=<model> - Embedding model (default: nomic-embed-text)
  • --config=<path> - Config file path
  • --storage=<path> - Storage directory path
  • --cache=<path> - Cache directory path
  • --log-level=<level> - Log level: error|warn|info|debug (default: error)
  • --help, -h - Show help

MCP Server Options

  • --port=<port> - HTTP server port (default: 3001)
  • --host=<host> - HTTP server host (default: localhost)

🌐 MCP Server Features

Web Interface

  • Home Page: http://localhost:3001 - Server status and configuration
  • Health Check: http://localhost:3001/health - JSON status endpoint
  • MCP Endpoint: http://localhost:3001/sse - SSE/HTTP MCP protocol endpoint

Available MCP Tools

  • search_codebase - Semantic search through your codebase
    • Parameters: query (string), limit (number), filters (object)
    • Returns: Formatted search results with file paths, scores, and code blocks
  • get_search_stats - Get indexing status and statistics
  • configure_search - Configure search parameters at runtime

Scripts

# Development mode with demo files
npm run dev

# Build for production
npm run build

# Type checking
npm run type-check

# Run TUI demo
npm run demo-tui

# Start MCP server demo
npm run mcp-server

💡 Why Use MCP Server Mode?

Problems Solved

  • ❌ Repeated Indexing: Every IDE connection re-indexes, wasting time and resources
  • ❌ Complex Configuration: Each project needs different path parameters in IDE
  • ❌ Resource Waste: Multiple IDE windows start multiple server instances

Benefits

  • ✅ One-time Indexing: Server runs long-term, index persists
  • ✅ Simplified Configuration: Universal IDE configuration, no project-specific paths
  • ✅ Resource Efficiency: One server instance per project
  • ✅ Better Developer Experience: Start server in project directory intuitively
  • ✅ Backward Compatible: Still supports traditional per-connection mode
  • ✅ Web Interface: Status monitoring and configuration help
  • ✅ Dual Mode: Can run both TUI and MCP server simultaneously

This is a platform-agnostic library extracted from the roo-code VSCode plugin.

📚 Examples

See the examples/ directory for complete usage examples:

  • nodejs-usage.ts - Node.js integration examples
  • run-demo-tui.tsx - TUI demo application

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选