agent2drive 0.4.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.
- agent2drive-0.4.0/LICENSE +21 -0
- agent2drive-0.4.0/PKG-INFO +169 -0
- agent2drive-0.4.0/README.md +120 -0
- agent2drive-0.4.0/agent2drive.egg-info/PKG-INFO +169 -0
- agent2drive-0.4.0/agent2drive.egg-info/SOURCES.txt +13 -0
- agent2drive-0.4.0/agent2drive.egg-info/dependency_links.txt +1 -0
- agent2drive-0.4.0/agent2drive.egg-info/entry_points.txt +3 -0
- agent2drive-0.4.0/agent2drive.egg-info/requires.txt +8 -0
- agent2drive-0.4.0/agent2drive.egg-info/top_level.txt +2 -0
- agent2drive-0.4.0/agent2drive.py +669 -0
- agent2drive-0.4.0/agent2drive_mcp.py +224 -0
- agent2drive-0.4.0/pyproject.toml +39 -0
- agent2drive-0.4.0/setup.cfg +4 -0
- agent2drive-0.4.0/tests/test_agent2drive.py +257 -0
- agent2drive-0.4.0/tests/test_agent2drive_mcp.py +107 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ansari Bilal
|
|
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,169 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent2drive
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: One command connects an agent to Google Drive; one command per verified, reviewable upload (optional MCP server).
|
|
5
|
+
Author-email: Ansari Bilal <ansaribilal0709@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Ansari Bilal
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/Bilal140202/agent2drive
|
|
29
|
+
Project-URL: Repository, https://github.com/Bilal140202/agent2drive
|
|
30
|
+
Project-URL: Issues, https://github.com/Bilal140202/agent2drive/issues
|
|
31
|
+
Keywords: google-drive,agent,oauth,rclone,deliverables,mcp
|
|
32
|
+
Classifier: Development Status :: 4 - Beta
|
|
33
|
+
Classifier: Environment :: Console
|
|
34
|
+
Classifier: Intended Audience :: Developers
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
38
|
+
Classifier: Topic :: Utilities
|
|
39
|
+
Requires-Python: >=3.10
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
License-File: LICENSE
|
|
42
|
+
Requires-Dist: cryptography>=41
|
|
43
|
+
Provides-Extra: mcp
|
|
44
|
+
Requires-Dist: mcp>=1.0; extra == "mcp"
|
|
45
|
+
Provides-Extra: dev
|
|
46
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
47
|
+
Requires-Dist: build>=1; extra == "dev"
|
|
48
|
+
Dynamic: license-file
|
|
49
|
+
|
|
50
|
+
# agent2drive
|
|
51
|
+
|
|
52
|
+
**One command connects an agent to your Google Drive. One command per upload. That's the whole product.**
|
|
53
|
+
|
|
54
|
+
An agent writes files locally; you review them in Drive. No video-generation model, no stock footage, no public redirect server, no broad Drive access — just a narrow `drive.file` scope and a paste-back OAuth code.
|
|
55
|
+
|
|
56
|
+
## Install
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
pipx install agent2drive # recommended
|
|
60
|
+
# or
|
|
61
|
+
python3 -m pip install --user agent2drive
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
One-line bootstrap for an agent to run for you:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
curl -fsSL https://raw.githubusercontent.com/Bilal140202/agent2drive/main/install.sh | sh
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
See [AGENT_SETUP.md](AGENT_SETUP.md) for the exact prompt to give an agent; [skills/agent2drive/SKILL.md](skills/agent2drive/SKILL.md) is a drop-in skill for OpenCode/Claude-style agents.
|
|
71
|
+
|
|
72
|
+
## Connect (one time)
|
|
73
|
+
|
|
74
|
+
Using your own OAuth client is strongly recommended — rclone's shared public client is being retired during 2026. Create a Desktop OAuth client in Google Cloud with redirect URI `http://127.0.0.1:53682/`, then:
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
agent2drive client <client_id> <client_secret> # stored chmod 600, gitignored
|
|
78
|
+
agent2drive url
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
1. Give the user the printed consent URL.
|
|
82
|
+
2. They click **Allow**. Google may warn " hasn't verified this app" → **Advanced → Go to rclone (unsafe) → Allow**.
|
|
83
|
+
3. The browser fails to load `127.0.0.1:53682`. **That failure is expected** — it only runs on the user's machine. They copy the full address-bar URL and paste it back.
|
|
84
|
+
4. You exchange it immediately (single-use, ~10-minute TTL):
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
agent2drive connect '<PASTED_URL>'
|
|
88
|
+
# or: agent2drive connect --stdin (safer: keeps the code out of shell history)
|
|
89
|
+
agent2drive status
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
If you skip `client`, the tool falls back to deriving rclone's published default client from its own binary. It works today but is rate-limit-prone and will stop working when Google retires that client.
|
|
93
|
+
|
|
94
|
+
## Commands
|
|
95
|
+
|
|
96
|
+
| Command | What it does |
|
|
97
|
+
| --- | --- |
|
|
98
|
+
| `status` | Live token check (`AUTH_OK` / `AUTH_MISSING`, exit 0/2) |
|
|
99
|
+
| `url` | Print the consent URL and store a one-time state nonce |
|
|
100
|
+
| `client [ID] [SECRET]` | Set your own OAuth client (prompts if omitted) |
|
|
101
|
+
| `connect [URL]` / `connect --stdin` | Exchange the pasted redirect URL |
|
|
102
|
+
| `init <slot>` | Create a slot root and `MANIFEST.md` |
|
|
103
|
+
| `upload <slot> <file> [folder] [--replace]` | Upload, verify, and log to the manifest |
|
|
104
|
+
| `ls <slot>` | List everything in a slot |
|
|
105
|
+
| `manifest <slot>` | Print the delivery manifest |
|
|
106
|
+
|
|
107
|
+
## Verified uploads — not just size
|
|
108
|
+
|
|
109
|
+
The original release claimed "byte-exact verification" but only compared file sizes. Now every upload is checked three ways:
|
|
110
|
+
|
|
111
|
+
- **size** from `rclone lsjson`
|
|
112
|
+
- **MD5** and **SHA-1** from `rclone hashsum` (both natively supported by Google Drive)
|
|
113
|
+
|
|
114
|
+
A mismatch deletes the remote copy, fails loudly, and writes nothing to the manifest. If hashes can't be read, the manifest records `SIZE-ONLY` and the command exits non-zero. These hashes detect accidental corruption; they are not a cryptographic authenticity guarantee.
|
|
115
|
+
|
|
116
|
+
Same-name uploads **fail by default**. Pass `--replace` to overwrite deliberately, so a reviewer isn't silently robbed of an earlier draft.
|
|
117
|
+
|
|
118
|
+
## Slots and the manifest
|
|
119
|
+
|
|
120
|
+
Everything lives under one root (default `AgentDeliveries`, override with `GDRIVE_ROOT`), one folder per project:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
AgentDeliveries/
|
|
124
|
+
<slot>/
|
|
125
|
+
MANIFEST.md
|
|
126
|
+
<your folders>/ created on demand; one component, no traversal
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`init` creates only the slot root and manifest — no imposed category tree. Every successful upload appends a row with UTC time, filename, folder, bytes, MD5, SHA-1, and result. That gives you an audit trail of what the agent delivered and when. Slot names are restricted to lowercase letters, digits and hyphens; path traversal is rejected.
|
|
130
|
+
|
|
131
|
+
## Self-restoring, cross-platform
|
|
132
|
+
|
|
133
|
+
A missing or wrong-architecture rclone binary is re-downloaded for the current platform (`linux-amd64`, `linux-arm64`, `osx-*`, `windows-*`), architecture-checked, and smoke-tested before use. Override with `RCLONE_ZIP=<url>` for unusual platforms.
|
|
134
|
+
|
|
135
|
+
The refresh token in `state/rclone/rclone.conf` (chmod 600, gitignored) is the only thing that can't be rebuilt. Lose it and one fresh consent click restores everything; nothing already on Drive is affected.
|
|
136
|
+
|
|
137
|
+
State lives beside the source in a checkout, and in `~/.config/agent2drive/` for a pip/pixi install (override with `A2D_HOME`, or `XDG_CONFIG_HOME`). Nothing is ever written into `site-packages`.
|
|
138
|
+
|
|
139
|
+
## Security
|
|
140
|
+
|
|
141
|
+
- Scope is `drive.file`: the agent can only see files it created itself.
|
|
142
|
+
- `state/`, `bin/`, and `.tmp/` are gitignored; tokens and OAuth client secrets are chmod 600 and never printed.
|
|
143
|
+
- The OAuth `state` nonce is random, stored locally, and checked on `connect` (15-minute TTL).
|
|
144
|
+
- Prefer `connect --stdin` so single-use codes don't land in shell history.
|
|
145
|
+
- Revoke access any time at <https://myaccount.google.com/> → Security → Third-party apps → rclone.
|
|
146
|
+
|
|
147
|
+
## MCP server
|
|
148
|
+
|
|
149
|
+
Available from 0.4.0:
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
pipx install 'agent2drive[mcp]'
|
|
153
|
+
opencode mcp add agent2drive -- agent2drive-mcp
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Eight tools (`a2d_status`, `a2d_set_client`, `a2d_consent_url`, `a2d_connect`, `a2d_init_slot`, `a2d_upload`, `a2d_list`, `a2d_manifest`), two resources, and a `deliver-file` prompt. stdio only; path allowlisting (`A2D_ALLOWED_ROOTS`), overwrite confirmation, and secret redaction are built in. Full setup and security details: [docs/MCP.md](docs/MCP.md).
|
|
157
|
+
|
|
158
|
+
## Development
|
|
159
|
+
|
|
160
|
+
```sh
|
|
161
|
+
python3 -m pip install -r requirements-dev.txt
|
|
162
|
+
python3 -m pytest -q
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Tests cover pure logic plus injected-rclone failure paths (hash mismatch, missing hashes, collisions, retries, state replay, and the post-connect crash regression).
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
MIT. rclone is MIT-licensed; its published OAuth constants are used and credited per its license.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# agent2drive
|
|
2
|
+
|
|
3
|
+
**One command connects an agent to your Google Drive. One command per upload. That's the whole product.**
|
|
4
|
+
|
|
5
|
+
An agent writes files locally; you review them in Drive. No video-generation model, no stock footage, no public redirect server, no broad Drive access — just a narrow `drive.file` scope and a paste-back OAuth code.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pipx install agent2drive # recommended
|
|
11
|
+
# or
|
|
12
|
+
python3 -m pip install --user agent2drive
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
One-line bootstrap for an agent to run for you:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
curl -fsSL https://raw.githubusercontent.com/Bilal140202/agent2drive/main/install.sh | sh
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
See [AGENT_SETUP.md](AGENT_SETUP.md) for the exact prompt to give an agent; [skills/agent2drive/SKILL.md](skills/agent2drive/SKILL.md) is a drop-in skill for OpenCode/Claude-style agents.
|
|
22
|
+
|
|
23
|
+
## Connect (one time)
|
|
24
|
+
|
|
25
|
+
Using your own OAuth client is strongly recommended — rclone's shared public client is being retired during 2026. Create a Desktop OAuth client in Google Cloud with redirect URI `http://127.0.0.1:53682/`, then:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
agent2drive client <client_id> <client_secret> # stored chmod 600, gitignored
|
|
29
|
+
agent2drive url
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
1. Give the user the printed consent URL.
|
|
33
|
+
2. They click **Allow**. Google may warn " hasn't verified this app" → **Advanced → Go to rclone (unsafe) → Allow**.
|
|
34
|
+
3. The browser fails to load `127.0.0.1:53682`. **That failure is expected** — it only runs on the user's machine. They copy the full address-bar URL and paste it back.
|
|
35
|
+
4. You exchange it immediately (single-use, ~10-minute TTL):
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
agent2drive connect '<PASTED_URL>'
|
|
39
|
+
# or: agent2drive connect --stdin (safer: keeps the code out of shell history)
|
|
40
|
+
agent2drive status
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
If you skip `client`, the tool falls back to deriving rclone's published default client from its own binary. It works today but is rate-limit-prone and will stop working when Google retires that client.
|
|
44
|
+
|
|
45
|
+
## Commands
|
|
46
|
+
|
|
47
|
+
| Command | What it does |
|
|
48
|
+
| --- | --- |
|
|
49
|
+
| `status` | Live token check (`AUTH_OK` / `AUTH_MISSING`, exit 0/2) |
|
|
50
|
+
| `url` | Print the consent URL and store a one-time state nonce |
|
|
51
|
+
| `client [ID] [SECRET]` | Set your own OAuth client (prompts if omitted) |
|
|
52
|
+
| `connect [URL]` / `connect --stdin` | Exchange the pasted redirect URL |
|
|
53
|
+
| `init <slot>` | Create a slot root and `MANIFEST.md` |
|
|
54
|
+
| `upload <slot> <file> [folder] [--replace]` | Upload, verify, and log to the manifest |
|
|
55
|
+
| `ls <slot>` | List everything in a slot |
|
|
56
|
+
| `manifest <slot>` | Print the delivery manifest |
|
|
57
|
+
|
|
58
|
+
## Verified uploads — not just size
|
|
59
|
+
|
|
60
|
+
The original release claimed "byte-exact verification" but only compared file sizes. Now every upload is checked three ways:
|
|
61
|
+
|
|
62
|
+
- **size** from `rclone lsjson`
|
|
63
|
+
- **MD5** and **SHA-1** from `rclone hashsum` (both natively supported by Google Drive)
|
|
64
|
+
|
|
65
|
+
A mismatch deletes the remote copy, fails loudly, and writes nothing to the manifest. If hashes can't be read, the manifest records `SIZE-ONLY` and the command exits non-zero. These hashes detect accidental corruption; they are not a cryptographic authenticity guarantee.
|
|
66
|
+
|
|
67
|
+
Same-name uploads **fail by default**. Pass `--replace` to overwrite deliberately, so a reviewer isn't silently robbed of an earlier draft.
|
|
68
|
+
|
|
69
|
+
## Slots and the manifest
|
|
70
|
+
|
|
71
|
+
Everything lives under one root (default `AgentDeliveries`, override with `GDRIVE_ROOT`), one folder per project:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
AgentDeliveries/
|
|
75
|
+
<slot>/
|
|
76
|
+
MANIFEST.md
|
|
77
|
+
<your folders>/ created on demand; one component, no traversal
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`init` creates only the slot root and manifest — no imposed category tree. Every successful upload appends a row with UTC time, filename, folder, bytes, MD5, SHA-1, and result. That gives you an audit trail of what the agent delivered and when. Slot names are restricted to lowercase letters, digits and hyphens; path traversal is rejected.
|
|
81
|
+
|
|
82
|
+
## Self-restoring, cross-platform
|
|
83
|
+
|
|
84
|
+
A missing or wrong-architecture rclone binary is re-downloaded for the current platform (`linux-amd64`, `linux-arm64`, `osx-*`, `windows-*`), architecture-checked, and smoke-tested before use. Override with `RCLONE_ZIP=<url>` for unusual platforms.
|
|
85
|
+
|
|
86
|
+
The refresh token in `state/rclone/rclone.conf` (chmod 600, gitignored) is the only thing that can't be rebuilt. Lose it and one fresh consent click restores everything; nothing already on Drive is affected.
|
|
87
|
+
|
|
88
|
+
State lives beside the source in a checkout, and in `~/.config/agent2drive/` for a pip/pixi install (override with `A2D_HOME`, or `XDG_CONFIG_HOME`). Nothing is ever written into `site-packages`.
|
|
89
|
+
|
|
90
|
+
## Security
|
|
91
|
+
|
|
92
|
+
- Scope is `drive.file`: the agent can only see files it created itself.
|
|
93
|
+
- `state/`, `bin/`, and `.tmp/` are gitignored; tokens and OAuth client secrets are chmod 600 and never printed.
|
|
94
|
+
- The OAuth `state` nonce is random, stored locally, and checked on `connect` (15-minute TTL).
|
|
95
|
+
- Prefer `connect --stdin` so single-use codes don't land in shell history.
|
|
96
|
+
- Revoke access any time at <https://myaccount.google.com/> → Security → Third-party apps → rclone.
|
|
97
|
+
|
|
98
|
+
## MCP server
|
|
99
|
+
|
|
100
|
+
Available from 0.4.0:
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
pipx install 'agent2drive[mcp]'
|
|
104
|
+
opencode mcp add agent2drive -- agent2drive-mcp
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Eight tools (`a2d_status`, `a2d_set_client`, `a2d_consent_url`, `a2d_connect`, `a2d_init_slot`, `a2d_upload`, `a2d_list`, `a2d_manifest`), two resources, and a `deliver-file` prompt. stdio only; path allowlisting (`A2D_ALLOWED_ROOTS`), overwrite confirmation, and secret redaction are built in. Full setup and security details: [docs/MCP.md](docs/MCP.md).
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
python3 -m pip install -r requirements-dev.txt
|
|
113
|
+
python3 -m pytest -q
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Tests cover pure logic plus injected-rclone failure paths (hash mismatch, missing hashes, collisions, retries, state replay, and the post-connect crash regression).
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
MIT. rclone is MIT-licensed; its published OAuth constants are used and credited per its license.
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent2drive
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: One command connects an agent to Google Drive; one command per verified, reviewable upload (optional MCP server).
|
|
5
|
+
Author-email: Ansari Bilal <ansaribilal0709@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Ansari Bilal
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/Bilal140202/agent2drive
|
|
29
|
+
Project-URL: Repository, https://github.com/Bilal140202/agent2drive
|
|
30
|
+
Project-URL: Issues, https://github.com/Bilal140202/agent2drive/issues
|
|
31
|
+
Keywords: google-drive,agent,oauth,rclone,deliverables,mcp
|
|
32
|
+
Classifier: Development Status :: 4 - Beta
|
|
33
|
+
Classifier: Environment :: Console
|
|
34
|
+
Classifier: Intended Audience :: Developers
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
38
|
+
Classifier: Topic :: Utilities
|
|
39
|
+
Requires-Python: >=3.10
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
License-File: LICENSE
|
|
42
|
+
Requires-Dist: cryptography>=41
|
|
43
|
+
Provides-Extra: mcp
|
|
44
|
+
Requires-Dist: mcp>=1.0; extra == "mcp"
|
|
45
|
+
Provides-Extra: dev
|
|
46
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
47
|
+
Requires-Dist: build>=1; extra == "dev"
|
|
48
|
+
Dynamic: license-file
|
|
49
|
+
|
|
50
|
+
# agent2drive
|
|
51
|
+
|
|
52
|
+
**One command connects an agent to your Google Drive. One command per upload. That's the whole product.**
|
|
53
|
+
|
|
54
|
+
An agent writes files locally; you review them in Drive. No video-generation model, no stock footage, no public redirect server, no broad Drive access — just a narrow `drive.file` scope and a paste-back OAuth code.
|
|
55
|
+
|
|
56
|
+
## Install
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
pipx install agent2drive # recommended
|
|
60
|
+
# or
|
|
61
|
+
python3 -m pip install --user agent2drive
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
One-line bootstrap for an agent to run for you:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
curl -fsSL https://raw.githubusercontent.com/Bilal140202/agent2drive/main/install.sh | sh
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
See [AGENT_SETUP.md](AGENT_SETUP.md) for the exact prompt to give an agent; [skills/agent2drive/SKILL.md](skills/agent2drive/SKILL.md) is a drop-in skill for OpenCode/Claude-style agents.
|
|
71
|
+
|
|
72
|
+
## Connect (one time)
|
|
73
|
+
|
|
74
|
+
Using your own OAuth client is strongly recommended — rclone's shared public client is being retired during 2026. Create a Desktop OAuth client in Google Cloud with redirect URI `http://127.0.0.1:53682/`, then:
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
agent2drive client <client_id> <client_secret> # stored chmod 600, gitignored
|
|
78
|
+
agent2drive url
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
1. Give the user the printed consent URL.
|
|
82
|
+
2. They click **Allow**. Google may warn " hasn't verified this app" → **Advanced → Go to rclone (unsafe) → Allow**.
|
|
83
|
+
3. The browser fails to load `127.0.0.1:53682`. **That failure is expected** — it only runs on the user's machine. They copy the full address-bar URL and paste it back.
|
|
84
|
+
4. You exchange it immediately (single-use, ~10-minute TTL):
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
agent2drive connect '<PASTED_URL>'
|
|
88
|
+
# or: agent2drive connect --stdin (safer: keeps the code out of shell history)
|
|
89
|
+
agent2drive status
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
If you skip `client`, the tool falls back to deriving rclone's published default client from its own binary. It works today but is rate-limit-prone and will stop working when Google retires that client.
|
|
93
|
+
|
|
94
|
+
## Commands
|
|
95
|
+
|
|
96
|
+
| Command | What it does |
|
|
97
|
+
| --- | --- |
|
|
98
|
+
| `status` | Live token check (`AUTH_OK` / `AUTH_MISSING`, exit 0/2) |
|
|
99
|
+
| `url` | Print the consent URL and store a one-time state nonce |
|
|
100
|
+
| `client [ID] [SECRET]` | Set your own OAuth client (prompts if omitted) |
|
|
101
|
+
| `connect [URL]` / `connect --stdin` | Exchange the pasted redirect URL |
|
|
102
|
+
| `init <slot>` | Create a slot root and `MANIFEST.md` |
|
|
103
|
+
| `upload <slot> <file> [folder] [--replace]` | Upload, verify, and log to the manifest |
|
|
104
|
+
| `ls <slot>` | List everything in a slot |
|
|
105
|
+
| `manifest <slot>` | Print the delivery manifest |
|
|
106
|
+
|
|
107
|
+
## Verified uploads — not just size
|
|
108
|
+
|
|
109
|
+
The original release claimed "byte-exact verification" but only compared file sizes. Now every upload is checked three ways:
|
|
110
|
+
|
|
111
|
+
- **size** from `rclone lsjson`
|
|
112
|
+
- **MD5** and **SHA-1** from `rclone hashsum` (both natively supported by Google Drive)
|
|
113
|
+
|
|
114
|
+
A mismatch deletes the remote copy, fails loudly, and writes nothing to the manifest. If hashes can't be read, the manifest records `SIZE-ONLY` and the command exits non-zero. These hashes detect accidental corruption; they are not a cryptographic authenticity guarantee.
|
|
115
|
+
|
|
116
|
+
Same-name uploads **fail by default**. Pass `--replace` to overwrite deliberately, so a reviewer isn't silently robbed of an earlier draft.
|
|
117
|
+
|
|
118
|
+
## Slots and the manifest
|
|
119
|
+
|
|
120
|
+
Everything lives under one root (default `AgentDeliveries`, override with `GDRIVE_ROOT`), one folder per project:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
AgentDeliveries/
|
|
124
|
+
<slot>/
|
|
125
|
+
MANIFEST.md
|
|
126
|
+
<your folders>/ created on demand; one component, no traversal
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`init` creates only the slot root and manifest — no imposed category tree. Every successful upload appends a row with UTC time, filename, folder, bytes, MD5, SHA-1, and result. That gives you an audit trail of what the agent delivered and when. Slot names are restricted to lowercase letters, digits and hyphens; path traversal is rejected.
|
|
130
|
+
|
|
131
|
+
## Self-restoring, cross-platform
|
|
132
|
+
|
|
133
|
+
A missing or wrong-architecture rclone binary is re-downloaded for the current platform (`linux-amd64`, `linux-arm64`, `osx-*`, `windows-*`), architecture-checked, and smoke-tested before use. Override with `RCLONE_ZIP=<url>` for unusual platforms.
|
|
134
|
+
|
|
135
|
+
The refresh token in `state/rclone/rclone.conf` (chmod 600, gitignored) is the only thing that can't be rebuilt. Lose it and one fresh consent click restores everything; nothing already on Drive is affected.
|
|
136
|
+
|
|
137
|
+
State lives beside the source in a checkout, and in `~/.config/agent2drive/` for a pip/pixi install (override with `A2D_HOME`, or `XDG_CONFIG_HOME`). Nothing is ever written into `site-packages`.
|
|
138
|
+
|
|
139
|
+
## Security
|
|
140
|
+
|
|
141
|
+
- Scope is `drive.file`: the agent can only see files it created itself.
|
|
142
|
+
- `state/`, `bin/`, and `.tmp/` are gitignored; tokens and OAuth client secrets are chmod 600 and never printed.
|
|
143
|
+
- The OAuth `state` nonce is random, stored locally, and checked on `connect` (15-minute TTL).
|
|
144
|
+
- Prefer `connect --stdin` so single-use codes don't land in shell history.
|
|
145
|
+
- Revoke access any time at <https://myaccount.google.com/> → Security → Third-party apps → rclone.
|
|
146
|
+
|
|
147
|
+
## MCP server
|
|
148
|
+
|
|
149
|
+
Available from 0.4.0:
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
pipx install 'agent2drive[mcp]'
|
|
153
|
+
opencode mcp add agent2drive -- agent2drive-mcp
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Eight tools (`a2d_status`, `a2d_set_client`, `a2d_consent_url`, `a2d_connect`, `a2d_init_slot`, `a2d_upload`, `a2d_list`, `a2d_manifest`), two resources, and a `deliver-file` prompt. stdio only; path allowlisting (`A2D_ALLOWED_ROOTS`), overwrite confirmation, and secret redaction are built in. Full setup and security details: [docs/MCP.md](docs/MCP.md).
|
|
157
|
+
|
|
158
|
+
## Development
|
|
159
|
+
|
|
160
|
+
```sh
|
|
161
|
+
python3 -m pip install -r requirements-dev.txt
|
|
162
|
+
python3 -m pytest -q
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Tests cover pure logic plus injected-rclone failure paths (hash mismatch, missing hashes, collisions, retries, state replay, and the post-connect crash regression).
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
MIT. rclone is MIT-licensed; its published OAuth constants are used and credited per its license.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
agent2drive.py
|
|
4
|
+
agent2drive_mcp.py
|
|
5
|
+
pyproject.toml
|
|
6
|
+
agent2drive.egg-info/PKG-INFO
|
|
7
|
+
agent2drive.egg-info/SOURCES.txt
|
|
8
|
+
agent2drive.egg-info/dependency_links.txt
|
|
9
|
+
agent2drive.egg-info/entry_points.txt
|
|
10
|
+
agent2drive.egg-info/requires.txt
|
|
11
|
+
agent2drive.egg-info/top_level.txt
|
|
12
|
+
tests/test_agent2drive.py
|
|
13
|
+
tests/test_agent2drive_mcp.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|