MCP File Context
A Model Context Protocol (MCP) server that provides file system context to Large Language Models (LLMs). This server enables LLMs to read, search, and analyze code files with advanced caching and real-time file watching capabilities.
What is MCP File Context?
MCP File Context is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to model context protocol (mcp) server that provides file system context to large language models (llms). this server enables llms to read, search, and analyze code files with advanced caching and real-t...
A Model Context Protocol (MCP) server that provides file system context to Large Language Models (LLMs). This server enables LLMs to read, search, and analyze code files with advanced caching and real-time file watching capabilities.
This server falls under the Developer Tools and File Systems categories on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- A Model Context Protocol (MCP) server that provides file sys
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx mcp-file-context-serverConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use MCP File Context
MCP File Context Server is a Model Context Protocol server that gives LLMs direct access to your local file system for reading, searching, and analysing code files. It features an intelligent LRU cache with configurable TTL, real-time file watching so context stays current as files change, and a dedicated code-analysis tool that measures complexity and quality metrics. Developers use it to let Claude explore a codebase, locate patterns across many files, and reason about code quality without manually pasting file contents.
Prerequisites
- Node.js 18 or later installed
- An MCP-compatible client such as Claude Desktop or Cursor
- Read access to the directory you want the server to serve
- Optional: Smithery CLI if you prefer the managed install path
Install via npx or Smithery
The server can be run directly with npx (no global install needed) or installed through the Smithery CLI for managed updates.
npx -y @smithery/cli install @bsmi021/mcp-file-context-server --client claudeConfigure environment variables (optional)
Three optional env vars tune the cache behaviour: MAX_CACHE_SIZE sets how many entries to keep (default 1000), CACHE_TTL sets how long entries live in milliseconds (default 3600000 = 1 hour), and MAX_FILE_SIZE caps the file size the server will read in bytes.
export MAX_CACHE_SIZE=500
export CACHE_TTL=1800000
export MAX_FILE_SIZE=5242880Add the server to Claude Desktop config
Edit claude_desktop_config.json to register the server. Optionally pass env vars in the env block.
{
"mcpServers": {
"file-context": {
"command": "npx",
"args": ["-y", "mcp-file-context-server"],
"env": {
"MAX_CACHE_SIZE": "1000",
"CACHE_TTL": "3600000"
}
}
}
}Restart Claude Desktop
Fully quit and reopen Claude Desktop so it reads the updated configuration and starts the file-context server.
Use the exposed tools
The server exposes five tools: list_context_files (directory listing with metadata), read_context (read a file or directory), search_context (regex pattern search with surrounding context), analyze_code (code quality and complexity metrics), and cache_stats (cache performance report).
MCP File Context Examples
Client configuration
Claude Desktop configuration block for the MCP File Context Server with optional cache tuning.
{
"mcpServers": {
"file-context": {
"command": "npx",
"args": ["-y", "mcp-file-context-server"],
"env": {
"MAX_CACHE_SIZE": "1000",
"CACHE_TTL": "3600000",
"MAX_FILE_SIZE": "10485760"
}
}
}
}Prompts to try
Example prompts that exercise the server's file reading, search, and analysis capabilities.
- "List all files in the src directory and tell me which ones are TypeScript."
- "Search for all usages of the function 'fetchUser' across the project."
- "Read the file src/api/client.ts and explain what it does."
- "Analyse the code quality of src/utils/parser.js and highlight complex functions."
- "Show me the current cache statistics for the file context server."Troubleshooting MCP File Context
Files are not updating after changes — the server returns stale content
The cache TTL may be set too high. Lower CACHE_TTL to a smaller value (e.g. 60000 for 1 minute) or restart the server. The real-time file watcher should invalidate cache entries automatically, but large directories can sometimes delay events.
MAX_FILE_SIZE limit reached — server refuses to read a large file
Increase the MAX_FILE_SIZE environment variable (in bytes) in your claude_desktop_config.json env block and restart Claude Desktop.
search_context returns no results even though the pattern exists
Ensure the search pattern is a valid JavaScript regex string. Escape special characters and verify the file extension filter matches the files you expect (e.g. use '.ts' not 'ts' for TypeScript files).
Frequently Asked Questions about MCP File Context
What is MCP File Context?
MCP File Context is a Model Context Protocol (MCP) server that model context protocol (mcp) server that provides file system context to large language models (llms). this server enables llms to read, search, and analyze code files with advanced caching and real-time file watching capabilities. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install MCP File Context?
Follow the installation instructions on the MCP File Context GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with MCP File Context?
MCP File Context works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is MCP File Context free to use?
Yes, MCP File Context is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
MCP File Context Alternatives — Similar Developer Tools Servers
Looking for alternatives to MCP File Context? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up MCP File Context in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use MCP File Context?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.