Metadata-Version: 2.4
Name: barie-google-drive-mcp
Version: 0.1.4
Summary: Google Drive MCP Server for managing files and folders via the Model Context Protocol
Author-email: Barie <support@barie.ai>
License: MIT
Keywords: google-api,google-drive,mcp,model-context-protocol
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.9
Requires-Dist: google-api-python-client>=2.130.0
Requires-Dist: google-auth-oauthlib>=1.2.0
Requires-Dist: google-auth>=2.29.0
Requires-Dist: mcp>=0.9.0
Requires-Dist: pydantic>=2.0.0
Description-Content-Type: text/markdown

# Google Drive MCP Server

An MCP server for managing files and folders in Google Drive, integrating seamlessly with AI assistants using the Model Context Protocol.

## Features

- **List Files/Folders**: Search and list files with advanced query support.
- **Get Metadata**: Retrieve detailed information about specific files or folders.
- **Manage Folders**: Create new folders and organize content.
- **Organize Content**: Move, copy, and delete (or trash) files.
- **Trash Management**: List trashed items and restore by file ID or name.
- **Export**: Export Google Docs, Sheets, and Slides to formats like PDF or DOCX.

## Installation

### Prerequisites

- Python 3.9 or higher.
- A Google Cloud Project with the Drive API enabled.
- OAuth2 credentials (Client ID and Client Secret).
- OAuth scope: `["https://www.googleapis.com/auth/drive"]`.

### Local Setup

1. Install dependencies:
   ```bash
   pip install -e .
   ```

2. Run the server:
   ```bash
   python main.py --access-token <TOKEN> --refresh-token <REFRESH_TOKEN> --client-id <CLIENT_ID> --client-secret <CLIENT_SECRET>
   ```

## Configuration

Add the following to your MCP host configuration (e.g., `mcp-config.json`):

```json
{
  "mcpServers": {
    "barie-google-drive-mcp": {
      "command": "uvx",
      "args": [
        "barie-google-drive-mcp",
        "--access-token",
        "YOUR_ACCESS_TOKEN",
        "--refresh-token",
        "YOUR_REFRESH_TOKEN",
        "--client-id",
        "YOUR_CLIENT_ID",
        "--client-secret",
        "YOUR_CLIENT_SECRET"
      ]
    }
  }
}
```

## Tools

- `list_files`: Search and list files.
- `get_file_metadata`: Get file details.
- `create_folder`: Create a new folder.
- `delete_file`: Delete or trash a file.
- `move_file`: Move a file to a new folder.
- `copy_file`: Copy a file.
- `export_file`: Export Google Workspace files and return base64 content with metadata.
- `list_trashed_files`: List files/folders currently in trash.
- `restore_file`: Restore trashed files/folders by `fileId` or `name`.

## Restore Tool Behavior

`restore_file` supports two modes:

1. Restore by ID:
```json
{ "fileId": "FILE_ID" }
```

2. Restore by name:
```json
{
  "name": "report",
  "exactMatch": false,
  "restoreAllMatches": false
}
```

Notes:
- Provide either `fileId` or `name`.
- When restoring by name and multiple files match, only the first is restored unless `restoreAllMatches` is `true`.

## License

MIT
