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.8K

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

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
8.7K
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
8.2K
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
5.1K
5 points
M
MCP Windbg
An MCP server that integrates AI models with WinDbg/CDB for analyzing Windows crash dump files and remote debugging, supporting natural language interaction to execute debugging commands.
Python
9.5K
5 points
R
Runno
Runno is a collection of JavaScript toolkits for securely running code in multiple programming languages in environments such as browsers and Node.js. It achieves sandboxed execution through WebAssembly and WASI, supports languages such as Python, Ruby, JavaScript, SQLite, C/C++, and provides integration methods such as web components and MCP servers.
TypeScript
7.4K
5 points
N
Netdata
Netdata is an open-source real-time infrastructure monitoring platform that provides second-level metric collection, visualization, machine learning-driven anomaly detection, and automated alerts. It can achieve full-stack monitoring without complex configuration.
Go
8.6K
5 points
M
MCP Server
The Mapbox MCP Server is a model context protocol server implemented in Node.js, providing AI applications with access to Mapbox geospatial APIs, including functions such as geocoding, point - of - interest search, route planning, isochrone analysis, and static map generation.
TypeScript
6.7K
4 points
U
Uniprof
Uniprof is a tool that simplifies CPU performance analysis. It supports multiple programming languages and runtimes, does not require code modification or additional dependencies, and can perform one-click performance profiling and hotspot analysis through Docker containers or the host mode.
TypeScript
7.2K
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
31.0K
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
18.9K
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
21.6K
4.3 points
D
Duckduckgo MCP Server
Certified
The DuckDuckGo Search MCP Server provides web search and content scraping services for LLMs such as Claude.
Python
61.9K
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#
26.8K
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
57.3K
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.8K
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
41.1K
4.8 points