code-intel
Provides semantic code search and code insights via a knowledge graph, enabling AI to understand, navigate, and modify complex projects with deep dependency and architecture analysis.
README
Code Intelligence MCP Server 🧠
Give your AI agents a "brain" that actually understands your codebase. This Model Context Protocol (MCP) server provides high-performance semantic search and deep code insights, making it easier for AI tools to navigate, understand, and modify complex projects.
This is not just a search tool; it is an analysis engine. While standard Indexers just treat files as pure text, code-intel parses your codebase into a living knowledge graph. It maps abstract syntax trees (ASTs), dynamic dependencies, and architectural patterns, allowing your AI to enforce strict methodologies, understand blast radiuses, and confidently pair-program on enterprise-grade software.
🚀 Quick Start
1. Prerequisites
Install Ollama and pull the high-precision embedding model:
ollama pull unclemusclez/jina-embeddings-v2-base-code
2. Installation
Choose one of the following methods to set up the project:
Option A: Clone the Repository (Recommended)
Best for active development and staying up to date.
git clone https://github.com/nairraf/code-intel.git
cd code-intel
uv sync
Option B: Download Release (Quick Start)
Best for a one-time setup or if you don't have Git installed.
- Download the latest Source ZIP or Tarball.
- Extract the archive to your desired location.
- Open a terminal in the folder and run:
uv sync
3. MCP Configuration
Add the following to your AI client's MCP settings (e.g., Claude Desktop, Cursor, or Antigravity mcp_config.json). Replace /path/to/code-intel with the absolute path to this project.
{
"mcpServers": {
"code-intel": {
"command": "uv",
"args": ["run", "--quiet", "--directory", "/path/to/code-intel", "python", "-m", "src.server"],
"env": { "PYTHONUNBUFFERED": "1" }
}
}
}
🎯 Unique Advantages for Structured Engineering
While many tools offer basic semantic search, code-intel is purpose-built to enforce strict architectural rules and support advanced software engineering methodologies:
- Project Pulse & Health Metrics: Go beyond simple search. The internal engine actively identifies "Dependency Hubs" and "High-Risk Symbols" (files with high complexity but low test coverage), guiding refactoring efforts and enforcing test-gated workflows.
- Deep Framework Analysis: Standard indexers often fail at mapping dynamic patterns. This server specifically tracks dynamic dependency injection (like Python's
Depends()) and framework-specific middleware, allowing developers to keep business logic pure and fully mockable. - Targeted Re-Indexing: Working in a massive mono-repo? You don't need to re-index the entire universe. Use targeted
include/excludepatterns to update the knowledge graph on-the-fly for only the microservice or module you are actively developing. - Contract-First Validation: By exposing the precise call graph and interface definitions,
code-intelhelps validate that implementations adhere to established API contracts and structural patterns before code is committed.
🏗️ Technical Architecture
Code Intelligence uses a Two-Pass Indexing strategy to map your codebase into a hybrid search system.
graph TD
A[Project Root] --> B[File Scanner]
B -->|Pass 1| C[Tree-sitter Parser]
C --> D[Extraction: Symbols, Types, Defs]
D --> E[Ollama Embeddings]
E --> F[LanceDB Vector Store]
B -->|Pass 2| G[Symbol Linker]
G --> H[Knowledge Graph]
H --> I[Edges: Calls/Imports]
J[AI Client] --> K[MCP Server]
K --> L[Hybrid Query Engine]
L --> F
L --> H
✨ Key Features
Intelligent Caching
Our embedding cache drastically reduces latency. By storing "fingerprints" of your code locally, we avoid re-calculating embeddings for unchanged files, making searches nearly instantaneous.
Semantic "Meaning-Based" Search
Go beyond simple keyword matching. Search for concepts like "how do we handle user authentication?" and find the relevant logic even if the exact words aren't used.
Cross-File Architecture Graph
A persistent knowledge graph tracks imports and function calls across your entire project. This enables precise "Jump to Definition" and "Find References" that work reliably across many files, including advanced structural tracking for Dart widget instantiations and Python dependency injection (Depends()).
Security & Quality Hardened
Independently audited and remediated against OWASP Top 10 vulnerabilities. Includes robust sanitization for vector filters, safe JSON-based serialization, and strict path containment.
🛠️ Tools & Tools Usage
| Tool | Benefit to Cloud AI |
|---|---|
search_code |
Token Saver: Feeds the AI only the specific logic it needs to solve a task. |
get_stats |
Strategic Overview: Identifies "Dependency Hubs" and "High-Risk" areas. |
find_definition |
Precise Navigation: Jumps straight to the source of any symbol. |
find_references |
Impact Analysis: Helps the AI understand side-effects across files. |
refresh_index |
On-Demand Sync: Manually triggers a scan to update the code map. |
💡 Example AI Prompts
Try asking your AI agent:
- "Give me a high-level overview of the dependency hubs in this project and identify any potential technical debt."
- "Find where the
AuthenticationServiceis defined and show me all the places it is referenced." - "How does this project handle error logging across different modules?"
🌐 Supported Languages
While we support 80+ languages via Tree-sitter, we provide optimized resolution for:
- Python (Advanced import resolution, FastAPI/Flask dependency injection)
- Dart / Flutter (Package resolution, Widget structural mapping)
- TypeScript / JavaScript (ESM/CommonJS module resolution)
- Go & Rust
🔧 Troubleshooting
| Issue | Potential Solution |
|---|---|
| "Connection Refused" | Ensure Ollama is running (ollama serve). |
| "Model Not Found" | Run ollama pull for the Jina model. |
| "0 Chunks Indexed" | Ensure project root path is absolute and extensions are supported. |
| Slow Performance | First-time indexing is resource-intensive; subsequent runs use the cache. |
🚀 Recent Updates
- Production Scaling: LanceDB table handle caching and batched SQLite transactions.
- Robust Windows Support: Fixed concurrency race conditions and standardized path normalization.
- Scope Tuning: Added
include/excludeglob patterns for specialized indexing. - Security Hardening: Integrated automated secret scanning (Gitleaks) into CI.
- Professional Standards: Added License, Release Automation, and Community Health files.
🧪 License & Contributing
- License: MIT License
- Contributing: See CONTRIBUTING.md
- Conduct: See CODE_OF_CONDUCT.md
- Security: See SECURITY.md
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。