AtlatestRepositorytube
1
# tube3
Video platform management CLI and MCP server — YouTube + Twitch unified in one interface.5
Upload videos, edit metadata, check analytics, schedule streams, manage chat, and get a cross-platform overview of your content channels.7
## Installation9
Requires a C toolchain. On Guix:11
```bash12
guix shell -m ../sigil/manifest.scm13
```15
Build:17
```bash18
sigil build --redirects dev-redirects.sgl19
```21
Run tests:23
```bash24
sigil test25
```27
## Usage29
### CLI Mode31
```bash32
# Platform overview (subscribers, followers, live status)33
tube status35
# List recent YouTube videos with stats36
tube videos --limit 2038
# Upload a video to YouTube39
tube upload video.mp4 --title "My Video" --description "About this video" --privacy unlisted41
# Analytics summary (YouTube + Twitch combined)42
tube analytics --days 3044
# View stream schedule across platforms45
tube stream-schedule --platform both47
# Start a broadcast48
tube go-live --title "Weekly Livestream" --platform both50
# Send a chat message51
tube chat "Hello everyone!" --platform twitch52
```54
### MCP Server Mode56
```bash57
tube serve58
```60
This starts an MCP server exposing the following tools:62
| Tool | Description |63
|------|-------------|64
| `tube/upload` | Upload video to YouTube |65
| `tube/videos` | List recent videos with stats |66
| `tube/analytics` | Cross-platform analytics summary |67
| `tube/schedule` | View stream schedule (YouTube + Twitch) |68
| `tube/go-live` | Start broadcast on one or both platforms |69
| `tube/chat` | Send message to live chat |70
| `tube/status` | Platform overview (subs, followers, live status) |72
## Configuration74
### OAuth Mode (Recommended)76
Set client credentials and use `tube auth` to authorize:78
```bash79
export YOUTUBE_CLIENT_ID="your-google-client-id"80
export YOUTUBE_CLIENT_SECRET="your-google-client-secret"81
export TWITCH_CLIENT_ID="your-twitch-client-id"82
export TWITCH_CLIENT_SECRET="your-twitch-client-secret"84
# Authorize each platform (opens browser, stores tokens)85
tube auth youtube86
tube auth twitch87
```89
Tokens are stored in `~/.config/sigil/<service>/tokens.json` and automatically refreshed when expired.91
### Direct Token Mode (Legacy)93
For manual token management, set access tokens directly:95
| Variable | Required | Description |96
|----------|----------|-------------|97
| `YOUTUBE_ACCESS_TOKEN` | For YouTube write ops | YouTube OAuth2 access token |98
| `YOUTUBE_API_KEY` | For YouTube read ops | YouTube Data API key |99
| `TWITCH_CLIENT_ID` | For Twitch | Twitch application client ID |100
| `TWITCH_ACCESS_TOKEN` | For Twitch | Twitch OAuth2 access token |101
| `TUBE_DEFAULT_PLATFORM` | No | Default platform: `youtube`, `twitch`, or `both` (default: `both`) |103
### OAuth Environment Variables105
| Variable | Description |106
|----------|-------------|107
| `YOUTUBE_CLIENT_ID` | Google Cloud OAuth2 client ID |108
| `YOUTUBE_CLIENT_SECRET` | Google Cloud OAuth2 client secret |109
| `TWITCH_CLIENT_ID` | Twitch application client ID |110
| `TWITCH_CLIENT_SECRET` | Twitch application client secret |112
You only need credentials for the platforms you want to use. If you only have YouTube credentials, Twitch operations will gracefully report that credentials are missing, and vice versa.114
## Architecture116
```117
src/tube/118
config.sgl — Environment-based configuration119
youtube.sgl — YouTube operations (wraps sigil-youtube)120
twitch.sgl — Twitch operations (wraps sigil-twitch)121
tools.sgl — MCP tool definitions + shared helpers122
main.sgl — Dual CLI/MCP entry point123
```125
tube follows the dual CLI/MCP server pattern used by [fjo](https://codeberg.org/sigil/fjo) and [tally](https://codeberg.org/sigil/tally). The same business logic serves both the command-line interface and MCP tool handlers.127
## Dependencies129
- [sigil-youtube](https://codeberg.org/sigil/sigil-youtube) — YouTube Data API v3 client130
- [sigil-twitch](https://codeberg.org/sigil/sigil-twitch) — Twitch Helix API client131
- [sigil-mcp](https://codeberg.org/sigil/sigil) — MCP server framework133
## License135
BSD-3-Clause