Gemini MCP File Agent

by kevingduck

Integrations

  • Provides a secure file management interface for AI, enabling controlled read/write operations and file listing within a sandboxed environment on the local filesystem.

  • Integrates with Google's Gemini AI to enable file access operations, allowing Gemini to read, write, and list files within a designated sandbox directory on the user's local machine.

Gemini MCP 文件代理 (MVP)

该项目让您可以与 Google 的 Gemini AI 聊天,并允许它在特定的受控文件夹(“沙箱”)内安全地读取、写入和列出您计算机上的文件。

它的作用:

  • **mcp_server.py**用于访问文件的本地服务器。你需要指定计算机上哪个文件夹是“沙盒”。
  • 聊天脚本( chat_with_gemini_mcp.pysimple_chat.py :用于与 Gemini 对话的命令行聊天脚本。Gemini 可以使用mcp_server.py管理沙盒中的文件。

**谨慎使用:**这是一个基本示例。请谨慎选择允许mcp_server.py访问的文件夹。

快速入门

  1. **获取文件:**确保所有.py文件都在一个文件夹中。
  2. API密钥:
    • Google AI Studio获取 Google AI API 密钥。
    • 将其设置为环境变量:
      export GOOGLE_API_KEY="YOUR_KEY_HERE"
      (对于 Windows,使用set GOOGLE_API_KEY="YOUR_KEY_HERE"
  3. 安装内容:
    pip install -r requirements.txt
    (或者运行./install_packages.sh
  4. 运行它:
    • 终端 1:启动 MCP 服务器
      python mcp_server.py
      (此操作默认创建并使用./mcp_data_sandbox/文件夹。要使用其他文件夹: python mcp_server.py --sandbox-dir ./my_files
    • 2号航站楼:开始聊天
      python chat_with_gemini_mcp.py
  5. 与双子座聊天:
    • “我的工作文件夹中有哪些文件?”
    • “创建notes.txt并在其中写入‘Hello world’。”
    • “阅读notes.txt 。”

工作原理(简单)

  1. 您与双子座聊天。
  2. 如果您询问文件,Gemini 会告诉您的聊天脚本使用“文件工具”。
  3. 您的聊天脚本告诉mcp_server.py在沙盒文件夹中执行文件操作(读取、写入等)。
  4. 服务器执行此操作并将结果告知聊天脚本。
  5. 聊天脚本告诉 Gemini 结果。
  6. 双子座告诉你发生了什么。

重要的

  • 仅限沙盒: mcp_server.py只能访问你指定为沙盒的文件夹内的文件。这是出于安全考虑。
  • **本地使用:**设计用于在您自己的计算机上运行。

这是探索授予AI文件访问权限的基本工具。请明智地使用它!

-
security - not tested
F
license - not found
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

本地服务器使 Google 的 Gemini AI 能够通过自然语言聊天交互安全地读取、写入和列出计算机上受控沙盒文件夹中的文件。

  1. 快速入门
    1. 工作原理(简单)
      1. 重要的

        Related MCP Servers

        • -
          security
          F
          license
          -
          quality
          A server implementing the Model Context Protocol that enables AI assistants like Claude to interact with Google's Gemini API for text generation, text analysis, and chat conversations.
          Last updated -
          Python
          • Linux
          • Apple
        • -
          security
          -
          license
          -
          quality
          An MCP server implementation that allows using Google's Gemini AI models (specifically Gemini 1.5 Pro) through Claude or other MCP clients via the Model Context Protocol.
          Last updated -
          1
          JavaScript
        • -
          security
          F
          license
          -
          quality
          A Model Context Protocol server that enables Claude Desktop to interact with Google's Gemini 2.5 Pro Experimental AI model, with features like Google Search integration and token usage reporting.
          Last updated -
          JavaScript
        • -
          security
          F
          license
          -
          quality
          A server that provides access to Google Gemini AI capabilities including text generation, image analysis, YouTube video analysis, and web search functionality through the MCP protocol.
          Last updated -
          2
          TypeScript
          • Apple

        View all related MCP servers

        ID: ocxh87chk9