Mantic.sh
by marcoaapfortes·★ 547·综合分 50
一款面向AI代理的上下文感知代码搜索引擎,能够理解代码结构。
概述
Mantic 是专门为AI代理设计的结构化代码搜索引擎,优先考虑相关性而非原始速度,结合语义理解和启发式搜索来查找概念上相关的代码。该工具支持 CamelCase 检测、路径序列匹配等高级功能,并能跨单体仓库执行代码智能任务,如'跳转到定义'和'查找引用'。它完全本地运行,无数据外流,既高效又安全。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
什么时候选它
当您需要为AI代理进行上下文感知的代码搜索,需要理解代码结构而不仅仅是简单文本匹配,并且优先考虑结果质量而非原始搜索速度时,选择 Mantic。
什么时候不要选它
对于速度至关重要的超大型仓库(100K+ 文件),或只需要简单精确字符串搜索的情况,应避免使用 Mantic,因为此时像 ripgrep 这样的工具更快。
此 server 暴露的工具
从 README 抽取出 10 个工具search_filesSearch code files by intent with optional semantic reranking
get_definitionGo to definition of a symbol across the codebase
find_referencesFind all usages of a symbol in the codebase
get_contextZero-query mode for proactive context about modified files and dependencies
session_startStart a named coding session with intent context
session_endEnd an active coding session
session_record_viewTrack viewed files in the current session
session_listList all active sessions
session_infoGet detailed information about a specific session
analyze_intentUnderstand query intent to improve search results
可对比工具
安装
MCP 服务器安装
Mantic 作为 MCP (Model Context Protocol) 服务器,适用于 Claude Desktop、Cursor、VS Code 和其他兼容 MCP 的工具。
**一键安装:**
- [在 Cursor 中安装](https://cursor.com/en/install-mcp?name=mantic&config=eyJ0eXBlIjogInN0ZGlvIiwgImNvbW1hbmQiOiAibnB4IiwgImFyZ3MiOiBbIi15IiwgIm1hbnRpYy5zaEBsYXRlc3QiLCAic2VydmVyIl19)
- [在 VS Code 中安装](https://vscode.dev/redirect/mcp/install?name=mantic&config=%7B%22type%22%3A%20%22stdio%22%2C%20%22command%22%3A%20%22npx%22%2C%20%22args%22%3A%20%5B%22-y%22%2C%20%22mantic.sh%40latest%22%2C%20%22server%22%5D%7D)
**手动配置**(适用于 Claude Desktop 或其他 MCP 客户端):
将此添加到您的 MCP 设置文件中:
- **macOS**:
~/Library/Application Support/Claude/claude_desktop_config.json - **Windows**:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"mantic": {
"command": "npx",
"args": ["-y", "mantic.sh@latest", "server"]
}
}
}FAQ
- Mantic 与 ripgrep 相比如何?
- Mantic 的原始搜索速度比 ripgrep 慢,但提供了更优的相关性排序、上下文感知搜索和代码智能功能,如'跳转到定义'和'查找引用'。
- Mantic 是否适用于大型代码库?
- Mantic 可以处理大型代码库(已在包含 481K 文件的 Chromium 上测试),但存在速度权衡。对于超大型代码库(10万+文件),简单文本搜索 ripgrep 可能更快。
Hacker News 讨论
开发者社区最近的相关讨论。
- 帖子 by marcoaapfortes · 2026-01-06
Mantic.sh 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。