sourcesage
SourceSage: Memoria de código eficiente para LLM
SourceSage es un servidor MCP (Protocolo de Contexto de Modelo) que memoriza eficientemente aspectos clave de una base de código (lógica, estilo y estándares), a la vez que permite actualizaciones dinámicas y una rápida recuperación. Está diseñado para ser independiente del lenguaje, aprovechando la comprensión del LLM del código en múltiples lenguajes.
Características
Agnóstico del lenguaje : funciona con cualquier lenguaje de programación que el LLM comprenda
Almacenamiento de gráficos de conocimiento : almacena de manera eficiente entidades de código, relaciones, patrones y convenciones de estilo
Análisis impulsado por LLM : se basa en el LLM para analizar el código y brindar información.
Almacenamiento eficiente en tokens : optimiza para un uso mínimo de tokens mientras maximiza la capacidad de memoria
Actualizaciones incrementales : actualiza el conocimiento cuando el código cambia sin almacenamiento redundante
Recuperación rápida : permite la recuperación rápida y precisa de información relevante
Related MCP server: Logseq MCP Tools
Cómo funciona
SourceSage utiliza un enfoque novedoso donde:
El LLM analiza archivos de código (en cualquier idioma)
El LLM utiliza herramientas MCP para registrar entidades, relaciones, patrones y convenciones de estilo.
SourceSage almacena este conocimiento en una estructura gráfica eficiente en tokens
El LLM puede consultar posteriormente este conocimiento cuando sea necesario.
Este enfoque aprovecha la comprensión del lenguaje inherente del LLM mientras centra el servidor MCP en la gestión eficiente de la memoria.
Instalación
# Clone the repository
git clone https://github.com/yourusername/sourcesage.git
cd sourcesage
# Install the package
pip install -e .Uso
Ejecución del servidor MCP
# Run the server
sourcesage
# Or run directly from the repository
python -m sourcesage.mcp_serverConectarse a Claude para escritorio
Abrir Claude para escritorio
Vaya a Configuración > Desarrollador > Editar configuración
Agregue lo siguiente a su
claude_desktop_config.json:
Si ha instalado el paquete:
{
"mcpServers": {
"sourcesage": {
"command": "sourcesage",
"args": []
}
}
}Si está ejecutando desde un directorio local sin instalar:
{
"sourcesage": {
"command": "uv",
"args": [
"--directory",
"/path/to/sourcesage",
"run",
"main.py"
]
},
}Reiniciar Claude para escritorio
Herramientas disponibles
SourceSage proporciona las siguientes herramientas MCP:
register_entity : Registra una entidad de código en el gráfico de conocimiento
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 IDregister_relationship : Registra una relación entre entidades
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 IDregister_pattern : Registra un patrón de código
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 IDregister_style_convention : Registra una convención de estilo de codificación
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 IDadd_entity_observation : Agregar una observación a una entidad
Input: - entity_name: Name of the entity - observation: Observation to add Output: Confirmation messagequery_entities : Entidades de consulta en el gráfico de conocimiento
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 entitiesget_entity_details : Obtener información detallada sobre una entidad
Input: - entity_name: Name of the entity Output: Detailed information about the entityquery_patterns : Patrones de código de consulta en el gráfico de conocimiento
Input: - language: Filter by programming language (optional) - pattern_name: Filter by pattern name (optional) Output: List of matching patternsquery_style_conventions : Convenciones de estilo de codificación de consultas
Input: - language: Filter by programming language (optional) - convention_name: Filter by convention name (optional) Output: List of matching style conventionsget_knowledge_statistics : Obtener estadísticas sobre el gráfico de conocimiento
Input: None
Output: Statistics about the knowledge graphclear_knowledge : Borra todo el conocimiento del gráfico
Input: None
Output: Confirmation messageEjemplo de flujo de trabajo con Claude
Analizar código : Pídele a Claude que analice tus archivos de código
"Please analyze this Python file and register the key entities and relationships."Registrar entidades : Claude utilizará la herramienta register_entity para almacenar entidades de código
"I'll register the main class in this file."Registrar relaciones : Claude utilizará la herramienta register_relationship para almacenar relaciones
"I'll register the inheritance relationship between these classes."Consulta de conocimiento : Más tarde, pregúntale a Claude sobre tu base de código.
"What classes are defined in my codebase?" "Show me the details of the User class." "What's the relationship between the User and Profile classes?"Obtenga patrones de codificación : Pregúntele a Claude sobre patrones de codificación
"What design patterns are used in my codebase?" "Show me examples of the Factory pattern in my code."
En qué se diferencia
A diferencia de las herramientas de análisis de código tradicionales, SourceSage:
Aprovecha la comprensión del LLM : utiliza la capacidad del LLM para comprender la semántica del código en todos los lenguajes.
Almacena conocimiento semántico : se centra en el significado y las relaciones, no solo en la sintaxis.
Es independiente del lenguaje : funciona con cualquier lenguaje de programación que el LLM comprenda
Optimiza la eficiencia del token : almacena el conocimiento de una manera que minimiza el uso del token
Evoluciona con las capacidades de LLM : a medida que mejoran los LLM, también lo hace la comprensión del código.
Contribuyendo
¡Agradecemos sus contribuciones! No dude en enviar una solicitud de incorporación de cambios.
Licencia
Este proyecto está licenciado bajo la licencia MIT: consulte el archivo de LICENCIA para obtener más detalles.
Available Tools
13 toolsadd_entity_observationC
Add an observation to an entity.
Args: entity_name: Name of the entity observation: Observation to add
Inputs: entity_name (required), observation (required).
clear_knowledgeA
Clear all knowledge from the graph.
Inputs: no named parameters.
dump_project_understandingA
Dump understanding of an entire project at once.
This tool provides a comprehensive dump of all knowledge related to a project, including all entities, relationships, patterns, and style conventions.
Args: project_path: Path to the project root directory include_observations: Whether to include detailed observations
Inputs: project_path (required), include_observations.
get_entity_detailsC
Get detailed information about an entity.
Args: entity_name: Name of the entity
Inputs: entity_name (required).
get_knowledge_statisticsC
Get statistics about the knowledge graph.
Inputs: no named parameters.
load_project_understandingB
Load understanding of an entire project at once.
This tool should be used by MCP clients to quickly get project understanding if available, instead of reading all the files individually. It loads all entities, relationships, patterns, and style conventions related to the project.
Args: project_path: Path to the project root directory
Inputs: project_path (required).
query_entitiesB
Query entities in the knowledge graph.
Args: entity_type: Filter by entity type (class, function, module, etc.) language: Filter by programming language name_pattern: Filter by name pattern (regex) limit: Maximum number of results to return
Inputs: entity_type, language, limit, name_pattern.
query_patternsB
Query code patterns in the knowledge graph.
Args: language: Filter by programming language pattern_name: Filter by pattern name
Inputs: language, pattern_name.
query_style_conventionsA
Query coding style conventions in the knowledge graph.
Args: language: Filter by programming language convention_name: Filter by convention name
Inputs: convention_name, language.
register_entityB
Register a code entity in the knowledge graph.
Args: 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 (e.g., function signature) language: Programming language observations: List of observations about the entity metadata: Additional metadata as key-value pairs
Inputs: entity_type (required), name (required), summary (required), language, +3 more.
register_patternB
Register a code pattern.
Args: name: Name of the pattern description: Description of the pattern language: Programming language example: Example code demonstrating the pattern metadata: Additional metadata as key-value pairs
Inputs: description (required), name (required), example, language, +1 more.
register_relationshipC
Register a relationship between entities.
Args: 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 as key-value pairs
Inputs: from_entity (required), relationship_type (required), to_entity (required), metadata.
register_style_conventionC
Register a coding style convention.
Args: name: Name of the convention description: Description of the convention language: Programming language examples: Example code snippets demonstrating the convention metadata: Additional metadata as key-value pairs
Inputs: description (required), name (required), examples, language, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
Most tools have distinct purposes focused on different aspects of knowledge graph management (entities, patterns, relationships, style conventions). However, there is some potential overlap between dump_project_understanding and load_project_understanding as both handle project-level data, though their descriptions clarify one is for output and the other for input.
All tools follow a consistent snake_case naming pattern with clear verb_noun structure (e.g., add_entity_observation, get_entity_details, query_entities, register_entity). The naming is predictable and uniform across all 13 tools.
With 13 tools, this is well-scoped for a knowledge graph server covering entities, patterns, relationships, and style conventions. Each tool serves a specific function in the CRUD/lifecycle operations, and none appear redundant or out of place.
The toolset provides comprehensive coverage for managing a knowledge graph, including registration, querying, and statistics. Minor gaps exist, such as no explicit update or delete operations for entities/patterns/relationships/conventions, but agents can work around this by re-registering or using clear_knowledge.
Related MCP Connectors
Team memory for AI coding agents and code reviews, reviewed by humans and served over MCP.
Shared memory for coding agents. Stop re-explaining your codebase every session.
Give your AI agent persistent, governed memory for every project. At task start it recalls the approved decisions, conventions, risks and architecture (semantic search, ranked by importance); at close it proposes what was learned as typed memories that you review and approve — governance, not a notes dump. Agents propose, humans govern: edits go back to pending and deletion is human-only by design. Connect Claude Code, Cursor, Claude Desktop or any MCP client in two minutes with just your API key — hosted (nothing to install) or locally via `uvx solucortex-mcp`. Built by SoluAI and dogfooded daily: SoluCortex is developed using its own living memory.
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceThis is an MCP server for PostgREST. It allows LLMs perform database queries and operations on Postgres databases via PostgREST. This server works with both Supabase projects (which use PostgREST) and standalone PostgREST servers.2,128 npm3,017Apache 2.0
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides AI assistants with structured access to your Logseq knowledge graph, enabling retrieval, searching, analysis, and creation of content within your personal knowledge base.70MIT
- AlicenseAqualityDmaintenanceAn MCP server that connects to a Swagger specification and helps an AI to build all the required models to generate a MCP server for that service.5167MIT
- AlicenseBqualityFmaintenanceA Model Context Protocol server that integrates with DeepSource to provide AI assistants with access to code quality metrics, issues, and analysis results.10132 npm7MIT
Appeared in Searches
- A tool for extracting code metadata and exposing it via MCP
- Retrieve the latest documentation of libraries in word embeddings form for LLMs
- Using local LLMs for code writing, reviewing, and rule generation
- Assistance with reviewing and merging code changes in a merge request
- Resources or Assistance for Learning to Code