setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSetup Repo-Native Alignment MCP
安装配置Repo-Native Alignment (RNA) MCP
Install the RNA MCP server for aim-conditioned code intelligence.
Execute these steps in order. Do not stop between steps or ask for confirmation -- run the full sequence automatically.
安装用于目标导向型代码智能的RNA MCP服务器。
请按顺序执行以下步骤。步骤间不要停止或请求确认——自动运行完整流程。
Step 1: Check if already installed
步骤1:检查是否已安装
bash
which repo-native-alignment 2>/dev/nullIf found, skip to Step 3. If not found, proceed to Step 2.
bash
which repo-native-alignment 2>/dev/null如果已找到,跳至步骤3。如果未找到,继续步骤2。
Step 2: Download the binary
步骤2:下载二进制文件
Detect the platform and chip, then download to (already on PATH for Rust users):
~/.cargo/bin/bash
OS=$(uname -s)
ARCH=$(uname -m)
CHIP=$(sysctl -n machdep.cpu.brand_string 2>/dev/null || echo "")
mkdir -p ~/.cargo/binIf macOS ARM M2+ ( + + brand_string contains "M2", "M3", or "M4"):
Darwinarm64bash
curl -L https://github.com/open-horizon-labs/repo-native-alignment/releases/latest/download/repo-native-alignment-darwin-arm64-fast.tar.gz | tar xz -C ~/.cargo/binIf macOS ARM (M1) ( + ):
Darwinarm64bash
curl -L https://github.com/open-horizon-labs/repo-native-alignment/releases/latest/download/repo-native-alignment-darwin-arm64.tar.gz | tar xz -C ~/.cargo/binIf Linux x86_64 ( + ):
Linuxx86_64bash
curl -L https://github.com/open-horizon-labs/repo-native-alignment/releases/latest/download/repo-native-alignment-linux-x86_64.tar.gz | tar xz -C ~/.cargo/binIf none of the above match: Tell the user their platform is not yet supported. They can build from source:
bash
cargo install --locked --git https://github.com/open-horizon-labs/repo-native-alignmentIf is not on PATH (no Rust toolchain installed), tell the user to add it:
~/.cargo/binexport PATH="$HOME/.cargo/bin:$PATH"检测平台和芯片,然后下载至(Rust用户的该路径已在PATH中):
~/.cargo/bin/bash
OS=$(uname -s)
ARCH=$(uname -m)
CHIP=$(sysctl -n machdep.cpu.brand_string 2>/dev/null || echo "")
mkdir -p ~/.cargo/bin如果是macOS ARM M2+( + + 品牌字符串包含"M2"、"M3"或"M4"):
Darwinarm64bash
curl -L https://github.com/open-horizon-labs/repo-native-alignment/releases/latest/download/repo-native-alignment-darwin-arm64-fast.tar.gz | tar xz -C ~/.cargo/bin如果是macOS ARM (M1)( + ):
Darwinarm64bash
curl -L https://github.com/open-horizon-labs/repo-native-alignment/releases/latest/download/repo-native-alignment-darwin-arm64.tar.gz | tar xz -C ~/.cargo/bin如果是Linux x86_64( + ):
Linuxx86_64bash
curl -L https://github.com/open-horizon-labs/repo-native-alignment/releases/latest/download/repo-native-alignment-linux-x86_64.tar.gz | tar xz -C ~/.cargo/bin如果以上都不匹配:告知用户其平台暂不支持。他们可以从源码构建:
bash
cargo install --locked --git https://github.com/open-horizon-labs/repo-native-alignment如果不在PATH中(未安装Rust工具链),告知用户添加该路径:
~/.cargo/binexport PATH="$HOME/.cargo/bin:$PATH"Step 3: Configure the MCP server
步骤3:配置MCP服务器
RNA is a per-project MCP server (it indexes the repo it's pointed at).
Check if exists in the project root and already contains an entry. If it does, skip this step.
.mcp.jsonrna-mcpIf the agent supports (Claude Code):
claude mcp addbash
claude mcp add rna-mcp --scope project -- repo-native-alignment --repo .Otherwise, create or update in the project root with:
.mcp.jsonjson
{
"mcpServers": {
"rna-mcp": {
"command": "repo-native-alignment",
"args": ["--repo", "."]
}
}
}If already exists with other servers, merge the entry into the existing object -- do not overwrite the file.
.mcp.jsonrna-mcpmcpServersRNA是一个基于项目的MCP服务器(它会为指向的代码仓库建立索引)。
检查项目根目录下是否存在且已包含条目。如果存在,跳过此步骤。
.mcp.jsonrna-mcp如果Agent支持(Claude Code):
claude mcp addbash
claude mcp add rna-mcp --scope project -- repo-native-alignment --repo .否则,在项目根目录下创建或更新,内容如下:
.mcp.jsonjson
{
"mcpServers": {
"rna-mcp": {
"command": "repo-native-alignment",
"args": ["--repo", "."]
}
}
}如果已存在且包含其他服务器条目,请将条目合并到现有的对象中——不要覆盖整个文件。
.mcp.jsonrna-mcpmcpServersStep 4: Pre-warm the code index
步骤4:预加载代码索引
Run a full scan to build the code index before the MCP server starts. This avoids cold-start latency on the first tool call:
bash
repo-native-alignment scan --repo . --fullThis builds the full pipeline (scan, extract, embed, LSP enrich, graph) and caches results in . The MCP server reuses this cache on startup -- if no files changed, graph loads in seconds with zero re-extraction. Subsequent scans are incremental.
.oh/.cache/lance/Without this step, the MCP server pre-warms the graph automatically at startup, but the first tool call may need to wait for that to complete. Pre-building ensures instant readiness.
在MCP服务器启动前运行完整扫描以构建代码索引。这样可以避免首次工具调用时的冷启动延迟:
bash
repo-native-alignment scan --repo . --full此命令会构建完整流程(扫描、提取、嵌入、LSP增强、图谱)并将结果缓存到中。MCP服务器启动时会复用该缓存——如果文件未发生变化,图谱可在数秒内加载完成,无需重新提取。后续扫描为增量式。
.oh/.cache/lance/如果跳过此步骤,MCP服务器会在启动时自动预加载图谱,但首次工具调用可能需要等待该过程完成。提前构建可确保立即就绪。
Step 5: Update AGENTS.md with tool guidance
步骤5:更新AGENTS.md添加工具使用指南
If AGENTS.md exists in the project root, check if it already contains . If it already has this marker, skip this step.
<!-- RNA MCP tool guidance -->If AGENTS.md exists but lacks the marker, append this block:
markdown
<!-- RNA MCP tool guidance -->如果项目根目录下存在AGENTS.md,检查其是否已包含标记。如果已包含,跳过此步骤。
<!-- RNA MCP tool guidance -->如果AGENTS.md存在但缺少该标记,追加以下内容块:
markdown
<!-- RNA MCP tool guidance -->Code Exploration (use RNA MCP tools, not grep/Read)
代码探索(使用RNA MCP工具,而非grep/Read)
| Instead of... | Use this MCP tool |
|---|---|
| |
| |
| |
| |
| |
| Recording learnings/signals | Write to |
| Searching git history | |
If AGENTS.md does not exist, create it with the tool guidance block as the initial content.| 替代... | 使用此MCP工具 |
|---|---|
| |
| |
| |
| |
| |
| 记录学习成果/信号 | 写入 |
| 搜索Git历史 | |
如果AGENTS.md不存在,创建该文件并将上述工具指南块作为初始内容。Step 6: Inform the user
步骤6:告知用户
Tell the user:
- Setup is complete
- They may need to restart their agent/IDE for the MCP server to load
- After restart, RNA MCP tools will be available:
- - Business context in one call
oh_get_context - - Semantic search over outcomes, code, commits
oh_search_context - - Multi-language symbol search with graph edges
search_symbols - - Impact analysis, neighbor traversal, reachability
graph_query - - Structural outcome-to-code joins
outcome_progress - - Workspace root management
list_roots
告知用户:
- 安装配置已完成
- 他们可能需要重启Agent/IDE以加载MCP服务器
- 重启后,RNA MCP工具将可用:
- - 一键获取业务上下文
oh_get_context - - 对产出物、代码、提交记录进行语义搜索
oh_search_context - - 带图谱关联的多语言符号搜索
search_symbols - - 影响分析、关联节点遍历、可达性分析
graph_query - - 结构化产出物与代码关联
outcome_progress - - 工作区根目录管理
list_roots