🚀 MCP代码智能
停止浪费代币。开始更智能地编码。
标准的人工智能助手是“代币饥饿”的。当你问一个简单的问题时,他们通常会为了找到一个引用而摄入数千行不相关的代码,导致大量代币浪费、API成本高和响应慢。
mcp代码智能 通过将重物移至本地机器来解决此问题:
- 精确上下文: 使用Local Jina v3,我们只确定所需的确切代码片段。不再将整个文件发送到云端。
- 零废物分析: 我们的系统过滤掉了“噪音”,将提示大小减少了80%。
- 成本杀手: 通过为LLM提供外科手术般的精确度而不是“蛮力”的上下文,您可以在获得更快、更准确的答案的同时节省每一个查询的费用。
______________________________________________________________________
💎 为什么选择MCP代码智能而不是标准AI聊天?
🔍 search_codeFast semantic code search using local Jina V3 vector engine. No token limits, instant results, context-aware (unlike standard AI chat's slow, token-limited grep). 🧩 search_similarDetects duplicate or similar logic across your codebase, saving time and reducing technical debt. 💬 search_contextFinds code by natural language description, leveraging project embeddings for precise results. 📊 get_project_statusInstantly shows indexing, language, and health status—no manual inspection needed. ⚡ index_projectLocal, parallel indexing for large codebases. Much faster than cloud-based AI parsing. 🧠 analyze_project / analyze_fileDeep analysis (complexity, health, code smells) with no token or context window limits. Results are project-wide and actionable. 🚨 find_smellsPinpoints anti-patterns and code smells, improving code quality and maintainability. 🔥 get_complexity_hotspotsHighlights the most complex files/functions for targeted refactoring. 🔗 check_circular_dependenciesDetects hidden import cycles instantly—no need for manual graph analysis. 🔎 find_symbol / get_relationshipsSymbol search and call graph mapping with full project context, not just open files. 📝 interpret_analysisSummarizes analysis for human or AI consumption, enabling smarter decisions. 🧬 find_duplicatesLocates duplicate code blocks, reducing redundancy and improving maintainability. 🔕 silence_health_issueSuppresses noisy warnings, keeping your workflow focused. 🛑 propose_logicPrevents logic duplication before you code, saving tokens and review time. 📈 analyze_impactPredicts the effect of changes before you refactor, avoiding costly mistakes. 🛡️ Guardian (health/logic checks)Real-time health and duplication guard, ensuring codebase integrity. 📄 read_fileRead full contents of a specific file (use as last resort when LSP tools don't suffice). ✍️ write_fileWrite content to a file, creating parent directories if needed (use with caution). 📂 list_directoryList contents of a directory to explore repository layout and discover files. 📋 list_filesAlias for list_directory - browse project structure efficiently. 🔧 debug_pingDiagnostic tool to verify MCP server connection and version information. 🎯 goto_definition / find_referencesHigh-precision LSP-powered navigation for exact symbol definitions and usage locations.
令牌和速度优势:
- 所有工具都在本地运行,因此没有令牌限制或API速率限制。
- 结果是即时的,即使对于大型项目也是如此(这要归功于向量搜索和并行分析)。
- 没有云延迟——您的数据保持私密和快速。
质量和环境优势:
- 工具使用项目的完整图形和嵌入,而不仅仅是文件片段。
- 结果总是相关的、可操作的,并且是针对您的代码库量身定制的。
______________________________________________________________________
✨ 尖端功能
- 🌍 多语言智能(LSP集成):
- python 通过以下方式实现全类型智能 python-lsp-server. - JS/TS: 通过智能导航 typescript-language-server. - 飞镖/颤振: 移动开发优化了智能。 - Rust/Go/C++: 完全支持的高性能LSP。
- ⚡ 智能优先级索引: 大型项目?没问题系统为您的 Git更改, 入口点,以及 自述文件 在前60秒内,您可以开始工作,而其余的工作则在后台完成。
- 🏠 100%本地情报: 所有向量操作和嵌入都保留在您的机器上。任何代码都不会离开你的项目。
- 🛡️ 项目健康守护者(智能通知): 该系统持续监控您的项目是否存在技术债务。当完全重复或占位符为空时,它会在您的AI聊天中注入非侵入性警告(
pass/...)被检测到,帮助您实时维护干净的代码库。 - 🕵️ 三级重复检测: 超越简单的文本匹配:
- 第三级(精确): 用于复制粘贴检测的MD5/SHA256哈希匹配。 - 2级(结构): 基于AST的骨架分析(不同名称,相同算法)。 - 级别1(语义): Jina v3 AI分析,找出执行相同任务的不同代码。
______________________________________________________________________
🚀 快速启动(一个命令设置)
在一分钟内启动并运行任何项目:
# 1. (Recommended) Create and activate a clean environment
# Windows:
python -m venv venv
.\venv\Scripts\activate
# Mac/Linux:
# python3 -m venv venv
# source venv/bin/activate
# 2. Clone the repository to your local machine
git clone https://github.com/mahkande/mcp-code-intelligence.git
cd mcp-code-intelligence
# 3. Install the package (This makes the 'mcp-code-intelligence' command available everywhere)
pip install .
# 4. Initialize & Connect to your AI Editor
# Run this once. It auto-detects your editors and configures them.
mcp-code-intelligence setup智能设置将:
- 检测 您的语言和平台(克劳德桌面、光标等)
- 下载 优化了Jina v3的权重。
- 优先处理 并为你的代码库建立索引。
- 注入 自动配置到您的AI工具中。
______________________________________________________________________
📖 命令参考
🧠 情报与搜索
mcp-code-intelligence setup:推荐的开始方式。自动检测一切并配置您的环境。mcp-code-intelligence search "query":使用自然语言的语义搜索。mcp-code-intelligence chat "question":交互式LLM聊天关于您的代码库(需要OpenRouter API密钥)。mcp-code-intelligence duplicates:运行高精度、3级扫描以查找重复代码块。mcp-code-intelligence analyze:运行复杂性和质量分析(认知/圈复杂度、代码气味)。
📊 状态和可视化
mcp-code-intelligence status:检查索引进度、数据库运行状况和项目统计信息。mcp-code-intelligence visualize serve:在浏览器中启动代码结构的本地3D交互式图形。mcp-code-intelligence doctor:用于检查依赖关系(Python、Node、Git)和路径配置的诊断工具。
🛠️ 维护与高级
mcp-code-intelligence index:手动触发或强制重新索引代码库。mcp-code-intelligence reset:清白。删除现有索引并恢复出厂设置。mcp-code-intelligence config:微调设置,如similarity_threshold或者更改嵌入模型。mcp-code-intelligence silence_health_issue:根据特定健康警告的ID手动将其静音。
🛡️ 管理健康守护者
默认情况下,Guardian系统已启用,以保持代码库的干净。您可以通过CLI进行管理:
- 禁用监护人:
mcp-code-intelligence config set enable_guardian false - 启用监护人:
mcp-code-intelligence config set enable_guardian true - 切换逻辑检查:
mcp-code-intelligence config set enable_logic_check false - 忽略特定代码: 添加
# guardian-ignore作为任何函数或类中的注释,跳过该块的健康检查。
______________________________________________________________________
📺 监控
mcp-code-intelligence onboarding logs: 实时仪表板。 实时监控后台活动、搜索日志和AI工具交互。
______________________________________________________________________
🗑️ 如何移除? (卸载)
如果 MCP Code Intelligence 集成在您的编辑器中出现问题或想要删除它,您可以使用以下命令:
- 自动卸载(最常见的平台):
mcp-code-intelligence uninstall mcp- 从特定编辑器中删除:
mcp-code-intelligence uninstall mcp --platform cursor
mcp-code-intelligence uninstall mcp --platform claude-desktop- 从所有平台进行批量卸载:
mcp-code-intelligence uninstall mcp --all- 列出可用的集成:
mcp-code-intelligence uninstall list建议您在卸载后重新启动编辑器。
______________________________________________________________________
🛠️ 需求
- Python 3.10+
- Git (用于智能优先级排序)
- Node.js (可选,用于JS/TS LSP支持)
- MCP代码智能扩展 (VS Code用户需要)
- VS代码: 此项目包括一个打包的扩展文件夹 mcp-vscode-extension. - 光标: 原生MCP支持。 - 克劳德桌面/代码: 原生MCP支持。
> 注: VS代码需要在中进行正确配置 settings.json (Copilot Chat)或帮助扩展来弥合上下文差距。此存储库为此目的提供了一个辅助扩展。
______________________________________________________________________
由开发人员构建,面向重视上下文窗口(和钱包)的开发人员。 🛡️✨
