tokportal-mcp
Officialtokportal
TokPortal は管理型ソーシャルインフラ API です。16 か国以上の人間のアカウントマネージャーによって作成、ウォームアップ、運用される本物の TikTok、Instagram、YouTube アカウントを REST API および MCP サーバーとして公開します。アカウントごとの OAuth は不要、1 日 25 投稿の制限なし、アプリレビューも不要。
ドキュメント https://developers.tokportal.com · API ベース https://app.tokportal.com/api/ext · OpenAPI https://developers.tokportal.com/openapi.json · MCP リモート https://app.tokportal.com/api/ext/mcp · API キーを取得 https://app.tokportal.com/developer/api-keys · llms.txt https://developers.tokportal.com/llms.txt
tokportal は TokPortal API の公式 Python SDK です(Python 3.9+、型付き、標準ライブラリのみ)。すべての公開操作はリソースメソッドとして、または生成された request_operation マップを通じて利用できます。
インストール
pip install tokportalRelated MCP server: tiktok-mcp
30秒クイックスタート
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"])メソッド名は生成されたリソースマップ(
bundles、uploads、accounts、analytics、webhooks)に従います。操作に対応するヘルパーがない場合は、client.request_operation("<operationId>", path=..., query=..., body=...)を使用してください。
完全な例
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"])直接マルチパートアップロードも、同じ構造化エラーと冪等性サポートを使用します。
uploaded = client.uploads.video_direct(
"./video.mp4",
bundle["data"]["id"],
content_type="video/mp4",
idempotency_key="video-upload-123",
)最新のアトミッククォートから TokPortal Coverage を管理します。ゼロクレジットのクォートも有効であり、明示的な再アクティベーション呼び出しが必要です。
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",
)資格情報の開示と確認コードへのアクセスは、同じ不可逆的な 2 ステップポリシーフローを使用します。最初の呼び出しで同意なしの場合は HTTP 428 と error.details.policy_version を受け取ります。その後、その条件をアカウント所有者に提示し、その正確なバージョンで再試行します。同意されたリクエストはクレジットを消費し、アカウントを永続的に切り離す可能性があります。これらの秘密を含むレスポンスは再生のために保存されないため、これらのヘルパーは意図的に idempotency_key を受け入れません。不確かな転送結果の後は、安全なアカウント状態を調整してから、キーなしでエンドポイントを再度呼び出すかどうかを判断します。
同意された呼び出しが CREDENTIAL_REVEAL_QUOTE_CHANGED とともに HTTP 409 を返した場合、課金も開示も行われていません。error.details から現在のポリシーと expected_credit_cost を読み取り、新しい条件を所有者に提示し、新たな同意を得て、新しいバージョンで再試行します。409 を自動的に再試行しないでください。
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,
},
)同じ再生禁止ルールが webhooks.create、uploads.image、uploads.video、analytics.create_report にも適用されます。これらは署名シークレット、署名付きアップロード機能、またはレポートアクセストークンを返すためです。これらのヘルパーは idempotency_key を受け入れず、request_operation はこれら 6 つの機密操作 ID に対してローカルで拒否します。
生の HTTP に頼らずに Webhook を発見して操作します。
catalog = client.webhooks.events()
endpoints = client.webhooks.list(event="bundle.published")
retry = client.webhooks.retry_delivery(endpoints["data"][0]["id"], "delivery-id")すべての OpenAPI 操作は、生成された操作マップを通じてもアクセス可能です。
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"]},
)SDK は API リクエストに X-TokPortal-Client: tokportal-python/0.1.0 を送信し、可観測性とサポート診断を提供します。
署名付き Webhook 配信を、正確な生のリクエスト本文で検証します。
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 キーは sk_ に続く 64 文字の小文字 16 進数形式です。TokPortal はキーの SHA-256 ハッシュのみを保存し、作成時に生のキーを一度だけ表示します。
信頼できる情報源
このパッケージは、TokPortal のプライベートモノレポ内の TokPortal 公開 OpenAPI スキーマ(https://developers.tokportal.com/openapi.json)から生成されています。生成されたファイル(tokportal/_generated.py)はリリースのたびに上書きされます。手動で編集しないでください。PR として受け付ける内容については CONTRIBUTING.md を、脆弱性の報告については SECURITY.md を参照してください。
リンク
ドキュメント: https://developers.tokportal.com
SDK & CLI ガイド: https://developers.tokportal.com/sdks-cli
MCP サーバー: https://developers.tokportal.com/mcp ·
tokportal-mcpAPI リファレンス (OpenAPI): https://developers.tokportal.com/openapi.json
その他のパッケージ:
@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