Gemini MCP File Agent
by kevingduck
This project allows you to chat with Google's Gemini AI and enables it to safely interact with files on your computer within a designated sandbox folder. It provides a local server for Gemini to read, write, and list files in a controlled environment.
Last updated: N/A
What is Gemini MCP File Agent?
The Gemini MCP File Agent is a system that allows Google's Gemini AI model to interact with files on a local computer within a defined sandbox environment. It consists of a local server (mcp_server.py
) and chat scripts (chat_with_gemini_mcp.py
, simple_chat.py
) that facilitate communication between the user, Gemini, and the file system.
How to use Gemini MCP File Agent?
- Clone the repository and ensure all
.py
files are in the same folder. 2. Obtain a Google AI API key and set it as an environment variable (GOOGLE_API_KEY
). 3. Install the required Python packages usingpip install -r requirements.txt
. 4. Start themcp_server.py
in one terminal, specifying the sandbox directory if desired. 5. Start the chat script (chat_with_gemini_mcp.py
) in another terminal. 6. Interact with Gemini, asking it to perform file-related actions within the sandbox.
Key features of Gemini MCP File Agent
Controlled File Access
Sandbox Environment
Local Server
Command-Line Interface
Integration with Gemini AI
Use cases of Gemini MCP File Agent
Automated file manipulation via AI
AI-powered content creation
AI-driven data analysis
Experimenting with AI file system interactions
FAQ from Gemini MCP File Agent
What is the purpose of the sandbox?
What is the purpose of the sandbox?
The sandbox restricts Gemini's file access to a specific folder, preventing it from accessing sensitive data outside of that directory.
How do I change the sandbox directory?
How do I change the sandbox directory?
Use the --sandbox-dir
argument when starting the mcp_server.py
script (e.g., python mcp_server.py --sandbox-dir ./my_files
).
Is this safe to use with sensitive data?
Is this safe to use with sensitive data?
Use with caution. This is a basic example. Be careful about which folder you let the mcp_server.py
access. It is designed for local experimentation and not intended for production environments with highly sensitive data.
What file operations can Gemini perform?
What file operations can Gemini perform?
Gemini can read, write, and list files within the sandbox directory.
What if I don't have a Google AI API key?
What if I don't have a Google AI API key?
You need a Google AI API key to use this project. You can obtain one from Google AI Studio.