file rank mcp
A tool that helps rank codebase files by importance (1-10 scale), track file dependencies, and provide summaries, all accessible through a simple JSON-based interface.
A tool that helps rank codebase files by importance (1-10 scale), track file dependencies, and provide summaries, all accessible through a simple JSON-based interface.
A TypeScript-based tool for ranking files in your codebase by importance and providing summaries with dependency tracking.
This tool helps you keep track of which files in your project are most important, giving them a rating between 0 (least important) to 10 (most important). It also tracks file dependencies and provides summaries, helping you understand the codebase structure.
chmod +x build.sh
./build.sh
This will:Create a detailed log file in /tmp/file-rank-mcp_*.log
Move the generated mcp.json
to your project's .cursor/
directory to use with Cursor AI
The tool communicates via JSON over stdio using the Model Context Protocol (MCP). It automatically monitors your project directory for changes and updates the file tree accordingly.
node dist/mcp-server.js
The server automatically detects dependencies in the following languages:
- Python: import
and from ... import
statements
- C/C++: #include
directives
- Rust: use
and mod
statements
- Lua: require
statements
- JavaScript/TypeScript: import
statements
The tool maintains a real-time tree structure of your codebase, stored in file-tree.json
. This file is automatically updated whenever changes are detected in your project directory.
The file tree is stored in a JSON structure:
{
"path": "/path/to/directory",
"name": "directory_name",
"isDirectory": true,
"children": [
{
"path": "/path/to/file.ts",
"name": "file.ts",
"isDirectory": false,
"dependencies": ["/path/to/dependency.ts"],
"importance": 8
}
]
}
The tool analyzes source code to detect dependencies: - Scans file contents for language-specific import patterns - Resolves relative imports to absolute paths - Verifies that imported files exist - Calculates importance based on dependency count
Files are assigned importance scores (0-10) based on: - Number of dependencies (files that import this file) - Position in the dependency tree - File type and location
To modify or extend the project:
Make changes to the TypeScript files in the src
directory
Run the build script to compile and update configuration:
./build.sh
Run the server:
node dist/mcp-server.js
The build script will: - Install any new dependencies - Compile TypeScript code - Generate updated MCP configuration - Create a detailed log file for troubleshooting
The current implementation includes a placeholder for LLM integration. In a production environment, the server could be extended to: - Generate file summaries using LLMs - Analyze code complexity and maintainability - Provide intelligent suggestions for file organization - Generate documentation based on code structure
This project is licensed under the GNU General Public License v3 (GPL-3.0). See the LICENSE file for the full license text.