modelscope·@fkesheh/code-context-mcp
一个MCP服务器,它在本地git仓库上提供语义搜索功能,使用户能够克隆仓库、处理分支并通过矢量化代码块搜索代码。
Model Context Protocol (MCP) 服务器,用于从本地 git 仓库提供代码上下文。该服务器允许您:
# Clone the repository
git clone <repository-url>
cd code-context-mcp
# Install dependencies
npm install
# Build the project
npm run build
设置以下环境变量:
DATA_DIR:SQLite 数据库目录(默认:'~/.codeContextMcp/data')REPO_CACHE_DIR:克隆仓库目录(默认:'~/.codeContextMcp/repos')为了更快更强大的嵌入,您可以使用 Ollama:
# Install Ollama from https://ollama.ai/
# Pull an embedding model (unclemusclez/jina-embeddings-v2-base-code is recommended)
ollama pull unclemusclez/jina-embeddings-v2-base-code
在您的 Claude Desktop 配置文件 (claude_desktop_config.json) 中添加以下配置:
{
"mcpServers": {
"code-context-mcp": {
"command": "/path/to/your/node",
"args": ["/path/to/code-context-mcp/dist/index.js"]
}
}
}
服务器提供了以下工具:
克隆仓库,处理代码,并执行语义搜索:
{
"repoUrl": "https://github.com/username/repo.git",
"branch": "main", // Optional - defaults to repository's default branch
"query": "Your search query",
"keywords": ["keyword1", "keyword2"], // Optional - filter results by keywords
"filePatterns": ["**/*.ts", "src/*.js"], // Optional - filter files by glob patterns
"excludePatterns": ["**/node_modules/**"], // Optional - exclude files by glob patterns
"limit": 10 // Optional - number of results to return, default: 10
}
branch 参数是可选的。如果不提供,工具将自动使用仓库的默认分支。
keywords 参数是可选的。如果提供,结果将被过滤以仅包括包含至少一个指定关键字的代码块(不区分大小写匹配)。
filePatterns 和 excludePatterns 参数是可选的。它们允许您使用 glob 模式过滤要处理和搜索的文件(例如,**/*.ts 表示所有 TypeScript 文件)。
服务器使用 SQLite 并采用以下模式:
repository:存储有关仓库的信息branch:存储有关分支的信息file:存储有关文件的信息branch_file_association:将文件与分支关联file_chunk:存储代码块及其嵌入MIT
一种模型上下文协议(MCP)服务器,可以帮助大型语言模型以最少的设置来索引、搜索和分析代码库。
一个功能齐全的编码代理,它使用符号操作(由语言服务器启用),即使在大型代码库中也能很好地工作。本质上是 Cursor 和 Windsurf Agents、Cline、Roo Code 等的免费替代品。
为虚幻引擎代码库提供深度源代码分析,使人工智能助手能够理解C++类结构、搜索代码和分析子系统。
一个通过分析你的编程项目、自动提取技能并生成专业描述来更新你的JSON简历,从而增强AI助手功能的服务器。
一种模型上下文协议服务器,使大型语言模型能够通过强大的API与Git仓库进行交互,支持仓库初始化、克隆、文件暂存、提交和分支管理等操作。
提供了深入的Git文件级法医工具,用于分析Git仓库中详细的文件历史、变更和模式,重点是个别文件分析而非整个仓库的操作。