MCP File Context Server
ファイルコンテキストサーバー
大規模言語モデル(LLM)にファイルシステムコンテキストを提供するモデルコンテキストプロトコル(MCP)サーバー。このサーバーにより、LLMは高度なキャッシュ機能とリアルタイムファイル監視機能を利用して、コードファイルの読み取り、検索、分析を行うことができます。
特徴
ファイル操作
ファイルとディレクトリの内容を読み取る
詳細なメタデータを含むファイルを一覧表示する
リアルタイムのファイル監視とキャッシュ無効化
複数のファイルエンコーディングのサポート
再帰的なディレクトリトラバーサル
ファイルタイプのフィルタリング
コード分析
循環的複雑度の計算
依存関係の抽出
コメント分析
品質指標:
重複行検出
長い行の検出(100文字以上)
複雑な機能の識別
行数(合計、空でない行、コメント)
スマートキャッシング
LRU(最長時間未使用)キャッシュ戦略
ファイル変更時の自動キャッシュ無効化
設定可能な制限を備えたサイズを考慮したキャッシュ
キャッシュ統計とパフォーマンスメトリック
効率的な検索のための最終読み取り結果のキャッシュ
詳細検索
正規表現パターンマッチング
設定可能な周囲の線によるコンテキスト認識結果
ファイルタイプのフィルタリング
マルチパターン検索のサポート
キャッシュされた結果の検索
除外パターン
Related MCP server: TokenScope
インストール
Smithery経由でインストール
Smithery経由で Claude Desktop の File Context Server を自動的にインストールするには:
npx -y @smithery/cli install @bsmi021/mcp-file-context-server --client claude手動インストール
npm install @modelcontextprotocol/file-context-server使用法
サーバーの起動
npx file-context-server利用可能なツール
リストコンテキストファイル
詳細なメタデータを含むディレクトリ内のファイルを一覧表示します
{ "path": "./src", "recursive": true, "includeHidden": false }読み取りコンテキスト
メタデータを含むファイルまたはディレクトリの内容を読み取ります
{ "path": "./src/index.ts", "encoding": "utf8", "maxSize": 1000000, "recursive": true, "fileTypes": ["ts", "js"] }検索コンテキスト
コンテキストを使用してファイル内のパターンを検索します
{ "pattern": "function.*", "path": "./src", "options": { "recursive": true, "contextLines": 2, "fileTypes": ["ts"] } }コードを分析する
コードファイルを分析して品質メトリクスを算出します
{ "path": "./src", "recursive": true, "metrics": ["complexity", "dependencies", "quality"] }キャッシュ統計
キャッシュ統計とパフォーマンスメトリックを取得します
{ "detailed": true }
エラー処理
サーバーは、具体的なエラー コードとともに詳細なエラー メッセージを提供します。
FILE_NOT_FOUND: ファイルまたはディレクトリが存在しませんPERMISSION_DENIED: アクセス権限の問題INVALID_PATH: 無効なファイルパス形式FILE_TOO_LARGE: ファイルのサイズ制限を超えていますENCODING_ERROR: ファイルのエンコードの問題UNKNOWN_ERROR: 予期しないエラー
構成
カスタマイズ用の環境変数:
MAX_CACHE_SIZE: キャッシュされるエントリの最大数(デフォルト: 1000)CACHE_TTL: キャッシュの有効期間(ミリ秒)(デフォルト: 1時間)MAX_FILE_SIZE: 読み取り時の最大ファイルサイズ(バイト単位)
発達
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm test
# Start in development mode
npm run devライセンス
マサチューセッツ工科大学
貢献
貢献を歓迎します!行動規範とプルリクエストの送信手順の詳細については、貢献ガイドをお読みください。
クロスプラットフォームパスの互換性
注: 2025 年 4 月現在、File Context Server のすべてのファイルおよびディレクトリ パスの処理は、クロスプラットフォーム互換性 (Windows、macOS、Linux) を向上させるために更新されています。
すべての glob パターンは内部的に POSIX スタイルのパス (スラッシュ) を使用するため、OS に関係なく一貫したファイル マッチングが保証されます。
すべてのファイル システム操作 (読み取り、書き込み、統計など) では、信頼性を確保するために正規化された絶対パスが使用されます。
サーバーを開発または拡張している場合は、glob パターンに
path.posix.joinを使用し、ファイル システム アクセスにpath.normalize使用します。この変更により、異なるオペレーティング システムでのパス区切り文字とファイルの一致に関する問題が防止されます。
エンドユーザー側では変更は必要ありませんが、開発者はプロジェクトに貢献する際にこれらの規則に従う必要があります。
Available Tools
6 toolsgenerate_outlineC
Generate a code outline for a file, showing its structure (classes, functions, imports, etc). Supports TypeScript/JavaScript and Python files.
Inputs: path (required).
get_chunk_countA
Get the total number of chunks that will be returned for a read_context request. Use this tool FIRST before reading content to determine how many chunks you need to request. The parameters should match what you'll use in read_context.
Inputs: path (required), encoding, maxSize, recursive, +1 more.
getFilesC
Retrieve multiple files by their paths, returning content and metadata for each file
Inputs: filePathList (required).
get_profile_contextC
Get repository context based on current profile settings
Inputs: refresh.
read_contextA
Read and analyze code files with advanced filtering and chunking. The server automatically ignores common artifact directories and files:
Version Control: .git/
Python: .venv/, pycache/, *.pyc, etc.
JavaScript/Node.js: node_modules/, bower_components/, .next/, dist/, etc.
IDE/Editor: .idea/, .vscode/, .env, etc.
For large files or directories, use get_chunk_count first to determine total chunks, then request specific chunks using chunkNumber parameter.
Inputs: path (required), maxSize, encoding, recursive, +2 more.
set_profileC
Set the active profile for context generation
Inputs: profile_name (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Most tools have distinct purposes, but 'getFiles' and 'read_context' both involve retrieving file content, which could cause confusion. 'generate_outline' and 'get_profile_context' are clearly separate, and 'set_profile' and 'get_chunk_count' are specialized utilities.
Naming is inconsistent with mixed conventions: 'generate_outline' and 'read_context' use snake_case, while 'getFiles' uses camelCase. Verb styles vary (e.g., 'generate' vs. 'get' vs. 'read'), and 'get_chunk_count' includes an underscore while 'getFiles' does not, creating a chaotic pattern.
With 6 tools, the count is well-scoped for a file context server, covering core operations like file retrieval, analysis, and profile management without being overwhelming or too sparse.
The toolset covers key file context operations: retrieving files, analyzing code, generating outlines, and managing profiles. A minor gap exists in update or delete operations for profiles or contexts, but agents can likely work around this for the server's purpose.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
The Cortex MCP server provides read-only access to real-time engineering context from the Cortex developer portal, allowing AI coding assistants to answer natural language questions about your organization's catalog (microservices, libraries, domains, teams, infrastructure), scorecards (engineering standards and best practices), initiatives (goals and deadlines), and Engineering Intelligence metrics. It includes tools for querying documentation, tracking personal entities, and accessing AI-assisted insights across the entire Cortex ecosystem.
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Related MCP Servers
- AlicenseAqualityCmaintenanceA Model Context Protocol (MCP) server that helps large language models index, search, and analyze code repositories with minimal setup22142,766 PyPI1,005MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables token-aware directory exploration and file analysis for LLMs, helping them understand codebases through intelligent scanning and reporting.28 PyPI4MIT

CodeAlive MCPofficial
AlicenseNot gradedqualityCmaintenanceA Model Context Protocol server that enhances AI agents by providing deep semantic understanding of codebases, enabling more intelligent interactions through advanced code search and contextual awareness.91MIT- AlicenseBqualityDmaintenanceA Model Context Protocol (MCP) server that enables AI applications to access and analyze local code repositories without manual uploads, providing file listing, content reading, code searching, and project structure analysis capabilities.7MIT