Skip to main content
Glama
dakshhgondaliyaa

folder_stats

README.md
# Local MCP: File Management Tools

This is a Model Context Protocol (MCP) server written in Python using the official `mcp` SDK (`FastMCP`). It provides a suite of tools that allows LLMs to retrieve statistics about folders and directly manipulate your local file system.

## Features
- **`get_folder_stats`**: Lists and counts files and subdirectories directly inside the target path (supports recursive counting).
- **`create_folder`**: Creates a new folder (and any necessary parent folders) at the specified path.
- **`edit_file`**: Creates a new file or overwrites an existing file with the provided text content.
- **`delete_path`**: Safely deletes a specific file or folder (and all its contents).
- **Error handling:** Returns clear JSON error messages for invalid paths or permission issues.

## Setup Instructions

1. **Install dependencies:**
   Make sure you have Python installed, then install the required `mcp` package:
   ```bash
   pip install -r requirements.txt
   ```

2. **Test the server (optional):**
   You can run the server directly to make sure it executes without errors. It will wait for MCP JSON-RPC messages via standard input/output.
   ```bash
   python server.py
   ```
   (Press `Ctrl+C` to exit)

## Registering the MCP Server

To use these tools, you need to add the server to your AI editor or chat app configuration.

### 1. Claude Desktop
1. Open your Claude Desktop config file:
   - **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
   - **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
2. Add the following entry. **CRITICAL: You must use the absolute path to your python executable and the absolute path to server.py.**

```json
{
  "mcpServers": {
    "folder-tools": {
      "command": "C:\\Users\\YourUsername\\AppData\\Local\\Programs\\Python\\Python313\\python.exe",
      "args": [
        "D:/absolute/path/to/server.py"
      ]
    }
  }
}
```
*(Make sure to restart Claude Desktop completely for the config to take effect!)*

### 2. VS Code (Cline / Roo Code extensions)
Create a file at `.vscode/cline_mcp_settings.json` in your workspace with the same JSON configuration shown above.

### 3. Antigravity IDE
Register it globally by editing your `~/.gemini/config/mcp_config.json` with the same JSON configuration shown above.

## Example Tool Usage

**Input arguments to `edit_file`:**
```json
{
  "path": "C:\\path\\to\\hello.txt",
  "content": "Hello World!"
}
```

**Output returned (JSON string):**
```json
{
  "success": true,
  "message": "File edited successfully: C:\\path\\to\\hello.txt"
}
```

Maintenance

ActivitySlowing
ResponsivenessNo issues