modelscope·@sarathsp06/sourcesage
SourceSage 是一个 MCP(模型上下文协议)服务器,能够高效记忆代码库的关键方面——逻辑、风格和标准——同时允许动态更新和快速检索。它被设计为与语言无关,利用 LLM 对多种语言代码的理解。
SourceSage 是一个 MCP(模型上下文协议)服务器,它能够高效地记住代码库的关键方面——逻辑、风格和标准,同时支持动态更新和快速检索。它的设计目标是与编程语言无关,利用大语言模型对多种编程语言的理解能力。
SourceSage 使用了一种新颖的方法:
这种方法利用了大语言模型固有的语言理解能力,同时让MCP服务器专注于高效的内存管理。
# Clone the repository
git clone https://github.com/yourusername/sourcesage.git
cd sourcesage
# Install the package
pip install -e .
# Run the server
sourcesage
# Or run directly from the repository
python -m sourcesage.mcp_server
claude_desktop_config.json 文件中添加以下内容:如果您已安装包:
{
"mcpServers": {
"sourcesage": {
"command": "sourcesage",
"args": []
}
}
}
如果您从本地目录运行而不安装:
{
"sourcesage": {
"command": "uv",
"args": [
"--directory",
"/path/to/sourcesage",
"run",
"main.py"
]
},
}
SourceSage 提供了以下MCP工具:
register_entity: Register a code entity in the knowledge graph
Input:
- name: Name of the entity (e.g., class name, function name)
- entity_type: Type of entity (class, function, module, etc.)
- summary: Brief description of the entity
- signature: Entity signature (optional)
- language: Programming language (optional)
- observations: List of observations about the entity (optional)
- metadata: Additional metadata (optional)
Output: Confirmation message with entity ID
register_relationship: Register a relationship between entities
Input:
- from_entity: Name of the source entity
- to_entity: Name of the target entity
- relationship_type: Type of relationship (calls, inherits, imports, etc.)
- metadata: Additional metadata (optional)
Output: Confirmation message with relationship ID
register_pattern: Register a code pattern
Input:
- name: Name of the pattern
- description: Description of the pattern
- language: Programming language (optional)
- example: Example code demonstrating the pattern (optional)
- metadata: Additional metadata (optional)
Output: Confirmation message with pattern ID
register_style_convention: Register a coding style convention
Input:
- name: Name of the convention
- description: Description of the convention
- language: Programming language (optional)
- examples: Example code snippets demonstrating the convention (optional)
- metadata: Additional metadata (optional)
Output: Confirmation message with convention ID
add_entity_observation: Add an observation to an entity
Input:
- entity_name: Name of the entity
- observation: Observation to add
Output: Confirmation message
query_entities: Query entities in the knowledge graph
Input:
- entity_type: Filter by entity type (optional)
- language: Filter by programming language (optional)
- name_pattern: Filter by name pattern (regex, optional)
- limit: Maximum number of results to return (optional)
Output: List of matching entities
get_entity_details: Get detailed information about an entity
Input:
- entity_name: Name of the entity
Output: Detailed information about the entity
query_patterns: Query code patterns in the knowledge graph
Input:
- language: Filter by programming language (optional)
- pattern_name: Filter by pattern name (optional)
Output: List of matching patterns
query_style_conventions: Query coding style conventions
Input:
- language: Filter by programming language (optional)
- convention_name: Filter by convention name (optional)
Output: List of matching style conventions
get_knowledge_statistics: Get statistics about the knowledge graph
Input: None
Output: Statistics about the knowledge graph
clear_knowledge: Clear all knowledge from the graph
Input: None
Output: Confirmation message
分析代码:请 Claude 分析你的代码文件
"请分析这个 Python 文件并注册关键实体和关系。"
注册实体:Claude 将使用 register_entity 工具来存储代码实体
"我将在这个文件中注册主要的类。"
注册关系:Claude 将使用 register_relationship 工具来存储关系
"我将注册这些类之间的继承关系。"
查询知识:之后,可以向 Claude 询问有关你的代码库的信息
"我的代码库中定义了哪些类?"
"给我展示 User 类的详细信息。"
"User 类和 Profile 类之间有什么关系?"
获取编码模式:询问 Claude 关于编码模式的信息
"在我的代码库中使用了哪些设计模式?"
"给我展示我的代码中工厂模式的例子。"
与传统的代码分析工具不同,SourceSage:
欢迎贡献!请随时提交 Pull Request。
本项目采用 MIT 许可证 - 详情请参阅 LICENSE 文件。
通过向量嵌入技术,为项目提供记忆库和RAG上下文支持,以增强代码理解和管理,并与RooCode和Cline集成。
通过全局和分支特定的记忆库,管理跨 Claude AI 会话的项目文档和上下文的服务器,通过结构化的 JSON 文档存储实现一致的知识管理。
快递100 MCP Server提供快递信息查询、快递运费预估比价、快递时效查询(含发货前时效查询与在途动态时效查询)等功能。
一种模型上下文协议服务器,通过在语言模型交互之间高效缓存数据来减少令牌消耗,自动存储和检索信息以最小化冗余令牌使用。
通过集成DeepSeek R1的高级推理引擎以处理复杂推理任务,从而增强Claude推理能力的服务器。
通过简化的SOLID架构,启用提示词的创建、管理和模板化,允许用户按类别组织提示词并在运行时填充模板。