File ContextSAFE
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.
Overview
From the repository's own README, as read at the audited commit. Badges and raw HTML are left out.
[](https://smithery.ai/server/@bsmi021/mcp-file-context-server)
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.
Features
- File Operations
- Read file and directory contents
- List files with detailed metadata
- Real-time file watching and cache invalidation
- Support for multiple file encodings
- Recursive directory traversal
- File type filtering
- Code Analysis
- Cyclomatic complexity calculation
- Dependency extraction
- Comment analysis
- Quality metrics:
- Duplicate lines detection
- Long lines detection (>100 characters)
- Complex function identification
- Line counts (total, non-empty, comments)
- Smart Caching
- LRU (Least Recently Used) caching strategy
- Automatic cache invalidation on file changes
- Size-aware caching with configurable limits
- Cache statistics and performance metrics
- Last read result caching for efficient searches
- Advanced Search
- Regex pattern matching
- Context-aware results with configurable surrounding lines
- File type filtering
- Multi-pattern search support
- Cached result searching
- Exclusion patterns
Installation
Installing via Smithery
To install File Context Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @bsmi021/mcp-file-context-server --client claude
Manual Installation
npm install @modelcontextprotocol/file-context-server
Usage
Starting the Server
npx file-context-server
Available Tools
- list_context_files
- Lists files in a directory with detailed metadata
{
"patadca4f899abbOBSERVED · 2026-10-08Connect
Built from this server's own package name, version and transport as found in its source — not copied from anyone's documentation, so it cannot drift against a page we do not control.
claude mcp add file-context-server -- npx -y [email protected]
{
"mcpServers": {
"file-context-server": {
"command": "npx",
"args": [
"-y",
"[email protected]"
]
}
}
}Exposed tools (8)
7 read · 1 write · 0 destructive.
| Tool | Risk | Description |
|---|---|---|
generate_outline | read | Generate a code outline for a file, showing its structure (classes, functions, imports, etc). Supports TypeScript/JavaScript and Python files. |
getFiles | read | Retrieve multiple files by their paths, returning content and metadata for each file |
get_chunk_count | read | Get the total number of chunks that will be returned for a read_context request.\nUse this tool FIRST before reading content to determine how many chunks you need to request.\nThe parameters should match what you\ |
get_profile_context | read | Get repository context based on current profile settings |
lc-get-files | read | Retrieve specific file contents |
lc-list-modified-files | read | Track file changes since context generation |
search_context | read | Search for patterns in files |
set_profile | write | Set the active profile for context generation |
Trust audit
SAFEgrade B · trust 86/100 Nothing in the source contradicts what it says it does. Grade A is reserved for packages that have also passed the behavioural sandbox.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | WARN |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | PASS |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- none-observed
- Network
- declared (1 observation(s))
- Shell
- none-observed
- Dependencies
- not all pinned
- Secrets in source
- none-found
Findings (13)
console.log(`[HTTP] MCP server listening on http://0.0.0.0:${port}/mcp`);const hash = createHash('md5').update(content).digest('hex');const hash = createHash('md5').update(content).digest('hex');@modelcontextprotocol/sdk, @typescript-eslint/parser, @typescript-eslint/types, chokidar, express, glob, handlebars, lru-cache
- Load environment variables with defaults
load_dotenv() # load environment variables from .env
This creates the beginnings of a .NET console application that can read the API key from user secrets.
curl -LsSf https://astral.sh/uv/install.sh | sh
MCP clients **MUST NOT** send tokens to the MCP server other than ones issued by the MCP server's authorization server.
Client->>+Server: POST InitializedNotification<br>Mcp-Session-Id: 1868a90c...
Client->>+Server: POST ... request ...<br>Mcp-Session-Id: 1868a90c...
Client->>+Server: POST ... notification/response ...<br>Mcp-Session-Id: 1868a90c...
cache/4b648882430d8aad657e9165c33c42a605e7b408d335749f5f401b1eacb7e484.cache
Gates applied: no_behavioural_pass.
adca4f899abbfull audit observations/trust-audit/mcp-server/bsmi021__file-context.json · Report an issue / request a re-scanAudit history
Every audit this server has had. A grade with a past is a grade somebody is still checking.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-08 | adca4f899abb | SAFE | B | 86 | first audit |
Questions
What is the File Context MCP server?
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 tools does File Context expose?
8 in total: 7 read-only, 1 that write, and 0 that can delete or overwrite. Every one is listed on this page with its risk.
Is File Context safe to connect to an agent?
The audit found nothing in the source that contradicts what it says it does, and graded it B (86/100). Grade A is held back for packages that have also passed a sandboxed behavioural run, which is why a clean server reads B.
What credentials does File Context need?
No credential environment variables were found in its source, so it appears to need none.
How does File Context run?
It speaks stdio and streamable-http, so it runs as a local process your client starts. It is published on npm as file-context-server at 1.0.0.
How current is this page?
The grade is for one exact copy of the source (adca4f899abb), read on 2026-10-08. The repository is watched and re-audited when it changes.