ahinoam400/ftp-mcp-server
If you are the rightful owner of ftp-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
This project is a Python-based server that combines FTP and MCP functionalities, allowing for file storage, transfer, and multi-purpose cooperative protocol interactions.
FTP MCP Server
This project contains two main components:
- An MCP server with FTP client capabilities.
- A standalone FTP server.
Prerequisites
- Python 3.7+
- pip (Python package installer)
- Node.js and npm (for the Gemini CLI)
Setup
-
Clone the repository (or download the files):
git clone <repository-url> cd ftp-mcp-server -
Create and activate a virtual environment:
-
Windows:
python -m venv .venv .\.venv\Scripts\activate -
Linux/macOS:
python3 -m venv .venv source .venv/bin/activate
-
-
Install the required dependencies:
pip install -r requirements.txt -
Install the Gemini CLI:
npm install -g @google/gemini-cli
How to Use
Connecting from the Gemini CLI
- Start the FTP server:
python ftp_server.py
- The server will be running and listening for connections. The default user credentials are:
- Username:
user - Password:
12345
- Username:
- The user's home directory is
ftp_home/.
-
Configure the Gemini CLI to use the local MCP server:
To make the MCP server discoverable by the Gemini CLI, you need to configure it in the settings.json file. This file tells the Gemini CLI how to find and communicate with the MCP server.
- Locate your Gemini settings file. It's usually at
~/.gemini/settings.json(for Linux/macOS) orC:\Users\<YourUsername>\.gemini\settings.json(for Windows). - If the file or
.geminidirectory doesn't exist, create it. - Open
settings.jsonand add the following configuration. This tells Gemini how to start your local server.
{ "mcpServers": { "my-python-ftp-server": { "command": "<path_to_this_project>/.venv/Scripts/python.exe", "args": ["<path_to_this_project>/server.py"], "type": "stdio" } } } - Locate your Gemini settings file. It's usually at
-
Start Gemini:
- Open a new terminal and run
gemini. - Inside the Gemini CLI, verify the connection with the
/mcpcommand. You should seemy-python-ftp-serverin the list of available servers. - Press Control+T to see details about each of the available tools.
- Open a new terminal and run
-
Interact with your tools: You can use natural language to invoke the tools.
To connect to the default FTP server, type in natural language "Connect to server". Gemini will find the username and password in this README.Example Workflow:
-
You:
Connect to the FTP server. -
Gemini (using the tool):
[tool_code: ftp_connect(server="127.0.0.1", port=2121, user="user", password="12345")] -
You:
List the files on the FTP server. -
Gemini (using the tool):
[tool_code: ftp_list()] -
You:
Please upload "my_local_file.txt" to the server as "remote_copy.txt". -
Gemini (using the tool):
[tool_code: ftp_put(local_path="my_local_file.txt", remote_path="remote_copy.txt")]
-
Connecting to an External FTP Server
The MCP server is not limited to the local FTP server. You can connect to any FTP server by providing the correct details to the ftp_connect tool.
-
Make sure the your FTP server is runing
-
Follow steps 2 and 3 above
-
Use the
ftp_connecttool with the external server's details.Example: If you have a FTP server with the following credentials:
- Host:
ftp.example.com - Username:
myuser - Password:
mypassword123
You would ask Gemini to connect like this:
- You:
Connect to the ftp server at ftp.example.com with username myuser and password mypassword123 - Gemini (using the tool):
[tool_code: ftp_connect(host="ftp.example.com", username="myuser", password="mypassword123")]
Once connected, you will receive a session ID and can use the other FTP tools (
ftp_list,ftp_get, etc.) to interact with the remote server. Free online FTP server to try: https://dlptest.com/ftp-test/ - Host: