代码语义搜索引擎

CCE(Code Context Engine)是一个提供语义代码搜索和自动增量索引功能的MCP服务器,适用于开发者在大型代码库中快速定位相关代码。

  • by aidesuwa
  • Go
  • 本地部署
  • 更新于
在 GitHub 查看 aidesuwa/cce

使用说明

CCE(代码上下文引擎)

MCP服务器提供语义代码搜索和自动增量索引,由 增强代码的上下文引擎。

特性

  • 语义代码搜索:使用自然语言查询查找相关代码
  • 增量索引:自动检测并仅索引已更改的文件
  • 文件监视:实时监控文件更改
  • MCP协议支持:适用于任何兼容MCP的客户端(克劳德桌面、克劳德代码等)
  • Web管理UI:配置设置并监视索引状态
  • 交叉平台的:支持Linux、macOS和Windows

安装

下载二进制文件

从下载最新版本 GitHub发布.

从源代码构建

git clone https://github.com/aidesuwa/cce.git
cd cce
make build

要求:

  • 转到1.25+
  • Node.js 20+(用于前端构建)

快速开始

  1. 运行服务器:

    ./cce
    
  2. 打开http://localhost:2300在浏览器中

  3. 配置您的 增强代码 web UI中的API令牌

配置

环境变量

变量 默认值 描述
WEB_PORT 2300 Web服务器端口
DB_PATH ~/.cce/cce.db SQLite数据库路径
DEBUG false 启用调试日志记录

运行时设置

所有其他设置都可以通过web界面进行配置:

  • API令牌和终结点
  • 索引的批量大小
  • 索引的文件扩展名
  • 排除模式

MCP集成

克劳德代码

添加到MCP设置中:

{
  "mcpServers": {
    "cce": {
      "url": "http://localhost:2300/mcp"
    }
  }
}

可用工具

  • 搜索文本:搜索相关代码上下文
    • project_root_path:项目的绝对路径(使用正斜杠 / 即使在Windows上)
    • query:带有可选关键字的自然语言搜索查询

查询示例:

Find where the server handles user authentication. Keywords: auth, login, session

发展

make build        # Build binary with frontend
make build-go     # Build Go binary only
make dev          # Run with hot reload
make lint         # Run linter
make test         # Run tests
make fmt          # Format code

建筑

cmd/server/       → Entry point
internal/
  aug/            → Augment API client
  config/         → Configuration management
  constants/      → Centralized constants
  ent/            → Database ORM (Ent)
  indexer/        → Incremental indexing engine
  mcp/            → MCP server implementation
  store/          → SQLite storage
  web/            → Web server & embedded UI
web/              → Frontend (React + Vite + Tailwind)

许可证

MIT许可证-请参阅 许可证 了解详情。

贡献

欢迎投稿!请查看 贡献.md 作为指导方针。

致谢