home / mcp / gemini mcp file agent server

Gemini MCP File Agent Server

Simple chat interface and server for testing Gemini MCP

Installation
Add the following to your MCP client configuration file.

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.

How to use

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.

How to install

Prerequisites you need before installation:

  • Python 3.8+ must be installed on your system
  • pip must be available to install dependencies

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.py

Additional notes

Security 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.

Configuration and environment

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 CMD

Available tools

read_file

Reads the contents of a file inside the sandbox as requested by Gemini via the chat script.

write_file

Writes content to a file inside the sandbox as directed by Gemini through the chat script.

list_files

Lists files present in the sandbox folder to inform Gemini about available items.

start_server

Launches the MCP server process to initialize and serve file actions to Gemini.