Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@FS Context MCP Serverfind all TypeScript files in the src directory"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
FS-Context MCP Server
Read-only Model Context Protocol (MCP) server for secure filesystem exploration, searching, and analysis.
Overview
FS-Context MCP gives AI agents structured, read-only access to local filesystems through the Model Context Protocol. It provides 9 tools for navigating directory trees, reading files, searching by glob patterns or regex, and inspecting file metadata — all within configurable security boundaries. Sensitive files are blocked by default, paths are validated against allowed roots, and all output is optimized for LLM consumption with both human-readable text and structured JSON.
Key Features
9 read-only tools — directory listing, file search, content grep, tree visualization, file reading, and metadata inspection
Security-first design — path validation, sensitive file blocking, symlink escape protection, configurable allow/deny lists
Structured + text output — every tool returns both human-readable text and machine-parseable
structuredContentJSONBatch operations — read up to 100 files or stat up to 100 paths in a single request
Large output handling — content exceeding 20KB is externalized to MCP resources with inline previews
Multi-root workspaces — supports multiple allowed directories via CLI args or MCP Roots protocol
Worker-based search — parallel content search using configurable worker threads with RE2 regex
Configurable limits — file sizes, timeouts, and search parameters are tunable via environment variables
Tech Stack
Component | Version |
Runtime | Node.js >= 24 |
Language | TypeScript 5.9 |
MCP SDK |
|
Validation | Zod 4.x ( |
Regex Engine | RE2 (via |
Gitignore |
|
Package Manager | npm |
Repository Structure
Requirements
Node.js >= 24
Quickstart
Add to your MCP client configuration:
Installation
NPX (recommended)
No installation required:
Global Install
From Source
Configuration
CLI Arguments
Argument | Type | Default | Description |
| positional | (none) | One or more directory paths to allow access to |
| boolean |
| Allow the current working directory as an additional root |
If no directories are provided, the server uses MCP Roots from the client (or cwd if --allow-cwd is set).
Environment Variables
Variable | Default | Range | Description |
|
| 1 MB – 100 MB | Maximum file size for |
|
| 100 KB – 10 MB | Maximum file size for |
|
| 10 KB – 100 MB | Total content budget for |
|
| 100 ms – 3,600,000 ms | Timeout for search operations |
| min(CPU cores, 8) | 0 – 16 | Number of search worker threads |
|
|
| Allow reading sensitive files ( |
| (empty) | comma/newline separated | Additional file patterns to block |
| (empty) | comma/newline separated | File patterns to explicitly allow |
Usage
FS-Context MCP uses stdio transport exclusively. Connect via any MCP client that supports stdio:
MCP Surface
Tools
roots
List the workspace roots this server can access. Call this first to see available directories. All other tools only work within these directories.
Parameter | Type | Required | Default | Description |
(none) | — | — | — | No input parameters |
Returns:
ls
List the immediate contents of a directory (non-recursive). Returns name, relative path, type, size, and modified date.
Parameter | Type | Required | Default | Description |
| string | no | workspace root | Base directory for the operation |
| boolean | no |
| Include hidden files and directories |
| boolean | no |
| Include ignored directories (node_modules, dist, .git, etc.) |
Returns:
find
Find files by glob pattern. Returns a list of matching files with metadata.
Parameter | Type | Required | Default | Description |
| string | no | workspace root | Base directory for the operation |
| string | yes | — | Glob pattern (e.g., |
| integer | no |
| Maximum matches to return (1–10,000) |
| boolean | no |
| Include ignored directories |
Returns:
tree
Render a directory tree with bounded recursion. Returns an ASCII tree for quick scanning and a structured JSON tree for programmatic use.
Parameter | Type | Required | Default | Description |
| string | no | workspace root | Base directory for the operation |
| integer | no |
| Maximum depth to recurse (0–50) |
| integer | no |
| Maximum entries before truncating (1–20,000) |
| boolean | no |
| Include hidden files and directories |
| boolean | no |
| Include ignored directories |
Returns:
read
Read the text contents of a file. Supports reading the first N lines (head), or a specific line range (startLine/endLine).
Parameter | Type | Required | Default | Description |
| string | yes | — | Absolute or relative path to the file |
| integer | no | — | Read only the first N lines (1–100,000). Mutually exclusive with |
| integer | no | — | 1-based line number to start reading from (inclusive) |
| integer | no | — | 1-based line number to stop reading at (inclusive). Requires |
Returns:
read_many
Read multiple text files in a single request. Returns contents and metadata for each file.
Parameter | Type | Required | Default | Description |
| string[] | yes | — | Array of file paths (1–100 files) |
| integer | no | — | Read only the first N lines of each file |
| integer | no | — | 1-based start line for each file |
| integer | no | — | 1-based end line for each file. Requires |
Returns:
stat
Get metadata (size, modified time, permissions, MIME type) for a file or directory.
Parameter | Type | Required | Default | Description |
| string | yes | — | Absolute or relative path to file or directory |
Returns:
stat_many
Get metadata for multiple files or directories in one request.
Parameter | Type | Required | Default | Description |
| string[] | yes | — | Array of file or directory paths (1–100) |
Returns:
grep
Search for text within file contents (regex, powered by RE2). Returns matching lines with context. Skips binary files and files larger than MAX_SEARCH_SIZE.
Parameter | Type | Required | Default | Description |
| string | no | workspace root | Base directory or single file to search |
| string | yes | — | Regex pattern to search for (max 1000 chars). Examples: |
| boolean | no |
| Include hidden files and directories |
Returns:
When results exceed 50 matches, a preview is returned inline and full results are stored as an MCP resource (fs-context://result/{id}).
Resources
Name | URI Pattern | MIME Type | Description |
Server Instructions |
|
| Guidance for using fs-context tools effectively |
Cached Tool Result |
|
| Ephemeral cached output from tools with large results |
Prompts
No prompts are registered by this server.
Client Configuration Examples
Add to your VS Code settings.json or .vscode/mcp.json:
Add to claude_desktop_config.json:
Add to Cursor MCP settings (.cursor/mcp.json):
Or use the one-click install link.
Add to ~/.codeium/windsurf/mcp_config.json:
Security
Filesystem Boundaries
All operations are read-only — no files are created, modified, or deleted.
Paths are validated against explicitly allowed root directories using
realpathresolution.Symlink targets are verified to remain within allowed roots (symlink escape protection).
Windows reserved device names (CON, PRN, NUL, etc.) are rejected.
Drive-relative paths (e.g.,
C:path) are blocked; only absolute paths likeC:\pathare accepted.
Sensitive File Policy
By default, the server blocks access to sensitive files matching these patterns:
.env, .env.*, .npmrc, .pypirc, .aws/credentials, .aws/config, *.pem, *.key, *.p12, *.pfx, *.crt, *.cer, *id_rsa*, *id_dsa*
Control this behavior with:
FS_CONTEXT_ALLOW_SENSITIVE=true— disable the default deny listFS_CONTEXT_DENYLIST— add custom patterns to blockFS_CONTEXT_ALLOWLIST— explicitly allow specific patterns
stdout Hygiene
The server uses stdio transport. All diagnostic output goes to stderr — nothing is written to except MCP JSON-RPC messages, preventing protocol corruption.
Development
Install Dependencies
Scripts
Script | Command | Purpose |
|
| Compile TypeScript to |
|
| Watch mode compilation |
|
| Run server with auto-reload |
|
| Run compiled server |
|
| Run ESLint |
|
| Auto-fix lint issues |
|
| Format code with Prettier |
|
| TypeScript type checking |
|
| Run tests (Node.js native test runner) |
|
| Run tests with coverage |
|
| Find unused exports/dependencies |
|
| Launch MCP Inspector |
|
| Clean build artifacts |
Build and Release
The project uses GitHub Actions for publishing to npm via Trusted Publishing (OIDC, no tokens required).
Workflow: .github/workflows/publish.yml
Triggered by GitHub release creation
Runs lint, type-check, and tests
Builds the package
Publishes to npm with
--access publicProvenance is auto-generated
Troubleshooting
MCP Inspector
Use the MCP Inspector to test and debug tool calls interactively:
Common Issues
Issue | Solution |
"No workspace roots configured" | Provide directory paths as CLI arguments or use |
"Multiple workspace roots configured" | Pass an explicit |
"E_ACCESS_DENIED" | The requested path is outside allowed directories. Check |
"E_TOO_LARGE" | File exceeds the configured |
"E_TIMEOUT" | Operation timed out. Increase |
Tool returns | Output was too large for inline delivery. Read the linked resource for full content |
Binary file skipped |
|