MCP File Organizer
Enables AI-driven file organization by listing and moving files into structured folders by extension and modification date, based on natural language requests, without reading file contents.
README
MCP File Organizer — demo for the techblog post "MCP in Practice"
A demo illustrating MCP through the "AI File Organization Assistant" use case: an MCP Server exposing 2 file-management tools (list_files, move_file — no read_file; the server never reads file contents, only file name/extension/modification date), and an MCP Client/Agent using Gemini (via @google/genai, with built-in MCP support through mcpToTool) to decide which tool to call based on the user's natural-language request. folder is any absolute path on the machine (not limited to the demo's storage/inbox — it can point to a real folder such as Downloads), and results always land in <folder>/organized/<extension>/<year>/<month>/<day>/. The demo dataset is 500 mock files accumulated over 365 days, reorganized by extension and then by year/month/day of last modification.
Setup
npm install
Generating mock data
npm run generate-mock # generates 500 mock files into storage/inbox, with mtimes spread across the last 365 days
Rerun this command anytime to generate a fresh dataset.
Running the real Agent (requires a Gemini API key)
client/client.ts is the real Agent: it exposes the MCP client to Gemini via mcpToTool, letting Gemini decide on its own which tool to call and with what arguments (automatic function calling), with no hardcoded rules. It reads the key from GEMINI_API_KEY, or GOOGLE_API_KEY, or API_KEY (in that priority order); it reads the model from MODEL if the value starts with gemini-, otherwise it falls back to the default gemini-2.5-flash.
# PowerShell
$env:GEMINI_API_KEY = "AIza..."
npm run agent
# bash
export GEMINI_API_KEY="AIza..."
npm run agent
These variables can also be set in a .env file in the project directory; npm run agent automatically loads .env if it exists (using Node's --env-file-if-exists flag).
To try it on a real folder instead of storage/inbox, pass an absolute path as an argument, e.g. npm run agent -- "C:\Users\you\Downloads".
Safety when using real data
server.ts already guards against several cases before touching the filesystem:
foldermust be an absolute path — a relative path is rejected immediately, never silently resolved against the server process's cwd.namemust be a bare file name (no/,\, or..) — blocks traversal outsidefolder.to_folderis resolved and then re-checked to ensure it stays within<folder>/organized/— blocks traversal outside via...move_filerefuses if the destination already exists (never silently overwrites); passdry_run: trueto preview what would be moved without touching real files.- Set the
ALLOWED_ROOTSenvironment variable (a list of absolute paths, delimited by;on Windows or:on Unix — followingpath.delimiter) to restrictfolderto those roots only. If unset, the demo keeps its original behavior: accepting any absolute folder — fine for demo purposes, butALLOWED_ROOTSshould be set when pointing at real data.
Structure
server/server.ts MCP Server: list_files, move_file — folder is any absolute path, never reads file contents
client/generate-mock-inbox.ts Generates 500 mock files into storage/inbox
client/client.ts MCP Client + Agent, using Gemini via @google/genai
storage/ Generated by running generate-mock, not committed to the repo
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.