DeepView MCP 是一个模型上下文协议服务器,它使像 Cursor 和 Windsurf 这样的IDE能够使用Gemini的广泛上下文窗口来分析大型代码库。
要通过Smithery自动安装DeepView for Claude Desktop:
npx -y @smithery/cli install @ai-1st/deepview-mcp --client claude
pip install deepview-mcp
注意:您不需要手动启动服务器。这些参数在您的IDE中的MCP设置中进行配置(见下文)。
# 使用默认设置的基本用法
deepview-mcp [path/to/codebase.txt]
# 指定不同的Gemini模型
deepview-mcp [path/to/codebase.txt] --model gemini-2.0-pro
# 更改日志级别
deepview-mcp [path/to/codebase.txt] --log-level DEBUG
代码库文件参数是可选的。如果没有提供,您需要在查询时指定它。
--model MODEL: 指定要使用的Gemini模型(默认:gemini-2.0-flash-lite)--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}: 设置日志级别(默认:INFO){
"mcpServers": {
"deepview": {
"command": "/path/to/deepview-mcp",
"args": [],
"env": {
"GEMINI_API_KEY": "your_gemini_api_key"
}
}
}
}
设置代码库文件是可选的。如果您正在处理相同的代码库,可以使用以下配置设置默认代码库文件:
{
"mcpServers": {
"deepview": {
"command": "/path/to/deepview-mcp",
"args": ["/path/to/codebase.txt"],
"env": {
"GEMINI_API_KEY": "your_gemini_api_key"
}
}
}
}
这里是如何指定要使用的Gemini版本:
{
"mcpServers": {
"deepview": {
"command": "/path/to/deepview-mcp",
"args": ["--model", "gemini-2_5-pro-exp-03-25"],
"env": {
"GEMINI_API_KEY": "your_gemini_api_key"
}
}
}
}
该服务器提供了一个工具:
deepview: 关于代码库提问
question - 要问关于代码库的问题codebase_file - 在查询之前加载的代码库文件路径DeepView MCP需要一个包含整个代码库的单个文件。您可以使用repomix以AI友好的格式准备您的代码库。
# 确保您使用的是Node.js 18.17.0或更高版本
npx repomix
这将生成一个包含您的代码库的repomix-output.xml文件。
npx repomix --init
这会创建一个repomix.config.json文件,您可以编辑它来:
这是一个示例repomix.config.json文件:
{
"include": [
"**/*.py",
"**/*.js",
"**/*.ts",
"**/*.jsx",
"**/*.tsx"
],
"exclude": [
"node_modules/**",
"venv/**",
"**/__pycache__/**",
"**/test/**"
],
"output": {
"format": "xml",
"filename": "my-codebase.xml"
}
}
有关repomix的更多信息,请访问repomix GitHub仓库。
MIT
Dmitry Degtyarev (ddegtyarev@gmail.com)