> ## Documentation Index
> Fetch the complete documentation index at: https://mcp.shipcontent.com/llms.txt
> Use this file to discover all available pages before exploring further.

---
title: Connect an MCP client
description: Use OAuth to connect an MCP client to the deployed Streamable HTTP endpoint and select a connected workspace.
section: start
order: 20
status: implemented
mode: both
reviewed: 2026-11-24
sources: [src/lib/server/media/MotionStudioPlanHttp.ts, src/lib/server/owner/app-page.tsx, src/lib/server/skills/SandboxRunner.ts, src/worker/sandbox-probe.ts, src/worker/main.ts, src/lib/server/auth/auth-credential-hooks.ts, db/accounts.sql, src/worker/website-main.ts, src/lib/server/website/website-http-routes.ts, src/proxy.ts, src/lib/host-routing.ts, src/lib/server/auth/PrincipalResolver.ts, src/lib/youtube/youtube.ts, src/lib/server/youtube/YouTubeService.ts, src/lib/server/auth/EmailSender.ts, src/lib/server/auth/TokenVerifier.ts, src/lib/server/owner/owner-session.ts, src/lib/server/auth/README.md, src/lib/mcp-surface.ts, src/lib/docs/status.ts, src/lib/server/auth/BetterAuth.ts, src/lib/server/auth/GoogleProvider.ts, src/lib/server/auth/GitHubProvider.ts, .env.example, src/lib/mcp/agent-tools.ts, src/lib/server/mcp/AgentMcp.ts, src/lib/server/ops/capture.ts, src/lib/server/ops/DiscordWebhook.ts, src/worker/OpsAlerts.ts, src/lib/server/x/XPublishing.ts, src/components/owner/x-panel.tsx, db/x.sql, src/lib/server/media/MotionRenderer.ts, src/worker/FalProvider.ts, Dockerfile.worker, src/lib/server/auth/AuthEmail.ts, src/app/reset-password/page.tsx, src/components/owner/password-recovery.tsx, src/lib/server/media/MotionPlanner.ts, src/lib/server/media/MotionSceneWriter.ts, src/lib/server/media/MotionTranscriber.ts, src/lib/server/media/media-http.ts, src/lib/marketing/post-catalogue.ts, src/lib/marketing/post-scheduling.ts, src/lib/server/marketing/PostScheduling.ts, db/publishing.sql, src/components/owner/post-schedule-controls.tsx, src/lib/server/marketing/PostScheduledAdapters.ts, src/lib/server/tiktok/TikTokMedia.ts, src/lib/server/tiktok/TikTokAccounts.ts, src/lib/server/tiktok/TikTokAccountsPrivateDatabase.ts, db/tiktok.sql, src/lib/server/analytics/Analytics.ts, src/lib/server/analytics/posthog-cookie.ts, src/lib/server/analytics/signup-analytics.ts, src/lib/auth/signup-source.ts, db/migrations/20261124T1500_signup_source.sql, src/lib/server/owner/OwnerHandler.ts, src/app/.well-known/openai-apps-challenge/route.ts, src/worker/FeedbackNotifier.ts, src/lib/server/feedback/BuzzWebhook.ts, scripts/start.mjs, scripts/failure-throttle.mjs, src/lib/server/owner/first-video-ui.ts, src/lib/server/owner/manual-video-fallback.ts, src/lib/server/owner/owner-page.ts, src/components/first-video-context.tsx, src/lib/media/video-draft.ts, src/components/studio/use-video-draft.ts, src/components/studio/prompt-box.tsx, src/lib/server/elevenlabs/ElevenLabsVault.ts, src/lib/server/elevenlabs/ElevenLabsConnection.ts, src/lib/server/elevenlabs/ElevenLabsPrivateDatabase.ts, src/lib/server/elevenlabs/ElevenLabsVoices.ts, src/app/api/elevenlabs/route.ts, src/worker/AccountVoiceProvider.ts, src/components/owner/elevenlabs-account-section.tsx, db/migrations/20261110T1900_elevenlabs_connection.sql]
tools: [list_workspaces]
next: [/docs/start/first-call]
---
Connect agents to `https://mcp.shipcontent.com/mcp`. Open the human dashboard at `https://app.shipcontent.com`. Both hosts use the same backend, database and worker. Sign-in, consent and owner handoffs open on the dashboard. Agent discovery and machine documentation stay on the MCP host.

Set `RESEND_API_KEY` and `SHIPCONTENT_EMAIL_FROM` on the app server to send verification and password-reset emails. The example sender is `ShipContent <no-reply@shipcontent.com>`; its domain must be verified in Resend. Both flows set `Reply-To: support@shipcontent.com`, so replies reach the support inbox. Sending does not need a separate no-reply mailbox. Verification also accepts `SHIPCONTENT_AUTH_EMAIL_FROM`. Keep the key on the server. Signup sends a one-hour, single-use setup link when Resend is configured. Signup stores no usable password and creates no session. Open the setup email, choose your password, then sign in. If the setup link expires, use **Forgot password?** to get a new link. Google and GitHub require verified email; automatic linking also requires the existing local email to be verified. Google SSO sends no welcome or sign-in email. At `/login`, select **Forgot password?** to open `/reset-password`. Reset links expire after one hour, work once, and end browser sessions and MCP tokens, consent and grants after a successful reset. Reconnect each agent with new consent. A send receipt does not prove inbox delivery.

## Discover and authorize

A client can read `/.well-known/oauth-protected-resource/mcp` for the resource and authorization server. Start the MCP client's OAuth flow with its own state, PKCE S256 verifier, and callback. The owner signs in at `/login`, accepts the terms, and connects this exact client to all owned workspaces, including future ones, with one **Allow**. Signing in to the browser alone does not authorize a CLI.

### Redirect URIs

Dynamic client registration checks `application_type` against each redirect URI in `redirect_uris`. Send `application_type: native` for a CLI or desktop client. A native client can use `http://localhost:<port>/<path>`, `http://127.0.0.1:<port>/<path>`, or `http://[::1]:<port>/<path>`. Send `application_type: web` for a browser-based client; a web client needs an HTTPS redirect URI on a non-loopback host. A rejected redirect URI returns the error `invalid_redirect_uri` with the exact reason, for example a web client that sends a loopback or plain HTTP URI.

Updated 2026-10-29: registration and client updates refuse `backchannel_logout_uri` and `backchannel_logout_session_required`. A request with one of these fields gets HTTP 400 with the error `invalid_client_metadata`, and nothing is saved. Send the request again without these fields. The server sends no logout token to a client, and a back-channel logout URL that a client saved before this date is removed. The authorization server metadata can still show `backchannel_logout_supported: true`; do not send these fields.

The MCP audience must be the exact `/mcp` URL. `mcp:access` is the advertised resource scope; `offline_access` is available for refresh. Tokens are short-lived and each tool call checks the current account grant and workspace ownership.

For operators, point both domains to the same app service. Set `SHIPCONTENT_OWNER_ORIGIN` to `https://app.shipcontent.com`, `SHIPCONTENT_MCP_AUDIENCE` to `https://mcp.shipcontent.com/mcp`, and `SHIPCONTENT_PUBLIC_ORIGIN` to `https://mcp.shipcontent.com`. Keep `SHIPCONTENT_AUTH_ISSUER` at `https://mcp.shipcontent.com/api/auth` so saved identity mappings and agent tokens keep the same issuer.

Keep existing provider callback registrations on the MCP host. Browser GET callbacks forward to the same path on the dashboard, with query state intact. The shared backend checks the original OAuth state and uses the registered callback URL for token exchange. Cookies remain local to the dashboard host. Owners with a session on the old host must sign in on the dashboard once. Requests with bearer credentials and writes to the wrong host receive HTTP 421; send them to the canonical endpoint. Do not change the issuer or reset saved accounts for this split.

Google sign-in uses the production project's `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET` in the app service. Register the exact callback `https://mcp.shipcontent.com/api/auth/callback/google` in its Web application client. Keep those credentials on the server. Google sign-in changes the owner login method; it does not change the MCP client's OAuth scopes or account grant.

If the owner uses GitHub sign-in, configure a production GitHub OAuth App for the current canonical origin. On 2026-09-24 the live issuer is `https://mcp.shipcontent.com/api/auth`, so its GitHub callback is `https://mcp.shipcontent.com/api/auth/callback/github`. Confirm the live issuer before changing this registration. Set `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` as server secrets for the app service. Do not use the local OAuth App credentials in production. GitHub sign-in does not grant MCP access; the owner must still consent to the client and grant workspace actions.

Password signup sends a one-hour, single-use setup link and grants no session. The mailbox owner chooses a password, signs in, and continues to client consent. Operators must configure `RESEND_API_KEY` and `SHIPCONTENT_EMAIL_FROM` on the app server with a verified Resend sending domain. Verification also accepts `SHIPCONTENT_AUTH_EMAIL_FROM`. Test real inbox delivery before release. Local tests do not prove provider or production delivery.

The server checks the current account's verified email before owner or MCP access. Google and GitHub can link on a matching email only when both addresses are verified. Sign-in still requires separate MCP client consent and workspace access.

## Call the server

For a direct JSON-RPC POST, send a bearer token, `Content-Type: application/json`, `Accept: application/json, text/event-stream`, and the protocol headers your MCP client supplies. Modern calls need `Mcp-Method`; `tools/call` also needs `Mcp-Name` matching the tool name. A supported MCP client handles this. Start with `list_workspaces`, then pass a returned `workspaceId` to other tools.

A browser GET to `/mcp` can redirect to `/login`. An MCP client receives an OAuth challenge instead. A `401` response names the protected-resource metadata. A `403` means the client is disconnected or the workspace does not belong to its owner; ask the owner to review `/agent-access`.

Updated October 23, 2026: the server answers HTTP `429` to a client that keeps failing. Two endpoints count separately. On `/mcp` (signed upload URLs under `/mcp/uploads/` do not count), a failure is a `401` or `403`. On `POST /api/auth/oauth2/token`, a failure is a `400` or `401`. The server counts failures for one client: the same client address, the same `Authorization` header value and the same `User-Agent` header value. A second client behind the same address, with another token or another user agent, has its own count. The window is 10 minutes long and starts at the first failure. When one client reaches 20 failures on one endpoint in that window, every later request from that client to that endpoint gets `429` until the window ends. The server does not run the request. The response has a `Retry-After` header with the seconds left, rounded up, and this body:

```json
{
  "error": "rate_limited",
  "error_description": "Too many failed requests. Retry after 120 seconds."
}
```

Wait the number of seconds in `Retry-After`. Fix the cause before you try again, for example renew the OAuth session or the client credentials. Do not retry in a loop. A successful (2xx) response for the same client and endpoint resets its count. A request that has an `Origin` header from another site is never counted and never limited, because a web page of another site can make a visitor's browser send failing requests. MCP and OAuth clients send no `Origin` header. The server finds the client address in the `x-real-ip` header that the host sets. A request without that header is not limited. The count is in server memory, so a restart clears it.

## What connection proves

A successful connection proves the client can authenticate to this deployment. It does not prove a provider account is connected, a draft is approved, a queued job was delivered, or TikTok remote writes are available. Read the saved state and the [status page](/docs/status).

YouTube operators configure `YOUTUBE_CLIENT_ID`, `YOUTUBE_CLIENT_SECRET`, `SHIPCONTENT_YOUTUBE_VAULT_ACTIVE_KEY_ID` and `SHIPCONTENT_YOUTUBE_VAULT_KEYS`. See [YouTube setup](/docs/channels/youtube#operator-setup).

## X publishing configuration

X is optional. Configure `SHIPCONTENT_X_CLIENT_ID` and `SHIPCONTENT_X_CLIENT_SECRET` for the confidential web app. Use `SHIPCONTENT_X_CONNECTION_DATABASE_URL` for the connection role and `SHIPCONTENT_X_WORKER_DATABASE_URL` for the worker role. Set `SHIPCONTENT_X_VAULT_ACTIVE_KEY_ID` and `SHIPCONTENT_X_VAULT_KEYS` to an active key ID and a JSON map of key IDs to base64 32-byte keys. Keep old keys while saved credentials use them.

X publishing is on when `SHIPCONTENT_X_CLIENT_ID` and `SHIPCONTENT_X_CLIENT_SECRET` are set. X bills API use to the developer account; ShipContent sets no API budget.

The isolated bootstrap creates X connection and worker logins. Existing hosted data needs a reviewed, data-preserving schema update; do not reset a saved production database. See [X publishing](/docs/channels/x).

## Video configuration

Updated 2026-10-26: `SHIPCONTENT_FIRST_VIDEO_UI_USERS` is a server-only presentation selector for both local and hosted use. Empty, unset or invalid lists are off. A comma-separated list of owner UUIDs enables the first-video controls for those owners. `*` is reserved for a separately approved broad rollout. Resolve it from the signed-in owner; a query or browser preference cannot enable it. This grants no access and changes no billing or paid-style entitlement. Disabled UI leaves saved native projects and exports readable.

Updated 2026-11-02: `SHIPCONTENT_MANUAL_VIDEO_FALLBACK` is on when unset, in local and hosted use. When AI planning is unavailable, every owner can make a text video by hand from Studio. Set it to `0`, `false`, `off` or `no` to offer the manual path only to first-video UI owners. It needs no provider, grants no access and changes no price.

See [Start a project](/docs/workflows/videos#start-a-project) for the manual path and its memory limits, and [Export](/docs/workflows/videos#export) for render pricing. Provider-backed planning remains separately configured, priced and approved.

Updated 2026-11-13: `SHIPCONTENT_STUDIO_PROJECT_USERS` turns on Studio video projects (idea, script, storyboard, video) for the listed owners. It is a server-only, comma-separated list of owner UUIDs. `*` allows every owner. Unset, empty or a list with an invalid item allows no owner. It grants no other access and changes no price. For an owner who is not on the list, `GET /api/motion/projects/{id}/quote` returns `NOT_FOUND` before it reads the project. The route returns the credit price of each next step of one project from the applied prices, and the owner's available credits. Before you turn it on in production, apply catalogue revision 2026-11-13: it adds the `ai.motion.story`, `ai.motion.shot` and `ai.motion.describe` prices.

Updated 2026-11-19: `SHIPCONTENT_STUDIO_VIDEO_USERS` turns on video, carousel and voice work for the listed owners. It is a server-only, comma-separated list of owner UUIDs. `*` allows every owner. Unset, empty or a list with an invalid item allows no owner. Video projects and video skill runs also need this list, in addition to `SHIPCONTENT_STUDIO_PROJECT_USERS` and `SHIPCONTENT_VIDEO_SKILLS_USERS`. For an owner who is not on the list, the motion and render routes, video and voice generations, their approval, `propose_render` and the project write tools return `NOT_FOUND` before they read or save anything. Image generation and reading the skill directory stay open to every owner. Set it before you deploy, or video stops for every owner.

Updated 2026-11-04: `SHIPCONTENT_STUDIO_VIDEO_DRAFT` is on when unset, in local and hosted use. Studio keeps the Video form as a draft in the browser, per owner, workspace and format. Set it to `0`, `false`, `off` or `no` to keep nothing on the device and hide the "Draft saved on this device" note. It grants no access and changes no price. Updated 2026-11-05: with first-video controls enabled, saved status appears on the brief row instead of that separate note. Restore uses `readVideoDraft` in `src/lib/media/video-draft.ts`. That returns null when the saved string is empty, `JSON.parse` throws, the root is not a plain object, or the top-level Zod `safeParse` fails; those cases restore nothing into the form. When the root is a plain object that parses, unknown keys are ignored, wrong types on known fields become that field's default, over-long briefs become an empty string, and invalid or over-long reference ids become an empty list; wrong types do not force null for the whole draft. A value that parses to only defaults (for example `{}` or foreign keys only) is empty-equivalent, so the form keeps its initial choices and nothing restores into the fields.

Set `OPENAI_API_KEY` on the app server for the AI actions of the video editor: the first cut from a brief, **Add a hook**, animation chat edits and **Ask AI** text proposals. Owners select Astra 6, Sol 6, or Luna 6 for the first cut. Updated 2026-11-07: with `FAL_KEY` set and `MOTION_OPUS_PLANNER_ENABLED` exactly `true`, the first cut of a video with no attached media plans on fal Opus without `OPENAI_API_KEY`. A still format, a first cut with attached media, **Add a hook** and **Ask AI** text proposals still need `OPENAI_API_KEY`. Without it, they return `MOTION_NOT_CONFIGURED` before any reservation. Transcription (Scribe v2) and built-in voiceover (Eleven v4) call ElevenLabs with the server `ELEVENLABS_API_KEY`. Updated 2026-11-11: a Studio voiceover with a connected owner account voice uses that owner's key and the vault settings below. Updated 2026-11-02: they no longer use the fal.ai key. The worker needs Chromium for video renders. The worker Docker image includes it. For local use, set `SHIPCONTENT_MOTION_BROWSER_PATH` to an installed Chrome or Chromium executable; if omitted, the renderer uses its managed browser. The worker build includes the video template and fonts. Video renders can run without a fal.ai key. See [Make a video](/docs/workflows/videos).

Updated 2026-10-27: with a complete Vercel sandbox configuration, each media
worker start, including `--once`, creates a short sandbox probe. This can incur
sandbox charges. Success logs
`sandbox_probe` with team, project, region, elapsed time and list cost. A refusal
logs `sandbox_probe_refused` and leaves media work running. Replace a refused
token or resolve the paused project, then restart the worker to probe again.
The worker does not repeat the provider probe every ten seconds. A successful
probe proves sandbox access only. See the [Studio workflow](/docs/workflows/videos)
for the supported video actions.

## Website import configuration

Updated October 19, 2026: website imports run in a separate worker service with no provider secrets. Set `FIRECRAWL_API_KEY` to scan a website and `OPENAI_API_KEY` to analyze it, on that service and on the app server. The app server uses them to show whether imports and analysis are available. Use a separate OpenAI project key with a monthly budget for the website worker.

## Scheduled publishing configuration

Updated 2026-10-28. No operator flag controls scheduled publishing. A scheduled Instagram, YouTube, X, Facebook or Threads post needs the configuration of its channel. A scheduled YouTube upload keeps the visibility the owner saved. See [channel limits](/docs/channels/overview) and [scheduling errors](/docs/contracts/errors#scheduling-errors).

TikTok Accounts uses `TIKTOK_BUSINESS_APP_ID`, `TIKTOK_BUSINESS_APP_SECRET`, `TIKTOK_ACCOUNTS_AUTHORIZATION_URL` and `TIKTOK_ACCOUNTS_REDIRECT_URI`. Configure its separate `SHIPCONTENT_TIKTOK_ACCOUNTS_CONNECTION_DATABASE_URL`, `SHIPCONTENT_TIKTOK_ACCOUNTS_VAULT_ACTIVE_KEY_ID` and `SHIPCONTENT_TIKTOK_ACCOUNTS_VAULT_KEYS`. The schema bootstrap needs `SHIPCONTENT_BOOTSTRAP_TIKTOK_ACCOUNTS_CONNECTION_PASSWORD`. Register the exact HTTPS callback with its final slash. See [TikTok operator setup](/docs/channels/tiktok#operator-setup). Local tests use fake provider responses; a live TikTok return requires the registered HTTPS owner host.

Updated 2026-11-10: an owner on the video-skills list can connect their own ElevenLabs account in Settings. The app and the worker need `SHIPCONTENT_ELEVENLABS_VAULT_ACTIVE_KEY_ID` and `SHIPCONTENT_ELEVENLABS_VAULT_KEYS`: the key ID and a JSON map of base64 32-byte AES keys. Keep old keys while saved owner keys use them. The app saves the sealed owner key through the restricted connection database login. Without the vault settings the Settings card cannot connect, and voiceover keeps the built-in voices on `ELEVENLABS_API_KEY`.

For TikTok video retrieval, set `TIKTOK_ACCOUNTS_MEDIA_ORIGIN` to an owned HTTPS origin. Verify its URL ownership in TikTok before a publication send. A localhost origin cannot serve a live TikTok download.

## Signup analytics configuration

Signup funnel analytics are optional. Set `SHIPCONTENT_POSTHOG_KEY` on the app server to send `signup_started` and `signup_completed` events to PostHog. `SHIPCONTENT_POSTHOG_HOST` is optional; it defaults to the EU region. Each event carries its name, the owner's user ID or the landing's anonymous ID and the sign-in method; `signup_completed` also carries the saved source values. No event carries an email, a name, a token, or an IP address. The server links a landing visitor's anonymous ID to the signed-in owner when the browser sends the matching `ph_<key>_posthog` cookie. `signup_started` fires only for the password sign-up flow. Updated 2026-11-24: when a person opens `/login`, `/agent-access` or a signed-out app page with `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term` or `ref` (`via` means `ref`) in the link, the server saves those values once, when the account is created, and never replaces them. A saved value has at most 100 characters, starts with a letter or digit, and has only lower-case letters, digits, `.`, `_`, `~` and `-`; the server saves an upper-case letter as lower case and drops any other value. `signup_completed` carries the saved values as properties with the same names. No cookie holds them. The admin Users page shows the saved source and the first agent client of each account.

For OpenAI plugin domain verification, set `SHIPCONTENT_OPENAI_APPS_CHALLENGE` on the app service to the exact public token from the submission portal. `/.well-known/openai-apps-challenge` returns only that token as plain text with no cache on the MCP host. It returns HTTP 404 when the value is empty. Keep the token in the service configuration; do not put it in the plugin ZIP.

## Feedback notifications

The **Feedback** dialog saves each message in PostgreSQL. The worker then posts it to a dedicated Buzz workflow in the feedback channel.

1. In Buzz, create a private feedback channel if it does not exist. Feedback can contain user emails and screenshot links. In that channel, create this workflow:

   ```yaml
   name: "Feedback"
   description: "ShipContent in-app feedback"
   trigger:
     on: webhook
   steps:
     - id: post
       action: send_message
       text: "{{trigger.summary}}"
   ```

2. Copy that workflow's HTTPS webhook URL and secret to `SHIPCONTENT_BUZZ_WEBHOOK_URL` and `SHIPCONTENT_BUZZ_WEBHOOK_SECRET` on the Railway **worker** service. Use `--skip-deploys` when setting them before the planned release; the next worker deployment applies them.
3. Keep the existing PR workflow and its GitHub secret unchanged. The Feedback workflow posts to its own channel, so it needs no `channel:` override or `if:` step. The payload still carries `event: "feedback"`.

Without both values, feedback stays saved and the worker posts it after the settings take effect. A failed post is tried again after 1 minute, 5 minutes, 30 minutes, 2 hours, then every 6 hours. The screenshot link in a post expires after 7 days.

## Log capture configuration

Updated October 23, 2026: set `SHIPCONTENT_LOG_CAPTURE` to `on` on the app server and on each worker service to store their log lines in PostgreSQL for 14 days. Any other value, or no value, keeps capture off. A change needs a new deploy. The lines also keep going to the normal host output. Each stored line has a request ID that links the request line to the log lines of the same request. Query strings, upload tokens, keys and email addresses are removed before a line is stored. Capture never delays a request: when the database is slow, the process drops lines and prints how many.

Updated October 23, 2026: set `SHIPCONTENT_ALERT_DISCORD_WEBHOOK_URL` on the `worker` service to send production alerts to a Discord channel. The URL holds a secret token, so keep it on the worker only. Alerts need `SHIPCONTENT_LOG_CAPTURE=on` on the app, the worker and the website worker. While one of the three has not stored a batch for 3 minutes, no problem opens and none recovers. The worker checks the stored failures every minute. It posts one message when a problem opens and one when it recovers. Give the worker the same admin origin setting as the app, so each message links to the Logs tab. Without it the message has no link. Without the webhook URL, problems still open in the admin panel, nothing is sent, and the worker prints `ops_alerts_not_configured` at start when capture is on. If Discord refuses the webhook (HTTP 401, 403 or 404), the worker stops sending. A restart with the same URL keeps the stop. Replace the URL and deploy the worker to send again. If the worker stops after Discord accepts a message and before the worker saves that fact, Discord can show the message twice. A change needs a new deploy.

## Meta channel configuration

Facebook Login for Business and Threads use separate product credentials, vaults and restricted connection/worker database logins. Configure their registered callbacks and apply forward migrations before opening Connect. For saved databases, use the transactional Meta role provisioner after migrations; do not reset saved data. See [Facebook operator setup](/docs/channels/facebook#operator-setup) and [Threads operator setup](/docs/channels/threads#operator-setup). Keys and tokens stay on the server. A successful local setup does not prove live channel acceptance.

Password signup uses a mailbox setup link. Choose your password from that link before signing in. Password recovery ends existing browser sessions and agent credentials; sign in and reconnect each agent with new consent.
