MCP server

Connect Claude Code

Both ways to add the Pitvi MCP server, and when each one is the right call.

Claude Code supports both an API key and OAuth. Pick by whether a browser is going to be available when the connection is made.

With an API key

The one that works everywhere, including in a script or a claude -p run where there is no interactive session to sign in from.

Create a key

Open Settings > Connections in Pitvi, give the key a name you will recognise later, and copy it. The full value is shown once. Only a hash is stored, so it cannot be shown again.

Add the server

claude mcp add --transport http \
  --header "Authorization: Bearer pitvi_sk_your_key_here" \
  pitvi https://api.pitvi.com/api/mcp

Every flag goes before the server name. claude mcp add writes the config without checking the credential, so a typo shows up later as a failed connection rather than here.

Check it

claude mcp list

pitvi should read as connected. Then ask for something:

List my Pitvi videos and tell me which one is longest.

With OAuth

No credential to copy or store. Claude Code registers itself, opens a browser, and you approve on a consent screen.

Add the server with no header

claude mcp add --transport http pitvi https://api.pitvi.com/api/mcp

Sign in

claude mcp login pitvi

A browser opens on the Pitvi consent screen. Approve, and the token is stored and refreshed for you. From inside a session, /mcp does the same thing.

On a machine with no browser, such as over SSH, add --no-browser: the command prints the URL, you open it elsewhere, and paste the redirect back.

OAuth needs an interactive session. In claude -p or an Agent SDK run there is no /mcp panel, so the flow cannot run and the tools stay unavailable until someone signs in from a normal session. For anything automated, use a key.

If it will not connect

Needs authentication. The key is wrong, revoked, or belongs to another account. Note that if you configured an Authorization header and the server rejects it, Claude Code reports a failed connection rather than falling back to OAuth. Remove the header to use the OAuth path.

Failed to connect. Check the URL includes /api/mcp. The bare origin is not the endpoint.

Something you edited is gone. An editor tab was open on the same video and its auto-save overwrote the change. Pass expectedUpdatedAt on writes, or close the tab. See the MCP overview.