tokportal-mcp
Officialtokportal
TokPortal ist die verwaltete Social-Infrastruktur-API: echte TikTok-, Instagram- und YouTube-Konten, die von menschlichen Account-Managern in über 16 Ländern erstellt, aufgewärmt und betrieben werden – bereitgestellt als REST-API und MCP-Server. Kein OAuth pro Konto, keine 25-Posts-pro-Tag-Begrenzung, keine App-Überprüfung.
Dokumentation https://developers.tokportal.com · API-Basis https://app.tokportal.com/api/ext · OpenAPI https://developers.tokportal.com/openapi.json · MCP-Remote https://app.tokportal.com/api/ext/mcp · API-Schlüssel anfordern https://app.tokportal.com/developer/api-keys · llms.txt https://developers.tokportal.com/llms.txt
tokportal ist das offizielle Python-SDK für die TokPortal-API (Python 3.9+, typisiert, nur Standardbibliothek). Jeder öffentliche Vorgang ist als Ressourcenmethode oder über die generierte request_operation-Map verfügbar.
Installation
pip install tokportalRelated MCP server: tiktok-mcp
30-Sekunden-Schnellstart
import os
from tokportal import TokPortal
client = TokPortal(api_key=os.environ["TOKPORTAL_API_KEY"])
# 1. Create a bundle: a fresh managed TikTok account in the USA + 1 video slot.
# Credits are debited now; the account manager is assigned at publish time.
bundle = client.bundles.create({
"bundle_type": "account_and_videos",
"platform": "tiktok",
"country": "USA",
"title": "US launch",
"videos_quantity": 1,
})
bundle_id = bundle["data"]["id"]
# 2. Upload the video straight from disk -> public_url
upload = client.uploads.video_direct("./launch.mp4", bundle_id, content_type="video/mp4")
# 3. Configure the account profile and video slot 1, then publish
client.bundles.configure_account(bundle_id, {
"username": "mybrand.us",
"visible_name": "My Brand",
"biography": "Official account",
})
client.bundles.configure_video(bundle_id, 1, {
"video_type": "video",
"video_url": upload["data"]["public_url"],
"description": "Day 1 - launching in the US #launch",
"target_publish_date": "2026-09-01",
})
client.bundles.publish(bundle_id)
# 4. Later (webhook `account.in_review` / `account.finalized`, or polling):
# saved_account_id is the real delivered account -> read it back
current = client.bundles.get(bundle_id)["data"]
if current.get("saved_account_id"):
account = client.accounts.get(current["saved_account_id"])["data"]
print(account["username"], account["profile_url"])Methodennamen folgen der generierten Ressourcen-Map (
bundles,uploads,accounts,analytics,webhooks). Falls kein Helfer für einen Vorgang existiert, verwenden Sieclient.request_operation("<operationId>", path=..., query=..., body=...).
Vollständiges Beispiel
import os
from tokportal import TokPortal, TokPortalApiError
client = TokPortal(api_key=os.environ["TOKPORTAL_API_KEY"])
me = client.me()
bundle = client.bundles.create({
"bundle_type": "account_and_videos",
"country": "USA",
"videos_quantity": 5,
})
csv = client.analytics.export_videos(account=["saved-account-id"])
image = client.uploads.image_from_url({
"url": "https://cdn.example.com/photo.jpg",
"bundle_id": bundle["data"]["id"],
})
print(me["data"]["email"], bundle["data"], csv, image["data"])Direkte Multipart-Uploads verwenden dieselben strukturierten Fehler und Idempotenz-Unterstützung:
uploaded = client.uploads.video_direct(
"./video.mp4",
bundle["data"]["id"],
content_type="video/mp4",
idempotency_key="video-upload-123",
)Verwalten Sie die TokPortal-Abdeckung ab dem aktuellen atomaren Angebot. Ein Null-Kredit-Angebot ist gültig und erfordert dennoch einen expliziten Reaktivierungsaufruf:
coverage = client.accounts.coverage("saved-account-id")
quote = coverage["data"]["reactivation_quote"]
if quote:
client.accounts.reactivate_coverage(
"saved-account-id",
{
"expected_credits": quote["credits"],
"expected_current_period_end": quote["current_period_end"],
"expected_lock_version": quote["lock_version"],
},
idempotency_key="coverage-reactivate-saved-account-id-v4",
)
client.accounts.pause_coverage(
"saved-account-id",
idempotency_key="coverage-pause-saved-account-id-v4",
)Die Offenlegung von Anmeldeinformationen und der Zugriff auf Verifizierungscodes verwenden denselben irreversiblen Zwei-Schritte-Richtlinienablauf. Erster Aufruf ohne Zustimmung erhält HTTP 428 und error.details.policy_version; zeigen Sie diese Bedingungen dem Kontoinhaber und wiederholen Sie den Vorgang mit genau dieser Version. Die akzeptierte Anfrage kann Credits abbuchen und das Konto dauerhaft trennen. Diese geheimnistragenden Antworten werden niemals zur Wiederholung gespeichert, daher akzeptieren diese Helfer absichtlich keinen idempotency_key. Nach einem unsicheren Transport-Ergebnis gleichen Sie den sicheren Kontostand ab, bevor Sie entscheiden, ob der Endpunkt erneut ohne Schlüssel aufgerufen werden soll:
Wenn ein akzeptierter Aufruf HTTP 409 mit CREDENTIAL_REVEAL_QUOTE_CHANGED zurückgibt, erfolgte weder eine Belastung noch eine Offenlegung. Lesen Sie die aktuelle Richtlinie und expected_credit_cost aus error.details, zeigen Sie dem Eigentümer die neuen Bedingungen, holen Sie eine neue Zustimmung ein und wiederholen Sie den Vorgang mit der neuen Version. Wiederholen Sie einen 409 niemals automatisch.
try:
client.accounts.reveal_credentials("saved-account-id")
except TokPortalApiError as error:
if error.status_code != 428:
raise
policy_version = str(error.details["policy_version"])
credentials = client.accounts.reveal_credentials(
"saved-account-id",
acceptance={
"acknowledge_support_forfeit": True,
"policy_version": policy_version,
},
)Die gleiche Nicht-Wiederholungsregel gilt für webhooks.create, uploads.image, uploads.video und analytics.create_report, da sie ein Signing-Secret, eine signierte Upload-Fähigkeit oder ein Berichtszugriffstoken zurückgeben. Diese Helfer akzeptieren keinen idempotency_key, und request_operation lehnt einen lokal für alle sechs sensiblen Vorgangs-IDs ab.
Entdecken und betreiben Sie Webhooks, ohne auf rohes HTTP zurückzugreifen:
catalog = client.webhooks.events()
endpoints = client.webhooks.list(event="bundle.published")
retry = client.webhooks.retry_delivery(endpoints["data"][0]["id"], "delivery-id")Jeder OpenAPI-Vorgang ist auch über die generierte Vorgangs-Map erreichbar:
same_retry = client.request_operation(
"retryWebhookDelivery",
path={"id": endpoints["data"][0]["id"], "delivery_id": "delivery-id"},
)
csv_again = client.request_operation(
"exportAnalyticsVideos",
query={"account": ["saved-account-id"]},
)Das SDK sendet X-TokPortal-Client: tokportal-python/0.1.0 bei API-Anfragen für Beobachtbarkeit und Support-Diagnose.
Überprüfen Sie signierte Webhook-Zustellungen mit dem exakten rohen Anfragekörper:
from tokportal import verify_webhook_signature
valid = verify_webhook_signature(
raw_body,
request.headers["TokPortal-Signature"],
os.environ["TOKPORTAL_WEBHOOK_SECRET"],
)from tokportal import TokPortalApiError
try:
client.bundles.create({
"bundle_type": "account_and_videos",
"country": "USA",
"videos_quantity": 5,
})
except TokPortalApiError as error:
print(error.status_code, error.code, error.details, error.request_id)
if error.retryable:
wait_seconds = error.retry_after_seconds or 1
# Retry with backoff.
pass
print(error.rate_limit)API-Schlüssel verwenden das Format sk_ gefolgt von 64 hexadezimalen Kleinbuchstaben. TokPortal speichert nur einen SHA-256-Hash des Schlüssels und zeigt den rohen Schlüssel einmalig bei der Erstellung an.
Quelle der Wahrheit
Dieses Paket wird aus dem öffentlichen TokPortal-OpenAPI-Schema
(https://developers.tokportal.com/openapi.json) im privaten TokPortal-Monorepo generiert. Generierte Dateien (tokportal/_generated.py) werden bei jeder Veröffentlichung überschrieben – bearbeiten Sie sie nicht von Hand. Siehe CONTRIBUTING.md für das, was wir als PRs akzeptieren, und SECURITY.md für die Meldung von Schwachstellen.
Links
Dokumentation: https://developers.tokportal.com
SDKs & CLI-Anleitung: https://developers.tokportal.com/sdks-cli
MCP-Server: https://developers.tokportal.com/mcp ·
tokportal-mcpAPI-Referenz (OpenAPI): https://developers.tokportal.com/openapi.json
Andere Pakete:
@tokportal/node·@tokportal/cli·tokportal(PyPI) ·github.com/tokportal/tokportal-go
MIT © TokPortal
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBquality-maintenanceA comprehensive MCP server that enables AI assistants to search, download, and analyze TikTok content while also performing active tasks like publishing videos and interacting with posts. It provides full automation capabilities for TikTok through browser session management and anti-detection features.122
- FlicenseBqualityCmaintenanceMCP server for TikTok that enables searching videos, users, hashtags, and fetching trending content, user profiles, and video details via official API or public scraping.8
- AlicenseAqualityBmaintenanceMCP server for TikTok that publishes videos to your own TikTok account and retrieves video performance metrics through TikTok's official Content Posting and Display APIs.6MIT
- AlicenseBqualityBmaintenanceMCP server for TikTok that lets AI agents connect accounts, post and schedule videos, follow users, manage profiles, and analyze performance—all via QR login with no API keys.161MIT
Related MCP Connectors
Managed LinkedIn MCP server for AI agents: search, connect, message and enrich on accounts you own.
MCP server for Wan AI video generation
MCP server for ByteDance Seedance AI video generation
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/tokportal/tokportal-python'
If you have feedback or need assistance with the MCP directory API, please join our Discord server