MCP Codebase Server

MCP Codebase Server

MCP server for semantic codebase navigation that builds an AST index of symbols, imports, and exports, providing AI agents with tools to search, explore, and understand code.

Category
Visit Server

README

MCP Codebase Server

MCP сервер для семантической навигации по кодовой базе. Строит AST-индекс символов, импортов и экспортов, предоставляя высокоуровневые инструменты для ИИ-агента.

Возможности

  • Поиск символов — ищет функции, классы, интерфейсы, методы и др. по имени с поддержкой wildcard (*, ?) и OR (|)
  • Детали символа — показывает исходный код, сигнатуру, документацию, импорты файла
  • Обзор модуля — структура директории, ключевые символы, поддиректории, топ импортов
  • Поиск использований — находит все ссылки на символ в проекте
  • Зависимости модуля — импорты, экспорты, файлы, которые используют данный модуль
  • Переиндексация — полная или инкрементальная (по mtime)
  • Watch mode — автоматическое обновление индекса при изменении файлов

Поддерживаемые языки

Язык Парсер Символы Импорты Экспорты
TypeScript / JavaScript TypeScript Compiler API
C# Regex-based (lightweight) ✅ (using) ✅ (public)

Архитектура позволяет легко добавлять новые языки через интерфейс ILanguageParser.

Требования

  • Node.js 18+
  • PostgreSQL 14+

Установка

npm install
npm run build

Настройка

Переменные окружения:

Переменная Описание По умолчанию
PROJECT_ROOT Корневая директория проекта process.cwd()
PGHOST Хост PostgreSQL localhost
PGPORT Порт PostgreSQL 5432
PGDATABASE Имя базы данных codebase_index
PGUSER Пользователь PostgreSQL postgres
PGPASSWORD Пароль PostgreSQL postgres

Интеграция с Kimi CLI

Добавьте в kimi-mcp.json:

{
  "mcpServers": {
    "codebase": {
      "command": "node",
      "args": ["<path-to-mcp-codebase>/dist/index.js"],
      "env": {
        "PROJECT_ROOT": "<path-to-your-codebase>",
        "PGHOST": "localhost",
        "PGPORT": "5432",
        "PGDATABASE": "codebase_index",
        "PGUSER": "postgres",
        "PGPASSWORD": "your_password"
      }
    }
  }
}

Инструменты MCP

search_symbols

Поиск символов по имени с фильтрацией.

{
  "query": "UserService|useAuth|*Controller",
  "kind": "class|function",
  "language": "typescript",
  "file_path": "src/services",
  "limit": 20
}

get_symbol_details

Полная информация о символе.

{ "symbol_id": 123 }
// или
{ "name": "UserService", "file_path": "src/services/UserService.ts" }

explore_module

Обзор директории.

{ "path": "src/services", "depth": 1 }

find_usages

Поиск использований символа.

{ "name": "UserService", "file_path": "src/services/UserService.ts" }

get_module_dependencies

Граф зависимостей файла.

{ "path": "src/services/UserService.ts" }

reindex

Принудительная переиндексация.

{ "full": false }

Архитектура

src/
├── index.ts                 # MCP server
├── config.ts                # Конфигурация
├── db/
│   ├── connection.ts        # Пул PostgreSQL
│   ├── schema.ts            # DDL и миграции
│   └── repositories.ts      # Запросы к БД
├── indexer/
│   ├── file-crawler.ts      # Обход файлов
│   ├── indexer.ts           # Оркестрация индексации
│   └── watcher.ts           # Watch mode (chokidar)
├── parsers/
│   ├── interface.ts         # ILanguageParser
│   ├── typescript.ts        # TS/JS парсер
│   └── csharp.ts            # C# парсер
├── tools/
│   ├── search-symbols.ts
│   ├── symbol-details.ts
│   ├── explore-module.ts
│   ├── find-usages.ts
│   ├── module-deps.ts
│   └── reindex.ts
└── utils/
    ├── gitignore.ts
    └── paths.ts

Производительность

На проекте lowcodeplatform (~71K файлов, ~730 исходных файлов без node_modules/dist):

  • Полная индексация: ~1.3 сек
  • Символов в индексе: ~5000
  • Поиск символа: < 50 мс

Расширение на другие языки

  1. Создайте класс, реализующий ILanguageParser
  2. Зарегистрируйте его в src/indexer/indexer.ts
  3. Добавьте расширение в config.languageMap

Пример:

export class PythonParser implements ILanguageParser {
  readonly supportedExtensions = ['.py'];
  readonly languageId = 'python';
  parse(filePath: string, content: string): ParseResult | null { ... }
}

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured