Relace MCP Server
非官方 Relace MCP 服务器
非官方 — 个人项目,与 Relace 无关联。
AI 构建 — 完全在 AI 辅助下开发(Antigravity、Codex、Cursor、Github Copilot、Windsurf)。
MCP 服务器,提供 AI 驱动的代码编辑和智能代码库探索工具。
无此工具 | 使用 |
手动 grep,容易遗漏相关文件 | 自然语言提问,获取精确位置 |
编辑导致其他地方导入错误 | 追踪导入和调用链 |
全量重写消耗大量 tokens | 描述变更,无需行号 |
行号错误导致代码损坏 | 10,000+ tokens/秒合并 |
功能特性
快速应用 (Fast Apply) — 通过 Relace API 以 10,000+ tokens/秒的速度应用代码编辑
智能搜索 (Agentic Search) — 基于自然语言查询的智能代码库探索
智能检索 (Agentic Retrieval) — 混合语义提示 + 实时代码探索,支持陈旧提示和显式云端维护(通过
MCP_SEARCH_RETRIEVAL=1启用;使用MCP_RETRIEVAL_BACKEND选择后端)云端搜索 (Cloud Search) — 对云端同步仓库进行语义代码搜索
Related MCP server: GraphHub
快速开始
使用 relace 后端(默认):从 Relace 控制台 获取 API 密钥,然后添加到您的 MCP 客户端:
~/.cursor/mcp.json
{
"mcpServers": {
"relace": {
"command": "uv",
"args": ["tool", "run", "relace-mcp"],
"env": {
"RELACE_API_KEY": "rlc-your-api-key",
"MCP_BASE_DIR": "/absolute/path/to/your/project"
}
}
}
}claude mcp add relace \
--env RELACE_API_KEY=rlc-your-api-key \
--env MCP_BASE_DIR=/absolute/path/to/your/project \
-- uv tool run relace-mcp~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"relace": {
"command": "uv",
"args": ["tool", "run", "relace-mcp"],
"env": {
"RELACE_API_KEY": "rlc-your-api-key",
"MCP_BASE_DIR": "/absolute/path/to/your/project"
}
}
}
}.vscode/mcp.json
{
"mcp": {
"servers": {
"relace": {
"type": "stdio",
"command": "uv",
"args": ["tool", "run", "relace-mcp"],
"env": {
"RELACE_API_KEY": "rlc-your-api-key",
"MCP_BASE_DIR": "${workspaceFolder}"
}
}
}
}
}~/.codex/config.toml
[mcp_servers.relace]
command = "uv"
args = ["tool", "run", "relace-mcp"]
[mcp_servers.relace.env]
RELACE_API_KEY = "rlc-your-api-key"
MCP_BASE_DIR = "/absolute/path/to/your/project"配置
变量 | 必需 | 描述 |
| ✅* | 来自 Relace 控制台 的 API 密钥;Relace 提供商和云端工具必需 |
| ❌ | 设置为 |
| ❌ | 语义检索后端: |
| ❌ | 检索提示策略: |
| ❌ | 本地索引定期刷新监控(可选);需要固定的 |
| ❌ | 本地索引定期监控间隔(秒,默认: |
| ❌ | 首次定期本地索引检查前的初始延迟(秒,默认: |
| ❌ | 轮次状态用户消息策略: |
| ❌ | 在搜索运行期间启用 |
| ❌ | 启用 LSP 辅助搜索: |
| ❌ | 项目根目录覆盖(通过 MCP Roots → Git → 工作区存储 → CWD 自动检测) |
| ❌ | 文件日志记录: |
| ❌ | 用于集中配置的 |
* 如果满足以下两者,则可选:(1) APPLY_PROVIDER 和 SEARCH_PROVIDER 为非 Relace 提供商,且 (2) MCP_RETRIEVAL_BACKEND 为 codanna、chunkhound 或 none。
有关 .env 使用、编码设置、自定义 LLM 提供商等更多信息,请参阅 docs/advanced.md。
工具
始终可用:fast_apply、agentic_search。agentic_retrieval 需要 MCP_SEARCH_RETRIEVAL=1。云端工具仅在 MCP_RETRIEVAL_BACKEND=relace 时可用。index_status 适用于 relace、codanna 和 chunkhound,在 MCP_RETRIEVAL_BACKEND=none 时隐藏。
使用 MCP 原生发现界面:list_tools() 获取工具,list_resources() 获取资源。
有关详细参数,请参阅 docs/tools.md。
语言支持
LSP 工具使用您系统上安装的外部语言服务器。
语言 | 语言服务器 | 安装命令 |
Python | basedpyright | (已捆绑) |
TypeScript/JS | typescript-language-server |
|
Go | gopls |
|
Rust | rust-analyzer |
|
仪表盘
用于监控操作的实时终端 UI。
pip install relace-mcp[tools]
relogs有关详细用法,请参阅 docs/dashboard.md。
基准测试
使用 Loc-Bench 代码定位数据集评估 agentic_search 性能。
git clone https://github.com/possible055/relace-mcp.git
cd relace-mcp
uv sync --extra benchmark
# Build dataset from Hugging Face
uv run --extra benchmark python -m benchmark.cli.build_locbench --output artifacts/data/raw/locbench_v1.jsonl
# Run evaluation
uv run --extra benchmark python -m benchmark.cli.run --dataset artifacts/data/raw/locbench_v1.jsonl --limit 20所有基准测试产物均写入 benchmark/.data/ 下。
有关网格搜索、分析工具和指标解读,请参阅 docs/benchmark.md。
平台支持
平台 | 状态 | 备注 |
Linux | ✅ 完全支持 | 主要开发平台 |
macOS | ✅ 完全支持 | 所有功能可用 |
Windows | ⚠️ 部分支持 |
|
故障排除
错误或消息 | 解决方案 |
| 使用 Relace 提供商或云端工具时设置 |
| 在目标块附近包含 1-3 个唯一的锚点行 |
| 验证路径是否存在且位于 |
| 文件超过 10MB;将更改拆分为更小的文件或编辑 |
| 为非 UTF-8 项目显式设置 |
| 验证 API 密钥和提供商配置 |
| 稍后重试或减少请求量 |
| 检查网络访问并重试 |
| 添加更具体的锚点或具体的行,以便合并能产生差异 |
| 确保占位符标记仅用作占位符,而非预期的字面输出 |
| 拆分大型删除密集型编辑或使用显式的删除指令 |
| 将更改拆分为更小、更局部的编辑 |
开发
git clone https://github.com/possible055/relace-mcp.git
cd relace-mcp
uv sync --extra dev --extra benchmark
uv run pytest
uv run --extra dev --extra benchmark pytest benchmark/tests -q许可证
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceProvides AI-powered code intelligence for any codebase using local LLMs and vector search, enabling semantic code search, pattern analysis, and context-optimized code generation with 90% token savings.2MIT
- FlicenseNot gradedqualityCmaintenanceTransforms codebases into a knowledge graph for AI agents, enabling semantic search, impact analysis, and persistent session memory with up to 94% token savings.217
- AlicenseAqualityAmaintenanceProvides persistent memory and a codebase knowledge graph for AI coding assistants, enabling shared context across multiple tools like Claude, Cursor, and ChatGPT, with significant token reduction.532MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI coding assistants to automatically scan, store, and query API endpoints from codebases, providing instant lookup and semantic search to reduce context switching and token consumption.1MIT
Related MCP Connectors
SaaS intelligence for AI agents. 5 unified tools cover 1,000+ services with 91-96% token savings.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Search your knowledge bases from any AI assistant using hybrid RAG.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/possible055/relace-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server