SuperAPIAI Directory

src-to-kb

github.com · AI coding

Convert source code repositories into searchable knowledge bases using chunking, OpenAI embeddings and GPT-5 search.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsAPI

About this tool

src-to-kb is a tool that converts source code repositories into LLM-ready knowledge bases, developed by vezlo and open-sourced on GitHub. Through automatic chunking, embedding generation, and intelligent search, it helps developers turn codebases into queryable knowledge bases, and supports integration with IDEs such as Claude Code and Cursor via MCP (Model Context Protocol).

Main Capabilities

  • Multi-language support: Can handle multiple programming languages such as JavaScript, TypeScript, Python, Java, C++, Go, Rust, as well as configuration files such as YAML, HTML, CSS, and more.
  • Intelligent chunking: Supports code splitting with configurable overlap, and can optionally remove comments and normalize whitespace.
  • Embedding and search: Optionally uses OpenAI embeddings for semantic search; after setting OPENAI_API_KEY, search uses GPT-5 for intelligent query understanding and answering.
  • Three answer modes: enduser (simplified answers for non-technical users), developer (detailed technical answers for developers, default), copilot (examples and patterns for code implementation).
  • MCP server: Provides an MCP server that can be directly integrated into tools that support MCP, such as Claude Code and Cursor.
  • REST API: Provides a complete REST API and Swagger documentation, supports integration with external services, and offers optional API key authentication.
  • Notion integration: Can import Notion pages and databases, merging documents and project plans with code knowledge into the same search system.
  • External server integration: By setting the EXTERNAL_KB_URL environment variable, code can be sent to an external server for processing and search, and it supports uploading local knowledge bases.

Usage

Installation

  • Install globally via npm:npm install -g @vezlo/src-to-kb
  • Or use npx without installation:npx @vezlo/src-to-kb
  • You can also install it in a project or clone it from GitHub for development.

Available Commands

After installation, the following commands are available:

  • src-to-kb: Generate a knowledge base from source code
  • src-to-kb-search: Search the knowledge base
  • src-to-kb-upload: Upload the local knowledge base to an external server
  • src-to-kb-api: Start the REST API server with Swagger documentation
  • src-to-kb-mcp: Start the MCP server for IDE integration
  • src-to-kb-mcp-install: Automatically configure Claude Code/Cursor

Basic Workflow

  1. Process the repository to generate a knowledge base (you can specify the output directory, use OpenAI embeddings, etc.).
  2. Use the search command and select an answer mode to query.
  3. If IDE integration is needed, start the MCP server and configure Claude Code or Cursor.
  4. If API access is needed, start the REST API server and visit http://localhost:3000/api/v1/docs View the Swagger UI.

Output Structure

The generator creates structured JSON output containing documents/ and chunks/ directories, with each document and chunk containing the corresponding metadata.

Use Cases

  • Code documentation generation: Generate searchable documentation from a codebase.
  • AI training: Prepare code for fine-tuning or RAG systems.
  • Code analysis: Analyze patterns and structure in large repositories.
  • Knowledge extraction: Extract domain knowledge from source code.
  • Code search: Build intelligent code search systems.
  • IDE integration: Use directly in Claude Code or Cursor to understand code.
  • Team knowledge sharing: Create a searchable knowledge base for team onboarding.
  • Frontend integration: Use in Next.js/React projects for onboarding assistants, in-app documentation, code review assistants, etc.

Limitations and Considerations

  • Using OpenAI embeddings and GPT-5 search requires setting OPENAI_API_KEY.
  • External server mode requires setting the EXTERNAL_KB_URL environment variable.
  • The default file size limit is 10MB and can be adjusted through configuration.
  • The software is dual-licensed: free for non-commercial use under AGPL-3.0, and commercial use requires contacting for a commercial license.
  • In terms of performance, it processes approximately 1000 files per minute on average hardware and supports streaming processing of large files.
  • For specific configuration parameters, API details, and MCP setup, please refer to the project documentation (such as API_DOCUMENTATION.md, MCP_SETUP.md, etc.).
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools