Code Sage
C

Code Sage

A high - performance MCP server for semantic code search, written in Rust, supporting hybrid search (BM25 + vector embedding), AST intelligent chunking, and over 60 programming languages.
2.5 points
5.4K

What is Code Sage?

Code Sage is an intelligent code search tool designed specifically for developers. It can understand the semantic meaning of code, rather than just keyword matching. By analyzing your codebase, it can quickly find functions, classes, and methods related to your query intent, greatly improving the efficiency of code search.

How to use Code Sage?

Using Code Sage is very simple: First, configure the MCP client (such as Claude Desktop), then analyze your codebase to create an index, and finally, you can use natural language queries to search for code. The entire process is completely local, protecting the privacy of your code.

Use Cases

Code Sage is particularly suitable for the following scenarios: 1. Quickly locate function implementations in a new codebase 2. Find specific business logic or algorithms 3. Understand complex code architectures 4. Quickly find relevant code during code reviews 5. Explore the code structure when learning open - source projects

Main Features

Hybrid Search Technology
Combines keyword search (BM25) and semantic search (vector embedding), and re - ranks the results through the RRF algorithm to provide the most relevant results. It retains the precision of traditional search and has AI understanding capabilities.
Intelligent Code Chunking
Uses AST (Abstract Syntax Tree) technology to intelligently split code by semantic units (functions, classes, methods) instead of simple character chunking. It supports over 60 programming languages, including mainstream languages such as Python, JavaScript, Java, Rust, etc.
Multi - Model Support
Supports multiple embedding model providers: OpenAI cloud service, LM Studio local model, and Ollama local deployment. It is recommended to use LM Studio for better stability and local privacy protection.
Intelligent File Filtering
Automatically identifies and respects the.gitignore file, avoiding the analysis of temporary files, build artifacts, etc. It also supports custom extensions and ignore patterns, flexibly adapting to various project structures.
Zero External Dependencies
All data is stored locally, eliminating the need to connect to an external database server. It uses an embedded storage engine to ensure data security and fast access.
MCP Protocol Compatibility
Fully compatible with the Model Context Protocol, it can be seamlessly integrated with MCP - supported clients such as Claude Desktop and Cursor, providing a unified AI assistant experience.
Advantages
๐Ÿ” Semantic Understanding: Truly understand the meaning of code, not just keyword matching
โšก High Performance: Written in Rust, with fast processing speed and high memory efficiency
๐Ÿ”’ Privacy Protection: All data is stored locally, and code is not uploaded to the cloud
๐Ÿ”„ Offline Availability: Can work completely offline when using local models
๐Ÿ“š Multi - Language Support: Over 60 programming languages and configuration file formats
๐ŸŽฏ Precise Search: Hybrid search technology provides the most relevant results
Limitations
๐Ÿ“ File Size Limit: A single file cannot exceed 1MB
๐Ÿ”ง Configuration Required: The MCP client needs to be set up for the first use
๐Ÿ’พ Storage Space: Indexing will occupy a certain amount of disk space
๐Ÿ”„ Model Switching: Re - indexing is required when changing the embedding model
๐Ÿ“ฑ Platform Limitation: Ollama may be unstable on macOS M1
โฑ๏ธ First - Time Indexing: Analyzing a large codebase for the first time takes time

How to Use

Installation and Building
Build Code Sage from the source code. You need to install Rust version 1.70 or higher.
Configure the MCP Client
Add the Code Sage server configuration to your MCP client (such as Claude Desktop). It is recommended to use LM Studio as the embedding model provider.
Set Up the Embedding Model
Download and start LM Studio, load the nomic - embed - text model, and start the local server.
Analyze the Codebase
Use the analyze_code tool to create a code index. The first analysis may take some time, depending on the size of the codebase.
Search for Code
Use the find_code tool to search for code through natural language queries.

Usage Examples

Search for Authentication - Related Code
In a large - scale web application, you need to find all code related to user authentication, including login, registration, and permission checks.
Search for Specific API Endpoints
You know there is a callback API for processing payments in the project, but you are not sure about its specific location and implementation details.
Understand the Database Architecture
Newly joined the project, you need to quickly understand the code structure and data models related to the database.
Code Review Assistance
During code review, you need to find all code related to a specific function to ensure no omissions.

Frequently Asked Questions

Does Code Sage require an internet connection?
Which programming languages are supported?
How to protect the privacy of my code?
How long does it take to analyze a large codebase?
Can multiple codebases be analyzed simultaneously?
What needs to be done after changing the embedding model?
How to add support for new file types?
What is the sorting basis for search results?

Related Resources

GitHub Repository
Source code and latest version of Code Sage
MCP Protocol Documentation
Official specification of the Model Context Protocol
LM Studio Official Website
Local AI model running platform, recommended for Code Sage
Ollama Official Website
Local large - language model running tool
Claude Desktop
AI assistant desktop application supporting the MCP protocol
Architecture Documentation
Detailed architecture design description of Code Sage
Issue Feedback
Submit bug reports and feature requests
Discussion Area
Exchange usage experiences with other users

Installation

Copy the following command to your Client for configuration
{
  "mcpServers": {
    "code-sage": {
      "command": "/path/to/code-sage",
      "env": {
        "EMBEDDING_PROVIDER": "openai",
        "OPENAI_API_KEY": "lm-studio",
        "EMBEDDING_BASE_URL": "http://localhost:1234/v1",
        "EMBEDDING_MODEL": "nomic-embed-text",
        "DATA_DIR": "./data"
      }
    }
  }
}

{
  "mcpServers": {
    "code-sage": {
      "command": "/path/to/code-sage",
      "env": {
        "EMBEDDING_PROVIDER": "openai",
        "OPENAI_API_KEY": "sk-your-key-here",
        "EMBEDDING_MODEL": "text-embedding-3-small",
        "DATA_DIR": "./data"
      }
    }
  }
}

{
  "mcpServers": {
    "code-sage": {
      "command": "/path/to/code-sage",
      "env": {
        "EMBEDDING_PROVIDER": "ollama",
        "EMBEDDING_BASE_URL": "http://localhost:11434",
        "EMBEDDING_MODEL": "nomic-embed-text",
        "DATA_DIR": "./data"
      }
    }
  }
}

{
  "mcpServers": {
    "code-sage": {
      "command": "/path/to/code-sage",
      "env": {
        "EMBEDDING_PROVIDER": "openai",
        "OPENAI_API_KEY": "sk-your-key-here",
        "EMBEDDING_MODEL": "text-embedding-3-small",
        "DATA_DIR": "./data",
        "DEFAULT_TOP_K": "10",
        "MIN_SCORE": "0.3",
        "RRF_K": "100",
        "CHUNK_SIZE": "2500",
        "CHUNK_OVERLAP": "300",
        "BATCH_SIZE": "100",
        "MAX_CHUNKS": "450000"
      }
    }
  }
}
Note: Your key is sensitive information, do not share it with anyone.

Alternatives

A
Airweave
Airweave is an open - source context retrieval layer for AI agents and RAG systems. It connects and synchronizes data from various applications, tools, and databases, and provides relevant, real - time, multi - source contextual information to AI agents through a unified search interface.
Python
6.1K
5 points
V
Vestige
Vestige is an AI memory engine based on cognitive science. By implementing 29 neuroscience modules such as prediction error gating, FSRS - 6 spaced repetition, and memory dreaming, it provides long - term memory capabilities for AI. It includes a 3D visualization dashboard and 21 MCP tools, runs completely locally, and does not require the cloud.
Rust
5.6K
4.5 points
B
Better Icons
An MCP server and CLI tool that provides search and retrieval of over 200,000 icons, supports more than 150 icon libraries, and helps AI assistants and developers quickly obtain and use icons.
TypeScript
6.7K
4.5 points
A
Assistant Ui
assistant - ui is an open - source TypeScript/React library for quickly building production - grade AI chat interfaces, providing composable UI components, streaming responses, accessibility, etc., and supporting multiple AI backends and models.
TypeScript
6.4K
5 points
A
Apify MCP Server
The Apify MCP Server is a tool based on the Model Context Protocol (MCP) that allows AI assistants to extract data from websites such as social media, search engines, and e-commerce through thousands of ready-to-use crawlers, scrapers, and automation tools (Apify Actors). It supports OAuth and Skyfire proxy payment and can be integrated into MCP clients such as Claude and VS Code through HTTPS endpoints or local stdio.
TypeScript
7.6K
5 points
R
Rsdoctor
Rsdoctor is a build analysis tool specifically designed for the Rspack ecosystem, fully compatible with webpack. It provides visual build analysis, multi - dimensional performance diagnosis, and intelligent optimization suggestions to help developers improve build efficiency and engineering quality.
TypeScript
10.5K
5 points
N
Next Devtools MCP
The Next.js development tools MCP server provides Next.js development tools and utilities for AI programming assistants such as Claude and Cursor, including runtime diagnostics, development automation, and document access functions.
TypeScript
10.8K
5 points
T
Testkube
Testkube is a test orchestration and execution framework for cloud-native applications, providing a unified platform to define, run, and analyze tests. It supports existing testing tools and Kubernetes infrastructure.
Go
7.6K
5 points
N
Notion Api MCP
Certified
A Python-based MCP Server that provides advanced to-do list management and content organization functions through the Notion API, enabling seamless integration between AI models and Notion.
Python
20.4K
4.5 points
G
Gitlab MCP Server
Certified
The GitLab MCP server is a project based on the Model Context Protocol that provides a comprehensive toolset for interacting with GitLab accounts, including code review, merge request management, CI/CD configuration, and other functions.
TypeScript
25.5K
4.3 points
M
Markdownify MCP
Markdownify is a multi-functional file conversion service that supports converting multiple formats such as PDFs, images, audio, and web page content into Markdown format.
TypeScript
35.4K
5 points
D
Duckduckgo MCP Server
Certified
The DuckDuckGo Search MCP Server provides web search and content scraping services for LLMs such as Claude.
Python
72.2K
4.3 points
U
Unity
Certified
UnityMCP is a Unity editor plugin that implements the Model Context Protocol (MCP), providing seamless integration between Unity and AI assistants, including real - time state monitoring, remote command execution, and log functions.
C#
32.2K
5 points
F
Figma Context MCP
Framelink Figma MCP Server is a server that provides access to Figma design data for AI programming tools (such as Cursor). By simplifying the Figma API response, it helps AI more accurately achieve one - click conversion from design to code.
TypeScript
65.5K
4.5 points
C
Context7
Context7 MCP is a service that provides real-time, version-specific documentation and code examples for AI programming assistants. It is directly integrated into prompts through the Model Context Protocol to solve the problem of LLMs using outdated information.
TypeScript
97.1K
4.7 points
G
Gmail MCP Server
A Gmail automatic authentication MCP server designed for Claude Desktop, supporting Gmail management through natural language interaction, including complete functions such as sending emails, label management, and batch operations.
TypeScript
22.1K
4.5 points