google-drive-forge 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. google_drive_forge-0.2.0/.gitignore +32 -0
  2. google_drive_forge-0.2.0/LICENSE +21 -0
  3. google_drive_forge-0.2.0/MANIFEST.in +6 -0
  4. google_drive_forge-0.2.0/PKG-INFO +136 -0
  5. google_drive_forge-0.2.0/README.md +107 -0
  6. google_drive_forge-0.2.0/SKILL.md +78 -0
  7. google_drive_forge-0.2.0/assets/banner.png +0 -0
  8. google_drive_forge-0.2.0/docs/agentic_integration.md +114 -0
  9. google_drive_forge-0.2.0/docs/api_reference.md +71 -0
  10. google_drive_forge-0.2.0/docs/index.md +25 -0
  11. google_drive_forge-0.2.0/docs/quickstart.md +63 -0
  12. google_drive_forge-0.2.0/docs/tool_reference.md +88 -0
  13. google_drive_forge-0.2.0/google_drive_forge/__init__.py +9 -0
  14. google_drive_forge-0.2.0/google_drive_forge/__main__.py +59 -0
  15. google_drive_forge-0.2.0/google_drive_forge/audit.py +37 -0
  16. google_drive_forge-0.2.0/google_drive_forge/auth.py +75 -0
  17. google_drive_forge-0.2.0/google_drive_forge/client.py +140 -0
  18. google_drive_forge-0.2.0/google_drive_forge/executor.py +73 -0
  19. google_drive_forge-0.2.0/google_drive_forge/intelligent_client.py +103 -0
  20. google_drive_forge-0.2.0/google_drive_forge/resources.py +29 -0
  21. google_drive_forge-0.2.0/google_drive_forge/skill_loader.py +65 -0
  22. google_drive_forge-0.2.0/google_drive_forge/tools.py +324 -0
  23. google_drive_forge-0.2.0/pyproject.toml +46 -0
  24. google_drive_forge-0.2.0/requirements.txt +7 -0
  25. google_drive_forge-0.2.0/scripts/.keep +0 -0
  26. google_drive_forge-0.2.0/scripts/batch_download.py +72 -0
  27. google_drive_forge-0.2.0/scripts/download_file.py +68 -0
  28. google_drive_forge-0.2.0/scripts/move_files.py +99 -0
  29. google_drive_forge-0.2.0/scripts/verify_structure.py +58 -0
  30. google_drive_forge-0.2.0/server.py +11 -0
  31. google_drive_forge-0.2.0/skills/.keep +0 -0
  32. google_drive_forge-0.2.0/skills/auto_archive/SKILL.md +8 -0
  33. google_drive_forge-0.2.0/skills/auto_archive/script.py +53 -0
@@ -0,0 +1,32 @@
1
+ # General
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ .DS_Store
6
+
7
+ # Virtual environments
8
+ venv/
9
+ venv_new/
10
+ .env
11
+ .venv
12
+
13
+ # Distribution / Build
14
+ dist/
15
+ build/
16
+ *.egg-info/
17
+
18
+ # Sensitive Data / Credentials
19
+ credentials.json
20
+ token.json
21
+ client_secret*.json
22
+ service_account.json
23
+
24
+ # Logs
25
+ *.log
26
+ logs/
27
+ audit_logs/
28
+
29
+ # Backups and temporary files
30
+ src_backup/
31
+ *.bak
32
+ *.swp
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Google Drive Forge Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ include README.md
2
+ include LICENSE
3
+ include SKILL.md
4
+ include pyproject.toml
5
+ recursive-include docs *
6
+ recursive-include google_drive_forge/assets *
@@ -0,0 +1,136 @@
1
+ Metadata-Version: 2.4
2
+ Name: google-drive-forge
3
+ Version: 0.2.0
4
+ Summary: Autonomous Google Drive MCP with Skill Forge Capabilities
5
+ Project-URL: Homepage, https://github.com/traylinx/google_drive_forge
6
+ Project-URL: Repository, https://github.com/traylinx/google_drive_forge
7
+ Project-URL: Documentation, https://github.com/traylinx/google_drive_forge#readme
8
+ Author-email: Sebastian Velandia <sebastian@traylinx.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: agentic,ai,automation,google-drive,mcp,skill-forge
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: google-api-python-client
22
+ Requires-Dist: google-auth
23
+ Requires-Dist: google-auth-httplib2
24
+ Requires-Dist: google-auth-oauthlib
25
+ Requires-Dist: mcp
26
+ Requires-Dist: pyyaml
27
+ Requires-Dist: tenacity
28
+ Description-Content-Type: text/markdown
29
+
30
+ <div align="center">
31
+ <img src="assets/banner.png" width="250" alt="Google Drive Forge Icon">
32
+ <h1>Google Drive Forge</h1>
33
+ </div>
34
+
35
+ [![MCP](https://img.shields.io/badge/MCP-Protocol-blue.svg)](https://modelcontextprotocol.io)
36
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
37
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
38
+
39
+ Transform your AI agent from a simple file explorer into an **Autonomous Power-User**. This isn't just a Google Drive connector; it's a cognitive layer for your cloud storage.
40
+
41
+ ---
42
+
43
+ ## 💎 The "Intelligent" Edge
44
+
45
+ Most MCP servers just list files. This one **reasons** about them.
46
+
47
+ | Feature | Description | Benefit |
48
+ | :------------------ | :-------------------------------------------------------- | :-------------------------------------------------------------- |
49
+ | **🔨 The Forge** | On-the-fly Python "Skill" creation and execution. | Solve complex tasks like "Archive all PDFs older than 30 days". |
50
+ | **🩹 Path Healing** | Fuzzy, human-like path resolution (e.g., `/Work/Drafts`). | No more hunting for obscure File IDs. |
51
+ | **🧠 Auto-Recovery** | Intercepts 404s and suggests correct paths/files. | Agent remains autonomous even when it makes mistakes. |
52
+ | **🔍 Smart Read** | Auto-detection of MIME types and content conversion. | Seamless interaction with Sheets, Docs, and PDFs. |
53
+ | **📜 Audit Log** | Transparent tracking of all autonomous decisions. | Complete visibility into what your agent is doing. |
54
+
55
+ ---
56
+
57
+ ## 🛠 Features Breakdown
58
+
59
+ ### 📂 Standard Operations
60
+ - **Discovery**: `list_files`, `search_files`, `list_folder`.
61
+ - **Management**: `create_folder`, `upload_file`, `trash_file`.
62
+ - **Metadata**: Deep metadata inspection for any file object.
63
+
64
+ ### ⚡ The Forge (Agent Skills)
65
+ Empower your agent to expand its own capabilities. Using the [Agent Skills](https://agentskills.io) standard, the agent can:
66
+ - **`create_skill`**: Write Python logic to perform multi-step Drive operations.
67
+ - **`list_skills`**: Browse its library of forged capabilities.
68
+ - **`run_skill`**: Execute its custom logic with full API access.
69
+
70
+ ### 🧭 Autonomous Navigation
71
+ - **`resolve_path`**: Converts `/Project/2026/Budget.xlsx` into a working ID, healing broken paths automatically.
72
+ - **`smart_read`**: A high-level tool that handles resolution, downloading, and decoding in one step.
73
+
74
+ ---
75
+
76
+ ## � Getting Started
77
+
78
+ ### 1. Requirements
79
+ - Python 3.10 or higher.
80
+ - A Google Cloud Project with the **Drive API** enabled.
81
+
82
+ ### 2. Deep Dive Into Setup
83
+ For a step-by-step walkthrough on generating your `credentials.json` and `token.json`, please refer to our:
84
+ 👉 **[Comprehensive Setup Guide](docs/setup.md)**
85
+
86
+ ### 3. Quick Configuration
87
+ Add this to your MCP host configuration (e.g., Antigravity):
88
+
89
+ ```json
90
+ "google-drive": {
91
+ "command": "python",
92
+ "args": ["/path/to/server.py"],
93
+ "env": {
94
+ "GOOGLE_DRIVE_CREDENTIALS": "/path/to/credentials.json",
95
+ "GOOGLE_DRIVE_HEADLESS_AUTH": "false",
96
+ "GOOGLE_DRIVE_PYTHON_PATH": "/usr/bin/python3"
97
+ }
98
+ }
99
+ ```
100
+
101
+ #### ⚙️ Environment Variables
102
+ | Variable | Description | Default |
103
+ | :--------------------------- | :------------------------------------------------ | :------------------- |
104
+ | `GOOGLE_DRIVE_CREDENTIALS` | Path to your `credentials.json`. | `./credentials.json` |
105
+ | `GOOGLE_DRIVE_HEADLESS_AUTH` | Set to `true` for console-based OAuth on servers. | `false` |
106
+ | `GOOGLE_DRIVE_PYTHON_PATH` | Path to a specific Python executable or venv. | `sys.executable` |
107
+ | `GOOGLE_DRIVE_SKILLS_DIR` | Where to store forged AI Skills. | `./skills` |
108
+
109
+ ---
110
+
111
+ ## 🛡️ Security Implications
112
+
113
+ **Please Read Carefully:**
114
+ This MCP server implements **The Forge**, which allows AI agents to write and execute arbitrary Python code on your machine.
115
+ * **Local Use Only**: This tool is designed for local power-users.
116
+ * **Sandbox**: It does not currently implement a sandbox for executed scripts. Only use it with agents you trust to handle your local filesystem.
117
+
118
+ ---
119
+
120
+ ## Contributing & Extension
121
+
122
+ We believe in open autonomy. If you have ideas for new core skills or improvements to the path-healing engine:
123
+ 1. Check the [Contributing Guide](CONTRIBUTING.md).
124
+ 2. Explore the `skills/` directory for examples of forged logic.
125
+ 3. Submit a PR!
126
+
127
+ ---
128
+
129
+ ## ⚖️ License
130
+
131
+ Distributed under the **MIT License**. See `LICENSE` for more information.
132
+
133
+ ---
134
+ <p align="center">
135
+ Built with ❤️ for the next generation of AI Agents.
136
+ </p>
@@ -0,0 +1,107 @@
1
+ <div align="center">
2
+ <img src="assets/banner.png" width="250" alt="Google Drive Forge Icon">
3
+ <h1>Google Drive Forge</h1>
4
+ </div>
5
+
6
+ [![MCP](https://img.shields.io/badge/MCP-Protocol-blue.svg)](https://modelcontextprotocol.io)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
9
+
10
+ Transform your AI agent from a simple file explorer into an **Autonomous Power-User**. This isn't just a Google Drive connector; it's a cognitive layer for your cloud storage.
11
+
12
+ ---
13
+
14
+ ## 💎 The "Intelligent" Edge
15
+
16
+ Most MCP servers just list files. This one **reasons** about them.
17
+
18
+ | Feature | Description | Benefit |
19
+ | :------------------ | :-------------------------------------------------------- | :-------------------------------------------------------------- |
20
+ | **🔨 The Forge** | On-the-fly Python "Skill" creation and execution. | Solve complex tasks like "Archive all PDFs older than 30 days". |
21
+ | **🩹 Path Healing** | Fuzzy, human-like path resolution (e.g., `/Work/Drafts`). | No more hunting for obscure File IDs. |
22
+ | **🧠 Auto-Recovery** | Intercepts 404s and suggests correct paths/files. | Agent remains autonomous even when it makes mistakes. |
23
+ | **🔍 Smart Read** | Auto-detection of MIME types and content conversion. | Seamless interaction with Sheets, Docs, and PDFs. |
24
+ | **📜 Audit Log** | Transparent tracking of all autonomous decisions. | Complete visibility into what your agent is doing. |
25
+
26
+ ---
27
+
28
+ ## 🛠 Features Breakdown
29
+
30
+ ### 📂 Standard Operations
31
+ - **Discovery**: `list_files`, `search_files`, `list_folder`.
32
+ - **Management**: `create_folder`, `upload_file`, `trash_file`.
33
+ - **Metadata**: Deep metadata inspection for any file object.
34
+
35
+ ### ⚡ The Forge (Agent Skills)
36
+ Empower your agent to expand its own capabilities. Using the [Agent Skills](https://agentskills.io) standard, the agent can:
37
+ - **`create_skill`**: Write Python logic to perform multi-step Drive operations.
38
+ - **`list_skills`**: Browse its library of forged capabilities.
39
+ - **`run_skill`**: Execute its custom logic with full API access.
40
+
41
+ ### 🧭 Autonomous Navigation
42
+ - **`resolve_path`**: Converts `/Project/2026/Budget.xlsx` into a working ID, healing broken paths automatically.
43
+ - **`smart_read`**: A high-level tool that handles resolution, downloading, and decoding in one step.
44
+
45
+ ---
46
+
47
+ ## � Getting Started
48
+
49
+ ### 1. Requirements
50
+ - Python 3.10 or higher.
51
+ - A Google Cloud Project with the **Drive API** enabled.
52
+
53
+ ### 2. Deep Dive Into Setup
54
+ For a step-by-step walkthrough on generating your `credentials.json` and `token.json`, please refer to our:
55
+ 👉 **[Comprehensive Setup Guide](docs/setup.md)**
56
+
57
+ ### 3. Quick Configuration
58
+ Add this to your MCP host configuration (e.g., Antigravity):
59
+
60
+ ```json
61
+ "google-drive": {
62
+ "command": "python",
63
+ "args": ["/path/to/server.py"],
64
+ "env": {
65
+ "GOOGLE_DRIVE_CREDENTIALS": "/path/to/credentials.json",
66
+ "GOOGLE_DRIVE_HEADLESS_AUTH": "false",
67
+ "GOOGLE_DRIVE_PYTHON_PATH": "/usr/bin/python3"
68
+ }
69
+ }
70
+ ```
71
+
72
+ #### ⚙️ Environment Variables
73
+ | Variable | Description | Default |
74
+ | :--------------------------- | :------------------------------------------------ | :------------------- |
75
+ | `GOOGLE_DRIVE_CREDENTIALS` | Path to your `credentials.json`. | `./credentials.json` |
76
+ | `GOOGLE_DRIVE_HEADLESS_AUTH` | Set to `true` for console-based OAuth on servers. | `false` |
77
+ | `GOOGLE_DRIVE_PYTHON_PATH` | Path to a specific Python executable or venv. | `sys.executable` |
78
+ | `GOOGLE_DRIVE_SKILLS_DIR` | Where to store forged AI Skills. | `./skills` |
79
+
80
+ ---
81
+
82
+ ## 🛡️ Security Implications
83
+
84
+ **Please Read Carefully:**
85
+ This MCP server implements **The Forge**, which allows AI agents to write and execute arbitrary Python code on your machine.
86
+ * **Local Use Only**: This tool is designed for local power-users.
87
+ * **Sandbox**: It does not currently implement a sandbox for executed scripts. Only use it with agents you trust to handle your local filesystem.
88
+
89
+ ---
90
+
91
+ ## Contributing & Extension
92
+
93
+ We believe in open autonomy. If you have ideas for new core skills or improvements to the path-healing engine:
94
+ 1. Check the [Contributing Guide](CONTRIBUTING.md).
95
+ 2. Explore the `skills/` directory for examples of forged logic.
96
+ 3. Submit a PR!
97
+
98
+ ---
99
+
100
+ ## ⚖️ License
101
+
102
+ Distributed under the **MIT License**. See `LICENSE` for more information.
103
+
104
+ ---
105
+ <p align="center">
106
+ Built with ❤️ for the next generation of AI Agents.
107
+ </p>
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: google-drive-mcp
3
+ description: "Autonomous Google Drive management with intelligent path resolution, auto-recovery, and custom skill forging. Use when Claude needs to work with cloud storage for tasks like: (1) Navigating complex folder structures with human-like paths (/Work/Projects/2026), (2) Reading and converting content from Docs, Sheets, and PDFs, (3) Automating multi-step Drive operations by creating and running custom Python 'Skills', (4) Managing files (upload, search, trash)."
4
+ ---
5
+
6
+ # Google Drive Forge - The Autonomous Skill System
7
+
8
+ **Google Drive Forge** (formerly google-drive-mcp) is an advanced autonomous system for interacting with Google Drive.
9
+ It goes beyond simple file storage by implementing **AI-Forged Skills**—short, single-purpose Python scripts that can be created, executed, and refined by the AI itself.
10
+
11
+ ## 1. System Components
12
+
13
+ * **Google Drive Forge Server**: The core MCP process.
14
+ * **The Forge (Skill System)**: A runtime for creating (`create_skill`) and running (`run_skill`) Python scripts.
15
+ * **IntelligentDriveClient (ForgeClient)**: A smart wrapper around the Drive API that handles:
16
+ * **Self-Healing Paths**: Automatically finds files even if your path is slightly wrong (e.g., misremembered folder name).
17
+ * **Autonomous MIME Handling**: Automatically exports Google Docs to Markdown/Text when you try to read them.
18
+ * **Error Recovery**: Retries transient faults.spelled, it attempts "Self-Healing" to find the closest match.
19
+ - **`smart_read`**: A high-level tool that resolves a path, downloads the content, and converts it to text (Decodes Google Docs, Sheets, and PDFs automatically) in one step.
20
+
21
+ ### 2. Standard File Management
22
+
23
+ Comprehensive control over the Drive filesystem.
24
+
25
+ - **`list_files` / `list_folder`**: Discover recent files or explore specific directories.
26
+ - **`search_files`**: Finds files by name or content properties.
27
+ - **`create_folder` / `upload_file` / `trash_file`**: Manage the lifecycle of your storage.
28
+
29
+ ### 3. The Forge (Autonomous Skills)
30
+
31
+ Empower Claude to expand its own capabilities by writing and executing Python logic directly on the Drive API.
32
+
33
+ - **`create_skill`**: Design a custom script for complex tasks (e.g., "Archive all files older than 30 days").
34
+ - **`run_skill`**: Execute a forged capability with parameters.
35
+ - **`list_skills`**: View the library of existing capabilities Claude has learned.
36
+
37
+ ## Common Workflows
38
+
39
+ ### Organizing Files
40
+
41
+ When a user asks to "Organize the social media folder", use `list_folder` to find the content, `create_folder` for new categories, and `run_skill` (or basic `update`) to move them.
42
+
43
+ ### Reading Complex Documents
44
+
45
+ For Google Docs or PDFs, always prefer `smart_read`. It handles the export MIME-types automatically so you get clean markdown/text. If `smart_read` returns binary content for a PDF, you may need to download it to process it locally.
46
+
47
+ ### Downloading Files to Project
48
+
49
+ To save a file from Drive to the user's local project (e.g., to `jevelabsblog/drafts/skills`), use **`download_to_local`**.
50
+ - It automatically converts Google Docs to Markdown/Text.
51
+ - It accepts an absolute path (e.g., `/Users/sebastian/Projects/...`).
52
+ - **Usage**: `download_to_local(file_id="...", local_path="/absolute/path/to/blog_post.md")`
53
+
54
+ ### Creating Automations
55
+
56
+ If a task is repetitive (like "Sync all new PDFs to a specific folder"), use `create_skill` to write a Python script that uses the `IntelligentDriveClient`. This is more token-efficient than doing it step-by-step for every file.
57
+
58
+ ## Resources
59
+
60
+ ### scripts/
61
+
62
+ The `scripts/` directory contains utility examples that can be used as templates for "The Forge". They are now dynamic and can be adapted for any workflow:
63
+
64
+ - **`move_files.py`**: Generic bulk mover.
65
+ - Usage: `python scripts/move_files.py <source_folder> <dest_folder> [--create-dest]`
66
+ - Example: `python scripts/move_files.py "Downloads" "Archive/2025" --create-dest`
67
+
68
+ - **`batch_download.py`**: Generic folder syncer.
69
+ - Usage: `python scripts/batch_download.py <drive_folder_name> <local_dest_path>`
70
+ - Example: `python scripts/batch_download.py "Project Assets" "./assets"`
71
+
72
+ - **`download_file.py`**: Single file downloader (Auto-converts Docs to Markdown).
73
+ - Usage: `python scripts/download_file.py <file_id> <dest_path>`
74
+ - Example: `python scripts/download_file.py "12345abcde" "./docs/spec.md"`
75
+
76
+ ### references/
77
+
78
+ - `api_reference.md`: Detailed documentation of the internal `IntelligentDriveClient` used by the AI-forged skills.
@@ -0,0 +1,114 @@
1
+ # Agentic App Integration Guide
2
+
3
+ This guide explains how to use `google_drive_forge` as a library in your own Python applications and agents.
4
+
5
+ ---
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ # From source
11
+ pip install -e /path/to/mcp/google_drive/
12
+
13
+ # From git
14
+ pip install git+https://github.com/your-org/google-drive-forge.git
15
+ ```
16
+
17
+ ---
18
+
19
+ ## Example: Simple File Lister
20
+
21
+ ```python
22
+ from google_drive_forge import ForgeClient
23
+
24
+ def main():
25
+ client = ForgeClient()
26
+
27
+ print("Recent files:")
28
+ for f in client.list_files(limit=5):
29
+ print(f" - {f['name']} ({f['id']})")
30
+
31
+ if __name__ == "__main__":
32
+ main()
33
+ ```
34
+
35
+ ---
36
+
37
+ ## Example: Downloading Docs to Local
38
+
39
+ ```python
40
+ from google_drive_forge import IntelligentDriveClient
41
+ import os
42
+
43
+ def download_folder_as_markdown(folder_path: str, local_dir: str):
44
+ """
45
+ Downloads all Google Docs from a Drive folder to a local directory as Markdown.
46
+ """
47
+ client = IntelligentDriveClient()
48
+ os.makedirs(local_dir, exist_ok=True)
49
+
50
+ # Resolve the folder path to an ID
51
+ folder_id = client.find_and_heal_path(folder_path)
52
+ if not folder_id:
53
+ print(f"Error: Could not find folder '{folder_path}'")
54
+ return
55
+
56
+ # List files in the folder
57
+ files = client.list_folder_children(folder_id)
58
+
59
+ for f in files:
60
+ if f['mimeType'] == 'application/vnd.google-apps.document':
61
+ content = client.download_file(f['id'], export_mime_type='text/plain')
62
+ local_path = os.path.join(local_dir, f['name'] + ".md")
63
+ with open(local_path, 'wb') as out:
64
+ out.write(content)
65
+ print(f"Saved: {local_path}")
66
+
67
+ if __name__ == "__main__":
68
+ download_folder_as_markdown("/socialMedia/skills", "./local_skills")
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Example: Running a Forged Skill
74
+
75
+ ```python
76
+ from google_drive_forge import ScriptExecutor
77
+
78
+ def main():
79
+ executor = ScriptExecutor(
80
+ python_path="/path/to/venv/bin/python",
81
+ skills_dir="/path/to/mcp/google_drive/skills"
82
+ )
83
+
84
+ # Run an existing skill
85
+ output = executor.run_skill("auto_archive", args=["--days", "30"])
86
+ print(output)
87
+
88
+ if __name__ == "__main__":
89
+ main()
90
+ ```
91
+
92
+ ---
93
+
94
+ ## Architecture Overview
95
+
96
+ ```
97
+ ┌─────────────────────────────────────────────────────────────┐
98
+ │ Your Agentic App │
99
+ │ (e.g., chatbot, automation script, AI workflow) │
100
+ └───────────────────────────┬─────────────────────────────────┘
101
+ │ imports
102
+
103
+ ┌─────────────────────────────────────────────────────────────┐
104
+ │ google_drive_forge │
105
+ │ ┌───────────────────┐ ┌───────────────┐ ┌─────────────┐ │
106
+ │ │ IntelligentClient │ │ ScriptExecutor│ │ SkillLoader │ │
107
+ │ │ (Drive API) │ │ (The Forge) │ │ (Discovery) │ │
108
+ │ └─────────┬─────────┘ └───────┬───────┘ └──────┬──────┘ │
109
+ │ │ │ │ │
110
+ │ └───────────────────┼─────────────────┘ │
111
+ │ ▼ │
112
+ │ Google Drive API │
113
+ └─────────────────────────────────────────────────────────────┘
114
+ ```
@@ -0,0 +1,71 @@
1
+ # API Reference
2
+
3
+ This document describes the public Python API for the `google_drive_forge` package.
4
+
5
+ ---
6
+
7
+ ## `ForgeClient` (alias: `IntelligentDriveClient`)
8
+
9
+ The primary client for interacting with Google Drive. Extends `DriveClient` with autonomous features.
10
+
11
+ ```python
12
+ from google_drive_forge import ForgeClient
13
+
14
+ client = ForgeClient(audit=None) # audit: Optional[AuditLogger]
15
+ ```
16
+
17
+ ### Methods
18
+
19
+ | Method | Description |
20
+ | ----------------------------------------------- | ----------------------------------------------------------------------------------------- |
21
+ | `list_files(query=None, limit=10)` | List files. Returns `List[Dict]`. |
22
+ | `search(text, limit=20)` | Search files by name. Returns `List[Dict]`. |
23
+ | `get_file_metadata(file_id)` | Get detailed metadata. Returns `Dict`. |
24
+ | `download_file(file_id, export_mime_type=None)` | Download file content. Returns `bytes`. |
25
+ | `create_folder(name, parent_id='root')` | Create a folder. Returns `Dict`. |
26
+ | `upload_file(name, content, parent_id='root')` | Upload a file. Returns `Dict`. |
27
+ | `trash_file(file_id)` | Move file to trash. Returns `Dict`. |
28
+ | `list_folder_children(folder_id, limit=100)` | List children of a folder. Returns `List[Dict]`. |
29
+ | `find_and_heal_path(path)` | Resolve a human-readable path to a file ID with auto-correction. Returns `str` or `None`. |
30
+
31
+ ---
32
+
33
+ ## `ScriptExecutor`
34
+
35
+ Runs Python scripts (skills) in a subprocess.
36
+
37
+ ```python
38
+ from google_drive_forge import ScriptExecutor
39
+
40
+ executor = ScriptExecutor(python_path="/path/to/python", skills_dir="/path/to/skills")
41
+ ```
42
+
43
+ ### Methods
44
+
45
+ | Method | Description |
46
+ | ---------------------------------- | ----------------------------------------------- |
47
+ | `run_skill(skill_name, args=None)` | Execute a skill script. Returns `str` (stdout). |
48
+
49
+ ---
50
+
51
+ ## `SkillLoader`
52
+
53
+ Discovers and manages AI-forged skills.
54
+
55
+ ```python
56
+ from google_drive_forge import SkillLoader
57
+
58
+ loader = SkillLoader(skills_dir="/path/to/skills")
59
+ ```
60
+
61
+ ### Methods
62
+
63
+ | Method | Description |
64
+ | ------------------- | ---------------------------------------------------- |
65
+ | `discover_skills()` | Returns a `List[SkillMeta]` of all available skills. |
66
+
67
+ ---
68
+
69
+ ## `DriveClient`
70
+
71
+ The base client without autonomous features. Use `IntelligentDriveClient` for most cases.
@@ -0,0 +1,25 @@
1
+ # Google Drive Forge Documentation
2
+
3
+ Welcome to the documentation for **Google Drive Forge** (formerly Google Drive MCP).
4
+
5
+ ## Contents
6
+
7
+ | Document | Description |
8
+ | --------------------------------------------- | ---------------------------------------------- |
9
+ | [Quick Start](quickstart.md) | Setup guide for MCP Server and Python library. |
10
+ | [API Reference](api_reference.md) | Python classes and methods for library usage. |
11
+ | [Tool Reference](tool_reference.md) | MCP tools exposed to AI agents. |
12
+ | [Agentic Integration](agentic_integration.md) | Examples for embedding in your own apps. |
13
+
14
+ ## Overview
15
+
16
+ This project provides two ways to interact with Google Drive:
17
+
18
+ 1. **MCP Server**: Exposes tools for AI IDEs like Cursor and Claude Desktop.
19
+ 2. **Agentic Library**: Embed `google_drive_forge` into your own agentic workflows.
20
+
21
+ ## Quick Links
22
+
23
+ - **Main Entry Point (MCP)**: `server.py` or `python -m google_drive_forge`
24
+ - **Package Name**: `google_drive_forge`
25
+ - **Key Classes**: `ForgeClient`, `ScriptExecutor`, `SkillLoader`
@@ -0,0 +1,63 @@
1
+ # Google Drive Forge - Quick Start
2
+
3
+ ## Overview
4
+
5
+ **Google Drive Forge** provides two integration modes:
6
+
7
+ 1. **MCP Server**: For AI IDEs like Cursor and Claude Desktop.
8
+ 2. **Agentic Library**: For embedding into your own Python apps.
9
+
10
+ ---
11
+
12
+ ## 1. MCP Server Setup
13
+
14
+ Add the following to your MCP configuration file:
15
+
16
+ ```json
17
+ {
18
+ "mcpServers": {
19
+ "google-drive-forge": {
20
+ "command": "/path/to/venv/bin/python3",
21
+ "args": [
22
+ "-m",
23
+ "google_drive_forge"
24
+ ],
25
+ "env": {
26
+ "GOOGLE_DRIVE_CREDENTIALS": "/path/to/credentials.json",
27
+ "GOOGLE_DRIVE_HEADLESS_AUTH": "true"
28
+ }
29
+ }
30
+ }
31
+ }
32
+ ```
33
+
34
+ ### Environment Variables
35
+
36
+ | Variable | Description |
37
+ | ---------------------------- | ------------------------------------- |
38
+ | `GOOGLE_DRIVE_CREDENTIALS` | Path to `credentials.json`. |
39
+ | `GOOGLE_DRIVE_HEADLESS_AUTH` | Set to `"true"` for headless servers. |
40
+
41
+ ---
42
+
43
+ ## 2. Python Library Setup
44
+
45
+ Install the package:
46
+
47
+ ```bash
48
+ pip install git+https://github.com/your-org/google-drive-forge.git
49
+ ```
50
+
51
+ ### Basic Usage
52
+
53
+ ```python
54
+ from google_drive_forge import ForgeClient
55
+
56
+ # Initialize
57
+ client = ForgeClient()
58
+
59
+ # List files
60
+ files = client.list_files(limit=10)
61
+ ```
62
+
63
+ See [api_reference.md](api_reference.md) for full API details.