File Context Server
Overview
File Context Server is a Model Context Protocol (MCP) server designed to provide file system context to Large Language Models (LLMs), enabling them to read, search, and analyze code files with advanced caching and real-time file watching capabilities.
To use the File Context Server, install it via npm and start the server using the command npx file-context-server. You can then utilize various tools to list files, read file contents, search for patterns, and analyze code quality.
- File Operations: Read file contents, list files with metadata, real-time file watching, and support for multiple encodings. - Code Analysis: Calculate cyclomatic complexity, extract dependencies, and analyze comments with quality metrics. - Smart Caching: Implement LRU caching, automatic cache invalidation, and performance metrics. - Advanced Search: Support for regex pattern matching, context-aware results, and multi-pattern searches.
- Assisting LLMs in understanding and analyzing codebases.
- Providing real-time context for code review and debugging.
- Enhancing code quality through automated analysis and metrics.
Add to your AI client
Use these steps to connect File Context Server in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"mcp-file-context-server-bsmi021": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-file-context-server-bsmi021"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"mcp-file-context-server-bsmi021": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-file-context-server-bsmi021"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"mcp-file-context-server-bsmi021": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-file-context-server-bsmi021"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"mcp-file-context-server-bsmi021": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-file-context-server-bsmi021"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"mcp-file-context-server-bsmi021": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-file-context-server-bsmi021"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"mcp-file-context-server-bsmi021": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-file-context-server-bsmi021"
]
}
}
}FAQ
Can the File Context Server handle large codebases?
Yes! It is designed to efficiently manage and analyze large code files with advanced caching strategies.
Is there a limit on the file size that can be processed?
Yes, the maximum file size is configurable, and you can set it according to your needs.
How can I contribute to the project?
Contributions are welcome! Please refer to the Contributing Guide in the repository for details.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":908,"uuid":"7981294b-8f12-4b83-a4b7-b63135c93500","name":"mcp-file-context-server","title":"File Context Server","description":"","avatar_url":"https://avatars.githubusercontent.com/u/5215575?v=4","created_at":"2025-01-28T02:18:14.558Z","updated_at":"2025-02-23T07:13:15.807Z","status":"created","author_name":"bsmi021","author_avatar_url":"https://avatars.githubusercontent.com/u/5215575?v=4","tags":"[]","category":"developer-tools","is_featured":false,"sort":1,"url":"https://github.com/bsmi021/mcp-file-context-server","target":"_self","content":"$29","summary":"$2a","img_url":"https://camo.githubusercontent.com/3da3c3b4ebe35102cf612397f16d99849e2b914c2e4298d1ed4b8a9c6ed663c5/68747470733a2f2f736d6974686572792e61692f62616467652f4062736d693032312f6d63702d66696c652d636f6e746578742d736572766572","type":null,"metadata":"{\"star\":\"4\",\"license\":\"\",\"language\":\"JavaScript\",\"is_official\":false,\"latest_commit_time\":\"2025-03-30 09:47:42\"}","user_uuid":null,"tools":null,"sse_url":null,"sse_provider":null,"sse_params":null,"is_official":false,"server_command":null,"server_params":null,"server_config":null,"allow_call":false,"is_innovation":false,"is_dxt":false,"dxt_manifest":null,"dxt_file_url":null,"is_audit":false},"randomProjects":[],"currentServerKey":"$undefined"}]]}]