File Rank MCP Server
local-only server
The server can only run on the client’s local machine because it depends on local resources.
Integrations
Analyzes C/C++ source files to detect includes and differentiate between system and local headers for dependency tracking and importance ranking.
Processes JavaScript files using regex patterns to detect import/require statements for dependency tracking and importance ranking.
Supports running the MCP server from WSL Linux environments with compatible configuration files.
File Rank MCP (Model Context Protocol) Server
A TypeScript-based tool for ranking files in your codebase by importance and providing summaries with dependency tracking.
Overview
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.
Features
- Rank files on a scale from 0-10 (10 being most important)
- Track and visualize file dependencies (which files import which)
- Real-time file system monitoring for automatic updates
- Get summaries of files (with placeholder for LLM integration)
- Query rankings for individual files, directories, or the entire codebase
- Self-documenting API with discovery endpoints
- Simple stdio JSON interface
Setup
- Clone this repository
- Make the build script executable:Copy
- Run the build script:This will:Copy
- Check for Node.js installation
- Install project dependencies
- Compile TypeScript code
- Generate MCP configuration
- 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
Usage
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.
Running the Server
Supported Languages
The server automatically detects dependencies in the following languages:
- Python:
import
andfrom ... import
statements - C/C++:
#include
directives - Rust:
use
andmod
statements - Lua:
require
statements - JavaScript/TypeScript:
import
statements
How It Works
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.
Data Structure
The file tree is stored in a JSON structure:
Dependency Detection
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
File Importance Calculation
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
Technical Stack
- TypeScript/Node.js
- Model Context Protocol SDK (v1.7.0)
- Chokidar for file system monitoring
- ES2020 target with CommonJS modules
Development
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:Copy
- Run the server:Copy
The build script will:
- Install any new dependencies
- Compile TypeScript code
- Generate updated MCP configuration
- Create a detailed log file for troubleshooting
Integration with LLMs
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
License
This project is licensed under the GNU General Public License v3 (GPL-3.0). See the LICENSE file for the full license text.
This server cannot be installed
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.