home / mcp / gemini mcp file agent server
Simple chat interface and server for testing Gemini MCP
Configuration
View docs{
"mcpServers": {
"kevingduck-gemini_mcp": {
"command": "python",
"args": [
"mcp_server.py",
"--sandbox-dir",
"./mcp_data_sandbox"
],
"env": {
"GOOGLE_API_KEY": "YOUR_KEY_HERE"
}
}
}
}You set up a local Gemini MCP File Agent to safely access and manage files inside a dedicated sandbox folder from conversations with Gemini. This server handles read, write, and list operations so you can efficiently work with your local files through natural chat commands.
To use the Gemini MCP File Agent, first start the local MCP server and then begin chatting with Gemini. You tell Gemini what to do with files in the sandbox, and the chat scripts translate your requests into file actions that the server performs in the sandbox folder.
Prerequisites you need before installation:
Step-by-step commands:
# 1) Get the project files into one folder containing all Python scripts
# 2) Set up your Google API key for Gemini access
# 3) Install dependencies
pip install -r requirements.txt
# 4) Start the MCP server (default sandbox folder is ./mcp_data_sandbox/)
python mcp_server.py
# Optional: use a different sandbox folder
# python mcp_server.py --sandbox-dir ./my_files
# 5) In a new terminal, start chatting with Gemini via the chat script
python chat_with_gemini_mcp.pySecurity and scope: The MCP server can only operate within the sandbox folder you specify, so ensure that folder contains only files you intend Gemini to access.
Environment variable required by Gemini integration in this flow: Google API Key.
export GOOGLE_API_KEY="YOUR_KEY_HERE" # Linux/macOS
set GOOGLE_API_KEY="YOUR_KEY_HERE" # Windows CMDReads the contents of a file inside the sandbox as requested by Gemini via the chat script.
Writes content to a file inside the sandbox as directed by Gemini through the chat script.
Lists files present in the sandbox folder to inform Gemini about available items.
Launches the MCP server process to initialize and serve file actions to Gemini.