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
4.6K

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
Acemcp
Acemcp is an MCP server for codebase indexing and semantic search, supporting automatic incremental indexing, multi-encoding file processing, .gitignore integration, and a Web management interface, helping developers quickly search for and understand code context.
Python
8.4K
5 points
B
Blueprint MCP
Blueprint MCP is a chart generation tool based on the Arcade ecosystem. It uses technologies such as Nano Banana Pro to automatically generate visual charts such as architecture diagrams and flowcharts by analyzing codebases and system architectures, helping developers understand complex systems.
Python
6.5K
4 points
M
MCP Agent Mail
MCP Agent Mail is a mail - based coordination layer designed for AI programming agents, providing identity management, message sending and receiving, file reservation, and search functions, supporting asynchronous collaboration and conflict avoidance among multiple agents.
Python
8.4K
5 points
M
MCP
The Microsoft official MCP server provides search and access functions for the latest Microsoft technical documentation for AI assistants
11.7K
5 points
A
Aderyn
Aderyn is an open - source Solidity smart contract static analysis tool written in Rust, which helps developers and security researchers discover vulnerabilities in Solidity code. It supports Foundry and Hardhat projects, can generate reports in multiple formats, and provides a VSCode extension.
Rust
10.6K
5 points
D
Devtools Debugger MCP
The Node.js Debugger MCP server provides complete debugging capabilities based on the Chrome DevTools protocol, including breakpoint setting, stepping execution, variable inspection, and expression evaluation.
TypeScript
9.9K
4 points
S
Scrapling
Scrapling is an adaptive web scraping library that can automatically learn website changes and re - locate elements. It supports multiple scraping methods and AI integration, providing high - performance parsing and a developer - friendly experience.
Python
11.5K
5 points
M
Mcpjungle
MCPJungle is a self-hosted MCP gateway used to centrally manage and proxy multiple MCP servers, providing a unified tool access interface for AI agents.
Go
0
4.5 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
27.0K
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
18.1K
4.3 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
17.5K
4.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
54.0K
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#
22.7K
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
50.4K
4.5 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
18.1K
4.5 points
M
Minimax MCP Server
The MiniMax Model Context Protocol (MCP) is an official server that supports interaction with powerful text-to-speech, video/image generation APIs, and is suitable for various client tools such as Claude Desktop and Cursor.
Python
34.9K
4.8 points