FI

FileSystem MCP Server for Visual Studio 2022 Workspaces

Enable Visual Studio 2022 workspaces with a local MCP server that gives AI agents selective access to project folders and files.

Overview

This FileSystem MCP (Model Context Protocol) server provides a lightweight local bridge between Visual Studio 2022+ workspaces and AI agents. It exposes a controlled set of filesystem operations so assistants (for example, GitHub Copilot Chat or other MCP-aware tools) can list directories, read files, and—optionally—write files inside explicitly allowed project folders. The server is designed for local development, avoids requiring multi-root workspace files, and can be launched either from pip (installed entrypoint) or from source for debugging.

Use this server when you want an AI assistant to have narrow, auditable access to a project folder without exposing the whole filesystem. It supports cross-platform path separators, restricts file types via allowed extensions, and disables any write operations by default to minimize risk.

Repository: https://github.com/Oncorporation/filesystem_server

Features

  • Directory listing and traversal within configured directories
  • File read operations for allowed file extensions
  • Optional, opt-in file write (text and binary) controlled by configuration
  • Validation checks for configured directories on startup
  • Hybrid configuration: command-line / MCP args with a config.json fallback
  • Visual Studio 2022+ friendly: no-argument startup works for F5 debugging
  • Cross-platform path handling (Windows and Unix-style separators)
  • Explicit security model: access only to listed directories and extensions

Installation / Configuration

Install from PyPI (recommended):

pip install vs-filesystem-mcp-server

Run from source (development):

git clone https://github.com/Oncorporation/filesystem_server.git
cd filesystem_server
# Use Python 3.10+; dependencies can be installed with pip or dev tooling
pip install -r requirements.txt
python app.py

Core configuration file (config.json)

{
  "allowed_dirs": [
    "C:/Users/YourUsername/Documents/projects",
    "D:/projects",
    "D:/Webs"
  ],
  "allowed_extensions": [
    ".py", ".js", ".ts", ".json", ".md", ".txt",
    ".yml", ".yaml", ".toml", ".cfg", ".ini", ".cs",
    ".css", ".scss", ".htm", ".html", ".xml", ".xaml"
  ],
  "allow_write": false
}

Where to place config.json

  • Debugging from source (Visual Studio F5): put config.json next to app.py (project folder).
  • MCP client usage: put config.json alongside your .mcp.json (commonly in your user profile or workspace root) so the MCP client can discover it.

MCP server entries (.mcp.json)

  • If installed via pip:
{
  "servers": {
    "filesystem-server": {
      "command": "vs-filesystem-mcp-server"
    }
  }
}
  • If running from source (point to python + app.py):
{
  "servers": {
    "filesystem-server": {
      "command": "python",
      "args": [
        "/absolute/path/to/filesystem_server/app.py"
      ],
      "cwd": "/absolute/path/to/filesystem_server"
    }
  }
}

Command-line flags (examples)

# Start server using installed entrypoint (reads config.json if present)
vs-filesystem-mcp-server

# Start server from source
python app.py --allow-write

Configuration Key Reference

KeyTypeDescriptionDefault
allowed_dirsarray[string]Absolute paths to directories the server may access[]
allowed_extensionsarray[string]File extensions the server will read/writecommon code & text extensions
allow_writebooleanEnable write tools (opt-in)false

Available Tools / API Surface

Typical MCP tool names exposed by the server (used by MCP clients / agents):

  • init() — Initialize the server and validate configured directories. Run first to detect misconfigurations.
  • list_dir(path) — List files and subfolders under a validated allowed directory.
  • read_file(path) — Return text file contents (subject to allowed_extensions).
  • write_file(path, text) — Write UTF-8 text to a path (requires allow_write = true).
  • write_file_binary(path, base64) — Write binary data (requires allow_write = true).
  • validate_dirs() — Re-check configured directories and permissions.

Note: write_file and write_file_binary are disabled unless allow_write is true in config.json or via an explicit CLI flag.

Use Cases

  • Secure code assistant in Visual Studio 2022: allow Copilot Chat to read project files but keep write disabled until you explicitly opt in.
  • Local QA / refactoring helpers: grant an AI limited access to a single project directory for code analysis and suggestions.
  • Debugging and development: run from source with config.json next to app.py for rapid iteration while debugging in VS2022 (F5).
  • CI or local automation: run as an MCP server process and point CI tools to a specific, mounted workspace directory.

Example: enable read-only AI access for a single repo

  1. Add your repo path to allowed_dirs.
  2. Keep allow_write: false.
  3. Start server via vs-filesystem-mcp-server and invoke init() from the assistant.

Example: enable safe edits

  1. Add paths and required extensions to config.json.
  2. Set allow_write: true.
  3. Limit allowed_dirs to strictly the project subfolders you want the agent to modify.

Notes on Security and Debugging

  • The server enforces directory and extension checks; it does not grant broad filesystem access.
  • Keep config.json location and contents under version control or local policy as appropriate.
  • For Visual Studio debugging, the server accepts a no-argument start and will fall back to the config.json beside app.py for convenience.

For more details and advanced examples, see the project repository: https://github.com/Oncorporation/filesystem_server