- Home
- MCP servers
- File Context Server
File Context Server
- javascript
36
GitHub Stars
javascript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"bsmi021-mcp-file-context-server": {
"command": "npx",
"args": [
"file-context-server"
],
"env": {
"CACHE_TTL": "3600000",
"MAX_FILE_SIZE": "1048576",
"MAX_CACHE_SIZE": "1000"
}
}
}
}File Context Server provides a focused MCP that lets large language models access and analyze code bases by reading files, searching content, and computing quality metrics. It uses smart caching and real-time file watching to keep results fresh, making it easier to build code-aware AI assistants and tooling.
How to use
You connect to File Context Server through an MCP client to request file listings, read file content with metadata, search patterns with contextual lines, analyze code for quality metrics, and inspect cache statistics. Use these capabilities to help LLMs read and reason about code, understand project structure, locate definitions, and detect code quality issues across your repository.
In practice, run the server locally and point your MCP client at its endpoint. Start by listing files to understand the project layout, then read individual files to gather encoding and size details. Use search to locate function patterns or dependencies, and invoke analyze_code to surface complexity, dependencies, and quality signals. Monitor cache_stats to tune performance.
How to install
Prerequisites: ensure you have Node.js and npm installed on your system. Node.js version 14 or newer is typically suitable for MCP servers.
Option 1: Install for use with an MCP client via a quick one-liner using a package runner.
npx -y @smithery/cli install @bsmi021/mcp-file-context-server --client claude
Option 2: Install the server package locally for development or customization.
npm install @modelcontextprotocol/file-context-server
Additional sections
Configuration and runtime details are available to customize performance and behavior. You can adjust cache size and TTL, enable different file size limits, and control how the server watches for real-time changes. The server exposes a set of environment variables for these options, including MAX_CACHE_SIZE, CACHE_TTL, and MAX_FILE_SIZE. Use these to tailor caching and file-reading behavior to your workload.
Starting the server locally is straightforward after installation. Use the provided command to launch and then connect your MCP client to the running process.
Available tools
list_context_files
Lists files in a directory with detailed metadata
read_context
Reads file or directory contents with metadata
search_context
Searches for patterns in files with context and configurable surrounding lines
analyze_code
Analyzes code files for quality metrics including complexity, dependencies, and quality signals
cache_stats
Provides cache statistics and performance metrics