This is a Model Context Protocol (MCP) server that exposes a set of tools for interacting with your local filesystem and running Codex-style developer workflows.
It supports basic file management, patch application, and shell execution inside a sandboxed directory, making it compatible with ChatGPT configured as an MCP server.
shellβ Execute shell commands in a sandboxed directory.apply_patchβ Apply Codex-style multi-file patches (*** Begin Patch/*** Update File:/*** End Patch).
searchβ Search for files or list the root directory.fetchβ Fetch file contents or list directory contents.write_fileβ Write a UTF-8 text file (creates parent dirs if needed).create_directoryβ Create a directory (with parents).delete_fileβ Delete a file or directory (recursive).
Clone this repo and make the script executable:
git clone <your-repo-url>
cd <your-repo>
chmod +x fileSystemMCP.pyRequires Python 3.9+ (tested on 3.10/3.11).
No third-party dependencies are required (uses only the Python standard library).
Run the server, restricted to a chosen working directory:
pip install fastmcp
python3 fileSystemMCP.py /path/to/your/workspaceExample:
python3 fileSystemMCP.py ~/projects/demoYouβll see:
Starting MCP server restricted to: /Users/you/projects/demo
Server URL: http://localhost:8000
SSE URL for ChatGPT: http://localhost:8000/sse/
Server started. Use Ctrl+C to stop.
To use this as an MCP server with ChatGPT (or other cloud-based clients), you need to make it accessible from the internet. The easiest way is with ngrok:
-
Install ngrok and log in.
-
Forward your local server:
ngrok http 8000
-
Youβll see an HTTPS forwarding URL, e.g.:
Forwarding https://88952b488500.ngrok-free.app -> http://localhost:8000Your server is now publicly reachable at that URL.
-
Open ChatGPT settings β Custom MCP Servers.
-
Add a new MCP server with:
- Name:
filesystem - URL: the ngrok HTTPS URL (e.g.
https://88952b488500.ngrok-free.app/sse/) - Capabilities: leave defaults.
- Name:
-
Save and enable.
ChatGPT will now handshake with your MCP server and discover all 7 tools.
-
shellExecute shell commands within the allowed workspace.-
Arguments:
command: string or array of stringsworkdir: working directory (relative or absolute inside allowed root)timeout: optional integer (seconds)
-
Returns: exit code, stdout, stderr, timeout flag (mirrors Codex CLI behavior).
-
-
apply_patchApply a multi-file patch in the Codex*** Begin Patch/*** Update File: <path>/*** End Patchformat.-
Arguments:
patch: string containing one or more patch blocks
-
Returns: list of updated file paths.
-
-
searchSearch for files and directories (or list root if query is empty).-
Arguments:
query: string
-
Returns: up to 20 matches with
id,title,url.
-
-
fetchFetch file contents or list directory contents.-
Arguments:
id: file or directory path (relative or absolute inside allowed root)
-
Returns: file text (if <1 MB) or directory listing, plus metadata.
-
-
write_fileWrite a UTF-8 text file, creating parent directories if needed.-
Arguments:
path: file pathcontent: string
-
Returns: confirmation with size written.
-
-
create_directoryCreate a directory (and parents) inside allowed root.-
Arguments:
path: directory path
-
Returns: confirmation with path.
-
-
delete_fileDelete a file or a directory (recursively).-
Arguments:
path: path to file/directory
-
Returns: confirmation with type of deleted item.
-