mcp-file-manager
Enables local file management through natural language interactions using the Gemini API, with tools for listing, reading, writing, deleting, and updating files.
README
<p align="center"> <img src="https://capsule-render.vercel.app/api?type=waving&color=0:4285F4,100:34A853&height=200§ion=header&text=MCP File Manager&fontSize=60&fontColor=ffffff&animation=fadeIn" alt="banner" /> </p>
<p align="center"> <img src="https://img.shields.io/badge/Python-3.10%2B-3776AB?logo=python&logoColor=white" alt="Python 3.10+"/> <img src="https://img.shields.io/badge/package%20manager-uv-de5fe9?logo=uv&logoColor=white" alt="uv"/> <img src="https://img.shields.io/badge/protocol-MCP-6E56CF" alt="MCP"/> <img src="https://img.shields.io/badge/LLM-Gemini%20API-4285F4?logo=googlegemini&logoColor=white" alt="Gemini API"/> <img src="https://img.shields.io/badge/license-MIT-informational" alt="MIT License"/> </p>
MCP File Manager
A local Model Context Protocol (MCP) project that lets you manage files on your machine through natural language, powered by the Gemini API (free tier) as the client-side LLM.
The project has two halves that talk to each other over stdio (standard input/output pipes) — no network involved:
server.py— an MCP server exposing file-manipulation tools, read-only resources, and reusable prompts.client.py— a terminal chat client that launches the server as a subprocess, connects to Gemini, and bridges the two: Gemini decides what to do, the server does it.
flowchart LR
U([User]) -->|types message| C[MCP Client<br/>chat loop]
C -->|conversation + tool schema| G[(Gemini API<br/>function calling)]
G -->|final text| C
G -.->|requests a tool call| C
C <-->|JSON-RPC over stdio| S[MCP Server]
S --- T[Tools<br/>list_directory, read_file,<br/>write_file, delete_file, update_file]
S --- R[Resources<br/>file:// attachments via @]
S --- P[Prompts<br/>summarize_file, clean_up_code via /]
style G fill:#4285F4,color:#fff
style S fill:#34A853,color:#fff
style C fill:#111,color:#fff
Features
-
Tools (model-controlled — Gemini decides when to call these):
list_directory— list files/folders in a given pathread_file— read a file's contentswrite_file— create or overwrite a filedelete_file— delete a fileupdate_file— find-and-replace text inside a file (supports replacing all occurrences or just the first)
-
Resources (user-controlled — attach a file to the conversation with
@):file:///{path}— exposes any file's content for direct attachment, no LLM tool call needed
-
Prompts (user-controlled — reusable instruction templates with
/):summarize_file— summarize a file's contentsclean_up_code— review and clean up a code file
-
Interactive chat client:
- Type
/alone to see a numbered picker of available prompts - Type
@alone to see a numbered picker of files in the current directory to attach - Or use them inline:
/summarize_file report.txt,tell me about @report.txt - Full multi-step tool-calling loop — Gemini can chain multiple tool calls per turn
- Type
Requirements
- Python 3.10+
- uv for dependency management
- A free Gemini API key from Google AI Studio
Setup
git clone <your-repo-url>
cd mcp_project
uv venv
# Windows
.venv\Scripts\activate
# macOS/Linux
source .venv/bin/activate
uv sync
Create a .env file in the project root (never commit this file — it's already covered by .gitignore):
GEMINI_API_KEY=add-your-api-key
Usage
Run the client
uv run client.py
You'll see the list of tools the server exposes, then a You: prompt. Try:
You: list files in the current directory
You: create a file called notes.txt with the content "hello world"
You: change hello to goodbye in notes.txt
You: /
1. /summarize_file - Ask the assistant to summarize the contents of a file.
2. /clean_up_code - Ask the assistant to review and clean up a code file.
Pick a number: 1
path: notes.txt
You: @
1. notes.txt
2. server.py
Pick a number: 1
Your message about this file: what's in here?
Type quit or exit to end the session.
Inspect the server directly (debugging)
The MCP Python SDK ships a visual inspector for testing tools/resources/prompts without involving an LLM at all:
uv run mcp dev server.py
Minimal Project structure
mcp-file-manager/
├── .env # your Gemini API key (not committed)
├── pyproject.toml # uv-managed dependencies
├── server.py # MCP server: tools, resources, prompts
├── client.py # MCP client: chat loop + Gemini integration
└── README.md
How it works (short version)
client.pylaunchesserver.pyas a subprocess and opens an MCP session over stdio.- On startup, the client fetches the server's tool list and converts it into Gemini's function-calling schema.
- On each user message, the client sends the conversation + tool list to Gemini.
- If Gemini responds with a function call, the client executes it against the MCP server and feeds the result back to Gemini — repeating until Gemini returns a final text answer.
/and@are handled entirely on the client side (never sent to Gemini as-is) — they fetch a prompt or resource directly from the MCP server and inject the result into the conversation before the normal flow above runs.
Notes & limitations
- This is a local, single-user learning project — the file tools operate with the same permissions as whatever account runs
client.py, so be mindful of what directory you run it from. update_file's find-and-replace is a plain read-modify-write; it isn't safe against concurrent edits to the same file.- The
/command only supports single-argument prompts out of the box; extend_handle_promptif you add multi-argument prompts.
Learn more
License
MIT License.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。