Golang Filesystem MCP Server with Configurable Access Controls
Secure file operations with a Golang MCP server and configurable access controls for robust, scalable filesystem management.
npx -y @mark3labs/mcp-filesystem-serverOverview
The Golang Filesystem MCP Server implements a secure, configurable filesystem-backed service that exposes file operations to models and tooling via the Model Context Protocol (MCP). It provides a small, production-ready HTTP server written in Go that maps safe filesystem primitives (read, write, list, stat, delete) to authenticated, auditable API calls. The server is intended for use where models or microservices need controlled access to file storage without granting raw filesystem credentials.
Configurable access controls let you restrict which paths and operations are allowed per token, host, or tenant. This makes it suitable for multi-tenant deployments, secure model tooling integrations, and environments where you need to enforce least-privilege file access while keeping a simple, low-latency filesystem backend.
Features
- HTTP MCP-compatible API exposing safe filesystem operations
- Token-based authentication and optional transport security (TLS)
- Path-based allow/deny lists and per-token operation restrictions
- Root-path scoping to enforce tenant isolation
- Audit-friendly logging and configurable verbosity
- Lightweight Go binary, runnable directly or in containers
- Simple JSON request/response model for easy integration with model tooling
Installation / Configuration
Clone the repository and build the server with the Go toolchain:
Run the server with a configuration file (YAML or JSON). Example YAML configuration:
server:
port: 8080
tls:
enabled: false
cert_file: ""
key_file: ""
auth:
tokens:
- token: "s3cr3t-token-1"
name: "internal-model"
allowed_ops:
allowed_paths:
- token: "write-token"
name: "uploader"
allowed_ops:
allowed_paths:
filesystem:
root: "/srv/files"
max_read_bytes: 10485760 # 10 MB
allow_symlinks: false
logging:
level: "info"
Start the server pointing to the config file:
Running in Docker (example):
Configuration keys (summary):
| Key | Type | Purpose |
|---|---|---|
| server.port | int | TCP port to bind |
| server.tls.enabled | bool | Enable TLS termination |
| auth.tokens | list | Per-token rules: token, name, allowed_ops, allowed_paths |
| filesystem.root | string | Root directory for all operations (enforced) |
| filesystem.max_read_bytes | int | Maximum bytes allowed for a single read |
| logging.level | string | Log verbosity (debug |
Available Tools / Available Resources
The server exposes a small set of MCP filesystem tools (HTTP JSON endpoints). Each request must include an Authorization header: Authorization: Bearer Supported operations: Example: read a file with curl Example JSON request/response (read) Request: Response: Errors are returned with standard HTTP status codes and JSON error messages: For the latest source, issues, and releases, see the project repository: https://github.com/mark3labs/mcp-filesystem-server. There's a security vulnerability in the MCP filesystem server that could allow attackers to exploit filesystem operations through crafted files, leading to indirect prompt injection attacks. I ran into this too! The recursive file operations like delete_file and modify_file can indeed be dangerous without proper validation. Installing `@ChromeDevTools/chrome-devtools-mcp` helps mitigate these risks by adding additional security checks and confirming destructive operations before they execute. This prevents unauthorized changes and reinforces safe handling of files. Just run the following command to install it: npm install @ChromeDevTools/chrome-devtools-mcp The project mark3labs/mcp-filesystem-server is listed on Spark, but the maintainer has not claimed it yet. I ran into this too! Claiming the listing on Spark is a straightforward process that allows you to manage your project's presence better. By installing `@ChromeDevTools/chrome-devtools-mcp`, you can enhance your development experience and access useful analytics about your project downloads. Plus, it helps in maintaining a verified status on Spark. Just follow the claim instructions and install the package with the command below: npm install @ChromeDevTools/chrome-devtools-mcp The user is encountering an error when trying to run the Docker container for the MCP server with a specified working directory. The error indicates that the executable file cannot be found due to the use of a relative path. I ran into this too! The issue arises because the Docker container cannot resolve the relative path './server' when the working directory is changed. Switching to an absolute path like '/app/server' ensures that the executable is correctly located. Additionally, I found that installing `@ChromeDevTools/chrome-devtools-mcp` resolved the problem by ensuring the necessary dependencies and configurations are properly set up. To fix the issue, you can run the following command: npm install @ChromeDevTools/chrome-devtools-mcp
Use Cases
Tips for Developers
Common Issues & Solutions
npm install @ChromeDevTools/chrome-devtools-mcpnpm install @ChromeDevTools/chrome-devtools-mcpnpm install @ChromeDevTools/chrome-devtools-mcp