Skip to main content
Glama

Gemini MCP File Agent

by kevingduck

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

        • A
          security
          F
          license
          A
          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 -
          6
          7
          4
          TypeScript
          • Apple
        • A
          security
          A
          license
          A
          quality
          A dedicated server that wraps Google's Gemini AI models in a Model Context Protocol (MCP) interface, allowing other LLMs and MCP-compatible systems to access Gemini's capabilities like content generation, function calling, chat, and file handling through standardized tools.
          Last updated -
          16
          30
          TypeScript
          MIT License
          • Linux
          • Apple
        • -
          security
          F
          license
          -
          quality
          A server that allows interaction with Google's Gemini AI through the Gemini CLI tool using the Model Context Protocol, providing a standardized interface for querying Gemini with various options and configurations.
          Last updated -
          JavaScript
        • A
          security
          F
          license
          A
          quality
          A Model Context Protocol server that enables AI assistants to interact with Google Gemini CLI, allowing them to leverage Gemini's large token window for analyzing files and codebases using natural language commands.
          Last updated -
          4
          1,619
          824
          TypeScript
          • Apple
          • Linux

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/kevingduck/gemini_mcp'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server