MCP Server
A Model Context Protocol server to automate file operations, project initialization, and command execution β ideal for backend workflows and LLM-based agent integrations.
π FileGen MCP Server
FileGen MCP Server is a lightweight Model Context Protocol (MCP) server built to automate file handling, project initialization, and command execution β enabling seamless integration with LLM-based coding workflows.
π§ Why FileGen?
When LLMs generate code and project structures, the developer often has to manually create folders, files, and paste code β a repetitive and time-consuming process.
FileGen MCP Server eliminates this friction by letting agents or tools directly:
- Create files/folders
- Write and delete content
- Generate project structures
- Execute terminal commands
Itβs the perfect backend utility for building smarter, faster, AI-assisted development pipelines.
β¨ Features
- π Read Files: Read individual files or recursively scan directories.
- ποΈ Initialize Projects: Generate complete directory structures from templates.
- π Write Files: Create or append content to files.
- β Delete Files: Remove unnecessary files or folders.
- π» Execute Commands: Run system commands via Python subprocess.
π οΈ Available Tools
πΉ read_files
Reads one or more files/directories from the local filesystem.
Parameters:
paths
(List[str]): List of file/directory paths to read.
πΉ init_project
Generates a folder/file structure.
Parameters:
name
(str): Project name.path
(str, optional): Base path (default: system root directory).structure
(Dict[str, Any]): Nested dictionary defining folders/files.
πΉ write_file
Creates or appends content to a file.
Parameters:
path
(str): Target file path.content
(str): Content to write.mode
(str, optional):"w"
(overwrite) or"a"
(append). Default:"w"
.
πΉ delete_path
Deletes a file or directory.
Parameters:
path
(str): Target path to delete.
πΉ execute_command
Executes a shell command.
Parameters:
params
(Dict[str, Any]): Command and arguments to execute.
βοΈ Installation
-
Install dependencies:
uv sync
-
Start the server:
uv run python src/main.py
π Bash Script Setup
Use the setup_and_run.sh
script to configure and launch the MCP server in one go.
β Steps:
-
Ensure Python 3 is installed.
-
Make the script executable:
chmod +x setup_and_run.sh
-
Run the script:
./setup_and_run.sh
π§° What It Does:
- Verifies Python and
uv
availability. - Installs
uv
if missing. - Sets up a virtual environment using
uv
. - Installs dependencies from
pyproject.toml
. - Generates a default
config.json
. - Launches the server.
π§© Configuration
A config.json
file is auto-generated when you run the setup script.
To manually integrate with your agent system, ensure the cwd
field points to the correct project directory.
π‘ Tip: Include the project path in your LLM prompt so it knows where to write files.
Example:
{
"mcpServers": {
"project": {
"command": "uv",
"args": ["run", "python", "src/main.py"],
"cwd": "/your/absolute/path/project",
"env": {
"PYTHONPATH": "/your/absolute/path/project/src"
}
}
}
}
π Project Structure
project/
βββ src/
β βββ main.py # MCP server entry point
β βββ actions/
β β βββ read_files.py # Read files/directories
β β βββ init_project.py # Project structure creation
β β βββ delete_file.py # File/folder deletion
β β βββ execute_command.py # System command execution
β βββ schemas/
β βββ project_structure.py # Pydantic models for project
βββ setup_and_run.sh # Bootstrap script