mcpField
A
Aikd Indexed Semantic & Bm25 Code Search For Ai Agents. Give Your Ai Instant Memory Of Your Codebase. Rust | Mcp Server.

Aikd Indexed Semantic & Bm25 Code Search For Ai Agents. Give Your Ai Instant Memory Of Your Codebase. Rust | Mcp Server.

本地服务
github.com/gelutjari记忆与知识219 周前更新

关于 Aikd Indexed Semantic & Bm25 Code Search For Ai Agents. Give Your Ai Instant Memory Of Your Codebase. Rust | Mcp Server.

AIKD 是面向 AI 编码 Agent 的本地代码库索引与搜索服务。它以 Rust 实现,结合 BM25 和向量搜索,并提供命令行、REST API 与持久会话记忆。

主要功能

  1. 01BM25 与向量混合搜索
  2. 02增量索引代码库
  3. 03持久化会话记忆
  4. 04文件变更时重新索引
  5. 05命令行与 REST API

适用场景

  1. 01按关键词或语义查找代码
  2. 02为编码 Agent 提供持久代码库上下文
  3. 03项目文件变更时更新索引

MCP 相关

AIKD 可作为 MCP 服务运行,提供扫描、查询、嵌入、统计、记忆和状态工具。它可向文档列出的编码 Agent 自动注册。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

暂未收录安装方式

我们还没有获取到这个服务的安装包或远程地址,请按项目 README 中的说明安装。

代码仓库

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

🧠 AIKD

面向 AI 编码 Agent 的超快本地记忆层

Crates.io GitHub Release Build Status License: MIT Rust Downloads

让 Claude、Cursor 和 Cline 即刻记住整个代码库。 使用 Rust 编写。零云端依赖。0.21ms 内搜索 10,000 个片段。

安装 • 快速开始 • 演示 • 文档


🤔 为什么选择 AIKD?

问题: AI 编码 Agent 功能强大,却容易遗忘。每次新对话都从零开始——不记得你的代码库、编码模式和架构。

痛点不使用 AIKD使用 AIKD
😵 上下文遗忘Agent 每次会话都问“这个文件是做什么的?”即刻回忆整个代码库
🐌 搜索缓慢基于 Python 的 RAG 每次查询耗时 500ms 以上由 Rust 驱动的 BM25+Vector,仅需 0.21ms
☁️ 云端依赖代码发送到外部服务100% 本地运行,数据不会离开你的设备
🔧 设置复杂安装 Python、pip、CUDA、模型……单个二进制文件,一条命令即可安装
AIKD 对比
功能grepLlamaIndexai-devkitAIKD
速度快慢中等⚡ 0.21ms
语义搜索❌✅✅✅ 混合搜索
仅本地运行✅❌❌✅ 100%
原生支持 MCP❌❌❌✅ 内置
内存用量低高(Python)高📊 27% RAM
设置时间0s约 10min约 5min⏱️ 30s

✨ 主要功能

🔍 搜索引擎
  • 混合搜索:BM25(Tantivy)+ 向量搜索(ONNX all-MiniLM-L6-v2,384d)
  • 互惠排序融合:智能组合关键词与语义搜索结果
  • 增量索引:使用 Blake3 哈希,实现扫描零冗余
  • 资源自适应:自动检测 CPU/GPU 并调整批次大小
🤖 AI 集成
  • MCP 协议:原生支持 Model Context Protocol
  • 7 种内置工具:scan、query、embed、stats、remember、recall、status
  • 自动注册:适用于 Claude Code、Cursor、Cline、Continue、Windsurf、MiMoCode
  • 会话记忆:跨会话持久保存对话上下文
🛠️ 开发者体验
  • 单个二进制文件:无需 Python、Node 或其他依赖
  • 文件监视器:文件更改时自动重新索引
  • REST API:在端口 9090 上提供 HTTP 端点,支持自定义集成
  • CLI 优先:通过终端全面掌控

🎬 实际演示

AIKD 演示

$ aikd init
✅ AIKD initialized for project

$ aikd scan
📊 Indexed 847 files, 12,453 chunks in 1.2s

$ aikd query "authentication flow"
1. src/auth/login.rs (Lines 45-89, Score: 0.923)
   Implements JWT-based authentication with refresh tokens...

2. src/middleware/auth.rs (Lines 12-34, Score: 0.871)
   Validates Bearer tokens on protected routes...

3. docs/architecture/auth.md (Lines 1-25, Score: 0.845)
   Authentication flow diagram and security considerations...

📦 安装

推荐方式(一行命令)

Linux / macOS:

curl -sSf https://raw.githubusercontent.com/gelutjari/aikd/main/install.sh | bash

Windows(PowerShell):

irm https://raw.githubusercontent.com/gelutjari/aikd/main/install.ps1 | iex
其他方式
📦 从 crates.io 安装(需要 Rust)
cargo install aikd
🍺 Homebrew(macOS/Linux)
brew install gelutjari/tap/aikd
🔧 从源代码构建
git clone https://github.com/gelutjari/aikd.git
cd aikd
cargo build --release
cp target/release/aikd ~/.local/bin/
🐳 Docker
docker run -v $(pwd):/workspace -p 9090:9090 ghcr.io/gelutjari/aikd:latest

⚡ 快速开始(3 分钟)

步骤 1:初始化
cd your-project
aikd init
aikd init 会做什么?

根据你的项目类型(Rust、Node、Python、Go),使用智能默认值创建 ~/.aikd/config.yaml。它会检测 .git、Cargo.toml、package.json 等文件,并设置适当的文件筛选规则。

### 步骤 2:扫描代码库 ```bash aikd scan ```
扫描期间会发生什么?
  1. 遍历目录树(跳过 node_modules、.git、target 等)
  2. 按语义边界(函数、标题)对文件分块
  3. 生成 BM25 索引(Tantivy)和向量嵌入(ONNX)
  4. 将所有内容存储在本地 SQLite 数据库中
步骤 3:搜索
# Keyword search (fast)
aikd query "error handling"

# Semantic search (smart)
aikd query "how does login work" --hybrid

# Get JSON output for scripting
aikd query "database connection" --json
步骤 4:连接到你的 AI Agent
Claude Code / Cursor / Cline

AIKD 会通过 MCP 自动注册。运行 aikd scan 后,只需重启 AI Agent。

MCP 配置位于 ~/.aikd/mcp.json:

{
  "mcpServers": {
    "aikd": {
      "command": "aikd",
      "args": ["serve"]
    }
  }
}
REST API
# Start the daemon
aikd daemon

# Query via HTTP
curl "http://localhost:9090/api/query?q=authentication&limit=5"

🎛️ 使用模式

                    ┌─────────────────┐
                    │   How to use    │
                    │     AIKD?       │
                    └────────┬────────┘
                             │
            ┌────────────────┼────────────────┐
            ▼                ▼                ▼
     ┌──────────┐     ┌──────────┐     ┌──────────┐
     │   CLI    │     │   MCP    │     │ REST API │
     │  Mode    │     │  Server  │     │  Daemon  │
     └──────────┘     └──────────┘     └──────────┘
     Best for:        Best for:        Best for:
     • Quick search   • AI agents      • Web apps
     • Scripts        • Claude Code    • Custom UIs
     • CI/CD          • Cursor         • Team shared

CLI 模式(默认):

aikd query "rust error handling" --limit 5
aikd stats
aikd status

MCP 服务(适用于 AI Agent):

aikd serve  # Starts stdio MCP server

REST 守护进程(后台服务):

aikd daemon              # Start in background
aikd daemon foreground   # Start in foreground
aikd daemon-stop         # Stop daemon

📊 基准测试结果

AIKD 基准测试

硬件: AMD EPYC 7B13、7.8GB RAM、NVMe SSD

操作时间吞吐量
索引 1,000 个文件144ms6,934 个文件/秒
BM25 搜索0.21ms4,762 次查询/秒
混合搜索0.35ms2,857 次查询/秒
并发(500)28ms17,669 次查询/秒
嵌入(批处理)12ms/批约 800 个分块/秒

资源使用情况:

CPU: ████████░░░░░░░░░░░░ 22.9%
RAM: █████░░░░░░░░░░░░░░░ 27.4%

💡 实际情况: 人眨一次眼约需 300ms。在这段时间里,AIKD 可以在整个代码库中完成 857 次混合搜索。


⚙️ 配置

默认配置(~/.aikd/config.yaml):

version: 2.0.0
scan:
  include_paths: ["."]
  exclude_paths: ["node_modules", ".git", "target"]
  include_extensions: ["rs", "ts", "py", "md", "json"]
  follow_symlinks: false
chunk:
  max_tokens: 1000
  min_tokens: 100
embedding:
  enabled: true
  model: all-MiniLM-L6-v2
  batch_size: auto
server:
  rest_port: 9090
  auth_token: null
  cors_origins: ["*"]
🐌 低配机器(4GB RAM,2 核)
embedding:
  enabled: true
  batch_size: 8
  device: cpu
resource:
  mode: Low
💪 高配机器(32GB RAM,16 核,GPU)
embedding:
  enabled: true
  batch_size: 64
  device: gpu
resource:
  mode: Max
📝 仅包含文档的项目
scan:
  include_extensions: ["md", "txt", "rst"]
  exclude_paths: [".git"]
filter:
  max_file_size: 524288  # 512KB
👥 团队共享
server:
  rest_port: 9090
  auth_token: "your-secret-token"
  cors_origins:
    - "https://your-team-app.com"

🏗️ 架构

AIKD 架构

┌─────────────────────────────────────────────────────────────┐
│                        AIKD v2.0.0                          │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌─────────┐  ┌─────────┐  ┌─────────┐  ┌─────────────┐  │
│  │  CLI    │  │  MCP    │  │  REST   │  │ File Watcher│  │
│  │ (clap)  │  │ (rmcp)  │  │ (axum)  │  │  (notify)   │  │
│  └────┬────┘  └────┬────┘  └────┬────┘  └──────┬──────┘  │
│       │            │            │               │          │
│       └────────────┴────────────┴───────────────┘          │
│                            │                                │
│  ┌─────────────────────────┴──────────────────────────┐    │
│  │                   Core Engine                       │    │
│  ├─────────────┬─────────────┬─────────────────────────┤    │
│  │  Scanner    │   Chunker   │      Session Manager    │    │
│  │ (walkdir)   │(pulldown-   │    (conversation DB)    │    │
│  │             │  cmark)     │                         │    │
│  └──────┬──────┴──────┬──────┴─────────────────────────┘    │
│         │             │                                      │
│  ┌──────┴──────┐ ┌────┴─────┐ ┌──────────────────────┐     │
│  │  Indexer    │ │ Embedder │ │     Storage           │     │
│  │  (Tantivy)  │ │ (ONNX)   │ │   (SQLite + WAL)     │     │
│  │  BM25 +     │ │ 384d     │ │   + r2d2 pool        │     │
│  │  HNSW ANN   │ │ MiniLM   │ │   + blake3 hashing   │     │
│  └─────────────┘ └──────────┘ └──────────────────────┘     │
│                                                             │
└─────────────────────────────────────────────────────────────┘

详细说明请参阅 docs/ARCHITECTURE.md。


🆘 故障排除

诊断命令:

aikd status --json     # System info
aikd stats             # Index statistics
aikd daemon-pid        # Check if daemon running
“未找到结果”
  1. 先运行 aikd scan
  2. 检查 aikd stats,确认已索引的文件
  3. 尝试更宽泛的搜索词
  4. 检查配置中的 include_extensions
“模型未下载”
aikd model download

这会将约 90MB 的 ONNX 模型下载到 ~/.local/share/aikd/model/。

“端口 9090 已被占用”
# Change port in config
# ~/.aikd/config.yaml
server:
  rest_port: 9091

或者停止现有进程:aikd daemon-stop

内存使用量过高

将资源模式设为 Low:

resource:
  mode: Low
  max_memory_mb: 512
MCP 无法连接到 Claude/Cursor
  1. 检查 ~/.aikd/mcp.json 是否存在
  2. 重启 AI Agent
  3. 验证 aikd serve 是否正常运行:echo '{"jsonrpc":"2.0","method":"initialize","id":1}' | aikd serve
Windows:“找不到 vcruntime140.dll”

安装 Visual C++ Redistributable。


🤝 社区

获取帮助:

贡献者:

贡献贡献者
🏗️ 架构与核心@gelutjari
🔒 安全审计AI 辅助(MiMo)
⚡ 性能优化社区
📖 文档社区

有关如何参与贡献,请参阅 CONTRIBUTING.md。


📄 许可证

MIT 许可证 — 详情请参阅 LICENSE。


⭐ 如果 AIKD 能帮助你的 AI Agent记住信息,请为此仓库点星!

Star History Chart

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。