Token导航 LogoToken导航TokenDH.com
Cursor Like MCP logo
搜索检索未说明官方级别未说明来源级核验

Cursor Like MCP

MCP Server

一个全面的模型上下文协议(MCP)服务器,为LLMs(如Claude)提供高级代码库交互能力,包括代码库索引、文件操作、快速搜索、符号提取和语义搜索等功能。

工具数

6

提示词数

0

GitHub Stars

0

资源数

0
PythonClaude搜索Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

s0ham075

提供方

s0ham075

最后核验

2026/5/17 20:20

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

🚀 MCP代码库服务器

全面 模型上下文协议(MCP) 为Claude等LLM提供高级代码库交互功能的服务器。将其视为赋予Claude“开发人员超能力”来理解、搜索和分析整个代码库。

![Python 3.10+](https://www.python.org/downloads/) ![MCP SDK](https://modelcontextprotocol.io/) ![License: MIT](https://opensource.org/licenses/MIT)

✨ 特性

功能描述状态
🔍 代码库索引递归扫描目录、检测语言、提取元数据✅ 准备好了
📂 文件操作带过滤器的智能列表(类型、大小、深度、元数据)✅ 准备好了
📄 文件读取使用行范围、令牌限制、智能分块进行读取✅ 准备好了
🔤 快速搜索带上下文的Grep式关键字/正则表达式搜索✅ 准备好了
🧱 符号提取函数、类、导入的AST解析(Python)✅ 准备好了
🧠 语义搜索使用嵌入的AI驱动的相似性搜索✅ 准备好了

🎯 你能做什么?

👤 "Index my Django project and find all authentication-related code"
🤖 Claude uses index_codebase → semantic_search → extracts relevant files

👤 "Show me all TODO comments across the codebase"  
🤖 Claude uses search_in_codebase with pattern "TODO"

👤 "What's the structure of the main API file?"
🤖 Claude uses extract_symbols → shows all classes, functions, imports

👤 "Find files similar to database connection handling"
🤖 Claude uses semantic_search → finds semantically similar code

🛠️ 可用工具

1.️⃣ 指数_贬值

递归扫描并索引代码库。

index_codebase(
    directory_path: str,                      # Root directory to scan
    include_extensions: Optional[List[str]],  # e.g., [".py", ".js"]
    exclude_patterns: Optional[List[str]],    # e.g., ["node_modules"]
    max_file_size_mb: float = 10.0           # Skip files larger than this
)

例子: "Index my Python project at ~/code/myapp"

2.️⃣ 列表文件

列出并筛选目录中的文件。

list_files(
    directory_path: str,
    file_type: Optional[str] = None,          # e.g., ".py"
    max_depth: Optional[int] = None,          # Directory depth limit
    include_metadata: bool = False,           # Show size, date, language
    min_size_kb: Optional[float] = None,
    max_size_kb: Optional[float] = None
)

例子: "List all Python files in src/ with metadata"

3.️⃣ read_file

使用可选的行范围读取文件内容。

read_file(
    file_path: str,
    start_line: Optional[int] = None,         # 1-indexed
    end_line: Optional[int] = None,           # Inclusive
    max_tokens: Optional[int] = 4000          # Truncate if larger
)

例子: "Show me lines 50-100 of auth.py"

4.️⃣ 搜索_下载

快速关键字或正则表达式搜索。

search_in_codebase(
    query: str,                               # Search query or regex
    directory_path: Optional[str] = None,     # Search entire directory
    file_path: Optional[str] = None,          # Or search specific file
    use_regex: bool = False,                  # Enable regex matching
    case_sensitive: bool = False,
    file_extensions: Optional[List[str]] = None,
    max_results: int = 50
)

例子: "Find all TODO comments in auth.py""Search for 'async def' in Python files"

5.️⃣ 提取_符号

使用AST解析提取代码结构。

extract_symbols(
    file_path: str,
    symbol_types: Optional[List[str]] = None  # ["function", "class", "method", "import", "variable"]
)

例子: "Show me all classes and functions in main.py"

注: 目前仅支持Python。更多语言即将推出!

6.️⃣ 语义研究

使用AI嵌入查找语义相似的代码。

semantic_search(
    query: str,                               # Natural language query
    directory_path: str,                      # Must be indexed first
    top_k: int = 10,                         # Number of results
    min_similarity: float = 0.5,             # Similarity threshold
    file_extensions: Optional[List[str]] = None
)

例子: "Find code that handles database connections"

注: 需要 sentence-transformersfaiss-cpu 依赖性。

📚 用法示例

开始使用新的代码库

👤 Index my project at /home/user/myapp

🤖 [Indexes codebase]
   📊 Indexed 156 files, 12,450 lines
   Languages: Python (89 files), JavaScript (45 files), HTML (22 files)

👤 Show me the directory structure

🤖 [Lists files as tree]
   📂 myapp/
   ├── src/
   │   ├── api/
   │   ├── models/
   │   └── utils/
   ├── tests/
   └── config/

👤 What's in the main API file?

🤖 [Extracts symbols]
   Found 5 classes and 12 functions including:
   - AuthManager class with authenticate(), create_token() methods
   - validate_password() function
   - rate_limit decorator

查找和理解代码

👤 Find all database query functions

🤖 [Searches codebase]
   Found 12 matches:
   📄 models/user.py:45 - query_user_by_email()
   📄 models/posts.py:23 - query_posts()
   📄 utils/db.py:67 - execute_query()

👤 Show me the implementation of query_user_by_email

🤖 [Reads file with context]
   [Displays function code with line numbers]

👤 Are there any similar functions?

🤖 [Semantic search]
   Found semantically similar code:
   - query_user_by_id() (similarity: 0.89)
   - find_user() (similarity: 0.82)

🏗️ 项目结构

mcp-codebase-server/
├── server.py                    # Main MCP server
├── codebase_tools/
│   ├── __init__.py             # Package init
│   ├── indexer.py              # Codebase indexing
│   ├── file_ops.py             # File operations
│   ├── searcher.py             # Text/regex search
│   ├── symbol_extractor.py     # AST parsing
│   └── semantic_search.py      # Embedding-based search
├── requirements.txt            # Python dependencies
├── pyproject.toml             # Project config
├── README.md                  # This file
├── USAGE_EXAMPLES.md          # Detailed examples
└── INSTALL.sh                 # Quick install script

🙏 致谢

内置❤️ 对于那些希望他们的人工智能真正理解他们的代码的开发人员#光标状MCP

目录标签

目录标签

PythonClaude搜索代码库索引本地部署文件操作快速搜索符号提取语义搜索LLM集成

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

6

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP