索引
对项目的依赖关系进行局部语义搜索。独立使用或作为Claude Code的MCP服务器。
入门指南
1.安装
brew install noetic-sys/tap/idx
# or: curl -fsSL https://raw.githubusercontent.com/noetic-sys/index/main/install.sh | sh
# or: cargo install --path .2.设置API密钥
idx默认使用OpenAI嵌入:
idx config set-key sk-your-openai-key3.为你的项目建立索引
在任何有锁文件的项目中:
cd your-project
idx init这读你的 package.json, Cargo.toml, go.mod等,下载每个依赖项的源代码,并在中构建本地索引 .index/.
4.搜索
idx search "parse JSON from string"5.(可选)为克劳德代码设置MCP
这是主要的用例——让Claude搜索你的实际依赖关系,而不是产生幻觉。
claude mcp add --scope user --transport stdio index -- idx mcp或手动添加到 .mcp.json 在您的项目中(或 ~/.claude.json 全球):
{
"mcpServers": {
"index": {
"type": "stdio",
"command": "idx",
"args": ["mcp"]
}
}
}现在,Claude Code可以直接搜索您的索引包。问它“我如何使用serde_json::Value?”,它将从您的实际依赖版本返回真实代码。
命令
| 命令 | 描述 |
|---|---|
idx init | 扫描清单并索引所有依赖项 |
idx update | 用更改的版本重新索引包 |
idx watch | 查看清单并自动重新索引更改 |
| `idx index | |
| ` | 索引特定包(例如。, npm:lodash@4.17.21) |
idx search | 搜索索引包 |
idx list | 列出所有索引包 |
idx stats | 显示索引统计信息 |
idx status | 比较索引与清单依赖关系 |
| `idx remove | |
| ` | 从索引中删除包 |
idx prune | 删除不再在清单中的包 |
idx clean | 删除整个 .index 目录 |
idx mcp | 以MCP服务器运行 |
idx config | 管理配置 |
支持的生态系统
| 注册表 | 清单 |
|---|---|
| npm | package.json / package-lock.json |
| 板条箱 | Cargo.toml / Cargo.lock |
| pypi | pyproject.toml |
| maven | pom.xml |
| 走吧 | go.mod |
配置
Config住在 ~/.config/idx/config.toml.
idx config set-key # Set API key
idx config set-url # Set API base URL (for OpenRouter, etc.)
idx config set-model # Set embedding model
idx config show # View current config使用OpenRouter
idx config set-url https://openrouter.ai/api
idx config set-key sk-or-your-key
idx config set-model openai/text-embedding-3-small许可证
AGPL-3.0或更高版本
