CIE如何通过MCP工具集为AI代理提供本地化代码智能?
AIAI Summary (BLUF)
CIE是一款本地优先的代码智能引擎,通过MCP工具集对代码库进行索引,实现语义搜索、调用图分析与端点发现,可将AI代理工具调用减少高达90%,同时确保所有数据私有。
超过 20 个 MCPModel Context Protocol - a protocol that enables AI models to access external tools, data sources, and services to enhance their capabilities and context awareness. 工具,为 AI 代理提供语义代码搜索基于代码含义而非关键词匹配的搜索技术,能够理解代码的语义内容,提供更准确的搜索结果。、调用图分析分析代码中函数调用关系的技术,能够追踪执行路径,包括接口分发解析,帮助理解代码执行流程。和端点发现功能 —— 100% 本地运行,数秒内索引 10 万行代码。
20+ MCP tools that give AI agents semantic code search, call graph analysis, and endpoint discovery — 100% local, indexes 100k LOC in seconds.
实践案例:在追踪 MIE 代码库的调用图时,Claude Code 在没有 CIE代码智能引擎,全称Code Intelligence Engine,是一个本地优先的代码分析工具,通过索引代码库提供语义搜索、调用图分析和端点发现功能。 的情况下需要 34 次工具调用。使用 CIE 后,仅需 3 次。具体结果因查询而异,但结构化的代码智能持续减少了代理的往返次数。
In practice: Tracing a call graph through MIE's codebase, Claude Code needed 34 tool calls without CIE. With CIE, it needed 3. Results vary by query, but structured code intelligence consistently reduces agent round-trips.
CIE 能够索引您的代码库,并通过模型上下文协议(Model Context Protocol, MCP)提供语义搜索、调用图分析和 AI 驱动的代码理解能力。
CIE indexes your codebase and provides semantic search, call graph analysis, and AI-powered code understanding through the Model Context Protocol (MCP).
为什么选择 CIE?
Why CIE?
- 语义搜索 - 通过含义而非简单的文本匹配来查找代码 (Semantic Search - Find code by meaning, not just text matching)
安装
Installation
| 方法 | 命令 |
|---|---|
| 安装脚本 | |
| Method | Command |
|---|---|
| Homebrew | brew tap kraklabs/cie && brew install cie |
| Install Script | curl -sSL https://raw.githubusercontent.com/kraklabs/cie/main/install.sh | sh |
| GitHub Releases | Download binary |
功能特性
Features
语义代码搜索
Semantic Code Search
通过含义查找代码,而非关键词:
Find code by meaning, not keywords:
# 提问:"认证中间件在哪里?"
# 通过 MCP 使用 cie_semantic_search 工具
# Ask: "Where is authentication middleware?"
# Use cie_semantic_search tool via MCP
示例输出:
Example output:
[95%] AuthMiddleware (internal/http/auth.go:42)
[76%] ValidateToken (internal/auth/jwt.go:103)
调用图分析
Call Graph Analysis
追踪执行如何到达任何函数:
Trace how execution reaches any function:
# 问题:"main() 如何到达 database.Connect()?"
# 使用 cie_trace_path 工具
# Question: "How does main() reach database.Connect()?"
# Use cie_trace_path tool
示例输出:
Example output:
main → InitApp → SetupDatabase → database.Connect
├─ File: cmd/server/main.go:25
├─ File: internal/app/init.go:42
└─ File: internal/database/setup.go:18
HTTP 端点发现
HTTP Endpoint Discovery
自动列出所有 API 端点:
List all API endpoints automatically:
# 使用 cie_list_endpoints 工具
# Use cie_list_endpoints tool
示例输出:
Example output:
[GET] /api/v1/users → HandleGetUsers
[POST] /api/v1/users → HandleCreateUser
[DELETE] /api/v1/users/:id → HandleDeleteUser
多语言支持
Multi-Language Support
Supports Go, Python, JavaScript, TypeScript, and more through Tree-sitter一个增量解析系统,用于构建代码的抽象语法树,支持多种编程语言。 parsers.
快速开始
Quick Start
1. 安装 CLI
- Install the CLI
Homebrew (macOS/Linux):
brew tap kraklabs/cie
brew install cie
脚本安装:
Script:
curl -sSL https://raw.githubusercontent.com/kraklabs/cie/main/install.sh | sh
手动下载:
Manual download:
Download from GitHub Releases.
2. 索引您的代码库
- Index Your Repository
cd /path/to/your/repo
cie init -y # 初始化项目配置
cie index # 索引代码库(无需 Ollama 也可工作)
cd /path/to/your/repo
cie init -y # Initialize project configuration
cie index # Index the codebase (works without Ollama too)
示例输出:
Example output:
Project: your-repo-name
Files: 1,234
Functions: 5,678
Types: 890
Last indexed: 2 minutes ago
注意: CIE 无需 OllamaA tool for running and managing AI models locally, supporting DeepSeek and other models. 即可工作 —— 您将可以访问包括 grep、调用图、函数查找器等在内的 20 多种工具。语义搜索需要来自 Ollama 或其他提供商的嵌入模型。
Note: CIE works without Ollama -- you'll have access to 20+ tools including grep, call graph, function finder, and more. Semantic search requires embeddings from Ollama or another provider.
管理命令
Management Commands
| 命令 | 描述 |
|---|---|
| 初始化项目配置 | |
| 索引(或重新索引)代码库 | |
| 删除项目的所有索引数据 |
| Command | Description |
|---|---|
cie init -y |
Initialize project configuration |
cie index |
Index (or re-index) the codebase |
cie reset --yes |
Delete all indexed data for the project |
MCP 服务器模式
MCP Server Mode
CIE 可以作为 MCP 服务器运行,以便与 Claude Code 集成:
CIE can run as an MCP server for integration with Claude Code:
cie --mcp
在您的 Claude Code 设置中进行配置:
Configure in your Claude Code settings:
{
"mcpServers": {
"cie": {
"command": "cie",
"args": ["--mcp"]
}
}
}
配置
Configuration
CIE uses a YAML configuration file (/.cie/project.yaml):
version: "1"
project_id: my-project
embedding:
provider: ollama
base_url: http://localhost:11434
model: nomic-embed-text
嵌入模型是可选的。 CIE 无需 Ollama 或任何嵌入模型提供商即可工作。您可以完全访问所有结构化工具(grep、调用图、函数查找器等)。只有语义搜索 (cie_semantic_search) 需要嵌入模型。
Embeddings are optional. CIE works without Ollama or any embedding provider. You get full access to all structural tools (grep, call graph, function finder, etc.). Only semantic search (
cie_semantic_search) requires embeddings.
您也可以为 cie_analyze 的叙述生成配置一个 LLM:
You can also configure an LLM for cie_analyze narrative generation:
# 可选:用于 cie_analyze 叙述生成的 LLM
llm:
enabled: true
base_url: http://localhost:11434 # Ollama
model: llama3
# 对于 OpenAI: base_url: https://api.openai.com/v1, model: gpt-4o-mini
# Optional: LLM for cie_analyze narrative generation
llm:
enabled: true
base_url: http://localhost:11434 # Ollama
model: llama3
# For OpenAI: base_url: https://api.openai.com/v1, model: gpt-4o-mini
注意: llm 部分是可选的。没有它,cie_analyze 将返回原始分析数据。配置后,您将获得综合的叙述性摘要。
Note: The llm section is optional. Without it, cie_analyze returns raw analysis data. With it configured, you get synthesized narrative summaries.
MCP 工具
MCP Tools
当作为 MCP 服务器运行时,CIE 提供超过 20 种按类别组织的工具:
When running as an MCP server, CIE provides 20+ tools organized by category:
导航与搜索
Navigation & Search
| 工具 | 描述 |
|---|---|
cie_grep |
快速字面文本搜索(无正则表达式) |
| 使用嵌入模型的基于含义的搜索 | |
| 按名称查找函数(处理接收器语法) | |
| 查找类型/接口/结构体 | |
| 查找名称相似的函数 | |
| 列出带过滤器的索引文件 | |
| 列出文件中的所有函数 |
| Tool | Description |
|---|---|
cie_grep |
|
调用图分析
Call Graph Analysis
| 工具 | 描述 |
|---|---|
| 查找调用某函数的代码 | |
| 查找某函数调用的代码 | |
| 追踪从入口点到目标的调用路径 | |
| 获取函数的完整调用图 |
| Tool | Description |
|---|---|
代码理解
Code Understanding
| 工具 | 描述 |
|---|---|
| 架构分析(LLM 叙述可选) | |
| 获取函数源代码 | |
| 获取包含主要函数的目录概览 | |
| 查找实现某个接口的类型 | |
| 获取文件中所有实体的摘要 |
| Tool | Description |
|---|---|
cie_get
|
版权与免责声明:本文仅用于信息分享与交流,不构成任何形式的法律、投资、医疗或其他专业建议,也不构成对任何结果的承诺或保证。
文中提及的商标、品牌、Logo、产品名称及相关图片/素材,其权利归各自合法权利人所有。本站内容可能基于公开资料整理,亦可能使用 AI 辅助生成或润色;我们尽力确保准确与合规,但不保证完整性、时效性与适用性,请读者自行甄别并以官方信息为准。
若本文内容或素材涉嫌侵权、隐私不当或存在错误,请相关权利人/当事人联系本站,我们将及时核实并采取删除、修正或下架等处理措施。也请勿在评论或联系信息中提交身份证号、手机号、住址等个人敏感信息。



