
tubekit
io.github.santiriera626Published by GitHub account santiriera626v0.3.0Updated Oct 24, 2026
Compliance-aware MCP server for YouTube publishing, analytics and creator insights.
Overview
Compliance-gated MCP server that lets an assistant upload, manage and analyze videos on your own YouTube channel, with quota accounting and an audit log.
- What you can do
- Validate video metadata against a local compliance rule registry before anything goes live
- Upload videos, set thumbnails and patch title, description, tags or privacy
- Read video status, list uploads and playlists, and create, update, reorder or remove playlist entries
- Pull channel, portfolio and per-video analytics reports, including revenue estimates and YPP progress
- Digest, list and read comment threads, and mark comments reviewed in a local triage state
- Check OAuth liveness and request brokered upload URLs for large media
- When to use it
- Useful when an assistant should operate a real YouTube channel — publishing uploads, curating playlists, triaging comments or reporting on performance — and you want guardrails, quota accounting and an audit trail rather than raw API access.
- Requirements
- Runs locally over stdio (PyPI package, launched with uvx or uv tool install). Needs a Google Cloud project with YouTube Data API v3 (and Analytics API for reports), a Desktop-app OAuth client JSON at TUBEKIT_OAUTH_CLIENT_SECRETS_PATH, a Fernet master key at TUBEKIT_MASTER_KEY_PATH, a SQLite state file at TUBEKIT_STATE_DB_PATH, and a one-time interactive OAuth consent per channel.
Installation
In SourceWeft
- Open tubekit in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
tubekit-mcp
Compliance-aware Model Context Protocol server for YouTube publishing, analytics, and creator insights — every action gated, metered, and audited before it touches a channel.
[CI] [License: FSL-1.1-MIT] [Python 3.11+] [Type-checked: mypy strict] [Lint: ruff]
tubekit-mcp is an MCP server: you connect it to an MCP client (Claude Desktop,
Claude Code, …) and the assistant can then publish and manage videos on a
YouTube channel on your behalf, with compliance checks, quota accounting,
idempotent uploads and a tamper-evident audit log on every state-changing call.
Licensed under FSL-1.1-MIT — run and self-host it freely,
commercially or not; each release becomes plain MIT two years after publication.
Architecture
A single tool call (e.g. upload_video) flows through a compliance gate, a
quota / idempotency ledger, an OAuth refresh, the YouTube API, and a
tamper-evident audit row — with the pure core kept free of protocol concerns,
a boundary enforced in CI by an AST fitness test
(tests/unit/services/test_no_fastmcp_imports.py).
Why this exists. Agents are starting to operate real YouTube channels — and a channel is an asset you can lose. One bad call can publish a video that violates policy, burn the day's API quota (an upload costs 1600 of the default 10,000 daily units), or double-publish on a retry. Generic YouTube wrappers hand the agent the raw API;
tubekitwraps every call in the guardrails an unattended operator needs: a compliance gate before anything goes live, quota accounted before it is spent, idempotent retries, OAuth tokens encrypted at rest (fingerprint-only logging), and a tamper-evident audit chain of everything the agent did. Full design rationale in ADR 0001.
Usage
Prerequisites
Before an assistant can act on a channel you need, once per channel:
- A Google Cloud project with the YouTube Data API v3 (and YouTube
Analytics API if you use
get_analytics) enabled. - An OAuth client of type Desktop app, downloaded as
client_secret.json. - The channel whose Google account will grant the consent.
The OAuth grant is interactive and only happens here — tubekit stores the
resulting refresh token Fernet-encrypted and never prints it. Never used
Google Cloud Console? docs/runbooks/gcp-setup.md
walks the whole thing from zero (project, APIs, consent screen, client type,
and the two Google policies — token expiry in testing, private-locked uploads
for unaudited projects — that surprise people later). The consent flows
themselves are in
docs/runbooks/oauth-bootstrap.md.
Install
From PyPI:
Use uv tool install, not uvx, for a real setup: the one-time steps below need
the tubekit CLI to still be there afterwards. uvx tubekit-mcp runs the stdio
server from a throwaway environment, which is what an MCP client's config points
at once the setup is done.
The server will not start yet, and that is deliberate — it refuses to run without a master key rather than inventing one, since that key is what encrypts your OAuth tokens at rest. One-time setup below is the two commands that fix it.
Or from source, for development:
(uv itself installs with curl -LsSf https://astral.sh/uv/install.sh | sh.)
Try it in 60 seconds — no Google account needed
The compliance engine is pure-local, so you can watch the gate and its
self-correction Suggestions work before touching Google Cloud:
An error-severity violation — say a 126-character title — fails the gate with
exit 1 and a machine-applicable fix (suggestion: action=truncate field=metadata.title value=100). That is the same Suggestion an agent
receives from a rejected upload_video and applies before retrying (ADR D8).
tubekit compliance list prints the rule catalog; tubekit compliance manifest exports it for external auditors.
Install with an AI agent
Rather not type the commands above yourself? Paste the block below into Claude
Code (or any coding agent with shell access) and it will clone, install and
register the server for you. It stops at the boundary above: no Google
account, client_secret.json or OAuth consent is involved.
Restart your MCP client after registration; it can now call tubekit.health()
and list the full tool catalog. Every tool that takes a channel argument —
validate_compliance included — needs a configured channel, which means
completing One-time setup — including the OAuth consent in
docs/runbooks/oauth-bootstrap.md —
yourself. The compliance gate itself is testable without any channel via
step 3's tubekit compliance test.
One-time setup
Connect to an MCP client (stdio)
Most clients launch the server over stdio. Add this to the client's MCP
config (for Claude Desktop: claude_desktop_config.json):
Restart the client. The assistant now sees the tools below plus a
tubekit.health() probe. Ask it, e.g., "upload ./intro.mp4 to mychannel" and
it will call upload_video, which gates on compliance, charges quota, refreshes
OAuth and writes an audit row — all transparently.
Available tools
Playlist writes take a
playlist_item_id, never a bare video id: the same video may appear in a list more than once, so YouTube cannot disambiguate from the video alone. Get the ids from onelist_playlist_itemscall (1 unit) and reuse them — the services deliberately do not resolve them for you, because that would be a quota charge the caller never asked for.Playlists are not run through the compliance registry: it scores video metadata (thumbnail, category, tags, synthetic-media declaration), none of which a playlist has, and its
TITLE_TOO_LONGwould apply the video ceiling (100) to a resource whose real ceiling is 150. What is enforced instead is what Google documents for the playlist resource: a non-empty title, a validprivacyStatus, ≤150 characters of title, ≤5000 of description, and no<,>or U+2028 in either. Those limits live in the YouTube Help page, not in the Data API reference — which documents none, and is why they were missed at first.
Comments tools need the channel grant to carry
youtube.force-ssl(moderation-status filtering is owner-only). Verify withcheck_oauth; if missing, re-consent once:tubekit auth setup-channel --scopes …,https://www.googleapis.com/auth/youtube.force-ssl.
Revenue figures across the report tools are estimated ad + YouTube Premium
revenue only (memberships, Super Chat and Shopping are not exposed by the
channel-level APIs), lag ~2 days (period.revenue_complete_until), and are
finalized around the 10th of the following month. Thumbnail impressions/CTR are
not available in the targeted Analytics API. get_analytics remains the raw
escape hatch for any ad-hoc query.
Every tool returns a ToolResult envelope (ok + data, or a structured
ToolError whose code is one of the documented error codes). On a compliance
failure the error carries a Suggestion the assistant can apply and retry — the
self-correction loop described in ADR D8.
HTTP transport (multi-user)
For remote / multi-tenant use, run the HTTP transport instead. It requires a per-client Bearer API token scoped to specific channels and tools, with an optional per-token rate limit:
Clients send Authorization: Bearer <token>. Requests that are
unauthenticated, out-of-scope, or rate-limited get JSON-RPC errors
(-32001..-32006). GET /healthz returns the liveness payload; the
per-channel detail (aliases, OAuth expiry) is added only for a valid Bearer and
narrowed to that token's channels. Manage tokens with
tubekit auth list | show | revoke | rotate.
To run this centrally on a VPS (one server, many projects connecting over
HTTPS), follow docs/runbooks/vps-deploy.md —
a self-contained, step-by-step deployment guide (systemd + Traefik + per-project
tokens) written for an infra team.
Media ingest (remote upload_video)
upload_video(video_path) reads the file from the server's filesystem — a
client-local path can never resolve on a remote deployment. There are two ways
to get the media onto the server.
Brokered upload (recommended, no ssh). The agent orchestrates the whole
transfer over HTTP via the MCP. Call request_ingest_upload, then PUT the
bytes to the one-time URL it returns (same Bearer token), then upload_video
with the returned server-side path:
The server streams the body to a staging .part, verifies size_bytes + sha256,
and atomically publishes before upload_video reads it. The URL is a single-use,
channel-bound capability with a TTL; an interrupted transfer resumes via HEAD +
Content-Range. Design rationale: ADR 0002.
Requires TUBEKIT_INGEST_UPLOAD_URL_BASE to be set (otherwise the tool returns
precondition_failed).
rsync convention (fallback, requires ssh). Transfer out-of-band, then call the tool with the server-side path:
Set TUBEKIT_INGEST_DIR to the in-server ingest path (e.g. /ingest): when a
video_path is unreadable the tool returns validation_error with a
suggestion pointing the calling agent at this convention. See the
media-ingest section of the VPS runbook
for the volume mount and retention policy.
Environment variables
All settings use the TUBEKIT_ prefix (see .env.example):
A lost
state.db/master.keypair means re-bootstrapping every channel. Back them up together — seedocs/runbooks/state-db-backup.md.
Hosted version
Gatecast is the hosted tier of tubekit — same engine, run and kept alive for you. It is pre-launch; the waiting list is the whole thing so far. Self-hosting with this repo is and stays fully supported.
Development
make demo-stack-up brings up the Jaeger/Prometheus/Grafana observability stack
with five provisioned dashboards (docker-compose.demo.yml, docs/grafana/).
Repository layout
Contributing & security
- Contributions are welcome — see
CONTRIBUTING.mdfor the workflow and quality bar. - Report security vulnerabilities privately per
SECURITY.md. - Release history is in
CHANGELOG.md; the roadmap lives indocs/ROADMAP.md.
License
FSL-1.1-MIT © 2026 sriera
The Functional Source License in plain words: read it, run it, modify it, self-host it for your own channels — commercially or not. The one thing it forbids is offering tubekit itself to others as a competing product or service. Each release additionally becomes plain MIT two years after its publication, automatically and irrevocably.
Source: README.md at commit 6d29e6a
Tools
0Version history
1- v0.3.0LatestSep 16, 2026
Score
40% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts
Declare a license in the repository or the registry entry.