{"components":{"schemas":{"DeviceLogin":{"additionalProperties":false,"properties":{"device_code":{"type":"string"},"expires_in":{"type":"integer"},"instructions":{"type":"string"},"interval":{"type":"integer"},"session_token":{"description":"Temporary plugin bearer credential. This is not a Trakt token. Use only to confirm this login.","type":"string"},"user_code":{"type":"string"},"verification_url":{"format":"uri","type":"string"}},"required":["device_code","user_code","verification_url","expires_in","interval","instructions"],"type":"object"},"Error":{"additionalProperties":false,"properties":{"error":{"type":"string"},"retry_after":{"type":["integer","null"]}},"required":["error"],"type":"object"},"Media":{"additionalProperties":true,"properties":{"first_aired":{"type":["string","null"]},"genres":{"items":{"type":"string"},"type":"array"},"ids":{"additionalProperties":true,"type":"object"},"released":{"type":["string","null"]},"title":{"type":"string"},"year":{"type":["integer","null"]}},"type":"object"},"Page":{"additionalProperties":false,"properties":{"data":{"items":{"additionalProperties":true,"type":"object"},"type":"array"},"filters_applied_to_page":{"type":"boolean"},"pagination":{"additionalProperties":false,"properties":{"item_count":{"type":["integer","null"]},"limit":{"type":["integer","null"]},"page":{"type":["integer","null"]},"page_count":{"type":["integer","null"]}},"required":[],"type":"object"}},"required":["data","pagination"],"type":"object"},"PluginTokens":{"additionalProperties":false,"properties":{"access_token":{"type":"string"},"expires_in":{"type":"integer"},"refresh_token":{"type":"string"},"scope":{"type":"string"},"token_type":{"const":"Bearer","type":"string"}},"required":["access_token","token_type","expires_in","refresh_token"],"type":"object"}},"securitySchemes":{"bearerAuth":{"scheme":"bearer","type":"http"},"oauth":{"flows":{"authorizationCode":{"authorizationUrl":"https://trakt.swacktech.com/oauth/authorize","scopes":{"trakt:read":"Read personal Trakt data"},"tokenUrl":"https://trakt.swacktech.com/oauth/token"}},"type":"oauth2"}}},"info":{"description":"Multi-user Trakt integration. Each authorization is isolated. Credentials issued by this service are distinct from Trakt access/refresh tokens.","title":"Trakt MCP API","version":"1.0.0"},"openapi":"3.1.0","paths":{"/.well-known/ai-plugin.json":{"get":{"description":"Public service metadata.","operationId":"pluginManifest","responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object"}}},"description":"Success"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Authorization required"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limited; observe Retry-After"},"502":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Trakt upstream unavailable or invalid"}},"security":[]}},"/.well-known/oauth-authorization-server":{"get":{"description":"Public service metadata.","operationId":"authorizationMetadata","responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object"}}},"description":"Success"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Authorization required"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limited; observe Retry-After"},"502":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Trakt upstream unavailable or invalid"}},"security":[]}},"/.well-known/oauth-protected-resource":{"get":{"description":"Public service metadata.","operationId":"resourceMetadata","responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object"}}},"description":"Success"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Authorization required"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limited; observe Retry-After"},"502":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Trakt upstream unavailable or invalid"}},"security":[]}},"/auth/device/code":{"post":{"description":"Start a separate user connection with Trakt device flow. Display user_code and verification_url explicitly. Public calls return a temporary session_token; authenticated calls reconnect the current user. Wait interval seconds before polling.","operationId":"requestDeviceLogin","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceLogin"}}},"description":"Success"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Authorization required"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limited; observe Retry-After"},"502":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Trakt upstream unavailable or invalid"}},"security":[]}},"/auth/device/token":{"post":{"description":"Poll once using the temporary session_token as Bearer and the matching device_code. Pending=400, invalid=404, used=409, expired=410, denied=418, slow_down=429. Successful tokens are plugin credentials; Trakt tokens remain private.","operationId":"confirmDeviceLogin","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"device_code":{"type":"string"}},"required":["device_code"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PluginTokens"}}},"description":"Success"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Authorization required"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limited; observe Retry-After"},"502":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Trakt upstream unavailable or invalid"}}}},"/auth/session":{"delete":{"description":"Delete this connection, its stored Trakt tokens, KV cache and open SSE streams. Does not change watch history. Revoke the Trakt app separately in Trakt account settings.","operationId":"deleteConnection","responses":{"204":{"description":"Connection deleted"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Authorization required"}}}},"/health":{"get":{"description":"Public service metadata.","operationId":"health","responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object"}}},"description":"Success"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Authorization required"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limited; observe Retry-After"},"502":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Trakt upstream unavailable or invalid"}},"security":[]}},"/mcp":{"post":{"description":"MCP JSON-RPC 2.0 over stateless Streamable HTTP. Supports initialize, ping, tools/list and tools/call. Notifications return empty 202. No batches. Supported protocol versions: 2024-11-05, 2025-03-26, 2025-06-18.","operationId":"mcpRequest","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"id":{"type":["string","integer"]},"jsonrpc":{"const":"2.0","type":"string"},"method":{"type":"string"},"params":{"additionalProperties":true,"type":"object"}},"required":["jsonrpc","method"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object"}}},"description":"Success"},"202":{"description":"Notification accepted; no body"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Authorization required"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limited; observe Retry-After"},"502":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Trakt upstream unavailable or invalid"}}}},"/messages":{"post":{"description":"Send JSON-RPC on a live legacy SSE channel. The response is delivered as a message event on that channel.","operationId":"legacyMcpMessage","parameters":[{"in":"query","name":"session_id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"id":{"type":["string","integer"]},"jsonrpc":{"const":"2.0","type":"string"},"method":{"type":"string"},"params":{"additionalProperties":true,"type":"object"}},"required":["jsonrpc","method"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{},"required":[],"type":"object"}}},"description":"Success"},"202":{"description":"Accepted; response delivered over SSE"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Authorization required"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limited; observe Retry-After"},"502":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Trakt upstream unavailable or invalid"}}}},"/oauth/authorize":{"get":{"description":"Browser authorization and explicit consent. Public clients require code_challenge_method=S256. Exact registered redirect required.","operationId":"authorizeClient","parameters":[{"in":"query","name":"client_id","required":true,"schema":{"type":"string"}},{"in":"query","name":"redirect_uri","required":true,"schema":{"type":"string"}},{"in":"query","name":"response_type","required":true,"schema":{"type":"string"}},{"in":"query","name":"state","required":false,"schema":{"type":"string"}},{"in":"query","name":"scope","required":false,"schema":{"type":"string"}},{"in":"query","name":"resource","required":false,"schema":{"type":"string"}},{"in":"query","name":"code_challenge","required":false,"schema":{"type":"string"}},{"in":"query","name":"code_challenge_method","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"text/html":{"schema":{"type":"string"}}},"description":"Browser consent page"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Authorization required"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limited; observe Retry-After"},"502":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Trakt upstream unavailable or invalid"}},"security":[]}},"/oauth/complete":{"post":{"description":"Browser-internal device authorization. Requires a short-lived ticket from the consent page.","operationId":"completeBrowserLogin","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"action":{"enum":["start","poll"],"type":"string"},"session_id":{"type":"string"},"ticket":{"type":"string"}},"required":["session_id","ticket","action"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object"}}},"description":"Success"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Authorization required"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limited; observe Retry-After"},"502":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Trakt upstream unavailable or invalid"}},"security":[]}},"/oauth/register":{"post":{"description":"Register exact HTTPS or loopback callback URIs. Public clients must use S256 PKCE. Confidential OpenAPI Actions clients may request client_secret_post; keep the returned secret private.","operationId":"registerOAuthClient","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"client_name":{"type":"string"},"redirect_uris":{"items":{"format":"uri","type":"string"},"maxItems":10,"minItems":1,"type":"array"},"token_endpoint_auth_method":{"enum":["none","client_secret_post"],"type":"string"}},"required":["redirect_uris"],"type":"object"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object"}}},"description":"Success"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Authorization required"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limited; observe Retry-After"},"502":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Trakt upstream unavailable or invalid"}},"security":[]}},"/oauth/token":{"post":{"description":"Exchange a single-use authorization code plus verifier, or rotate a plugin refresh token. The optional resource must equal the deployment resource URL advertised by OAuth discovery (including its trailing slash). Client-bound tokens require the original client_id and confidential client secret where applicable.","operationId":"exchangePluginToken","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"client_id":{"type":"string"},"client_secret":{"type":"string"},"code":{"type":"string"},"code_verifier":{"type":"string"},"grant_type":{"type":"string"},"redirect_uri":{"type":"string"},"refresh_token":{"type":"string"},"resource":{"type":"string"}},"required":["grant_type"],"type":"object"}},"application/x-www-form-urlencoded":{"schema":{"additionalProperties":false,"properties":{"client_id":{"type":"string"},"client_secret":{"type":"string"},"code":{"type":"string"},"code_verifier":{"type":"string"},"grant_type":{"type":"string"},"redirect_uri":{"type":"string"},"refresh_token":{"type":"string"},"resource":{"type":"string"}},"required":["grant_type"],"type":"object"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PluginTokens"}}},"description":"Success"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Authorization required"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limited; observe Retry-After"},"502":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Trakt upstream unavailable or invalid"}},"security":[]}},"/openapi.json":{"get":{"description":"Public service metadata.","operationId":"openApiSchema","responses":{"200":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object"}}},"description":"Success"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Authorization required"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limited; observe Retry-After"},"502":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Trakt upstream unavailable or invalid"}},"security":[]}},"/recommendations":{"get":{"description":"Get Trakt's personalized ranking using its viewing/preferences signals. Select movie or show, optionally filter genres and years; 1-100 results. No separate model is trained by this service.","operationId":"getRecommendations","parameters":[{"in":"query","name":"media_type","required":false,"schema":{"description":"Movie or show; all is supported by search/history only.","enum":["movie","show","movies","shows"],"type":"string"}},{"in":"query","name":"genres","required":false,"schema":{"description":"Comma separated lowercase Trakt genre slugs.","maxLength":200,"type":"string"}},{"in":"query","name":"years","required":false,"schema":{"description":"Year or inclusive ascending year range.","pattern":"^[0-9]{4}(-[0-9]{4})?$","type":"string"}},{"in":"query","name":"limit","required":false,"schema":{"default":20,"maximum":100,"minimum":1,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Page"}}},"description":"Success"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Authorization required"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limited; observe Retry-After"},"502":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Trakt upstream unavailable or invalid"}}}},"/search":{"get":{"description":"Search movies/shows. Genre and year filters apply locally to one returned upstream page. Pagination counts describe the upstream unfiltered result; filters_applied_to_page makes this explicit.","operationId":"searchMedia","parameters":[{"in":"query","name":"media_type","required":false,"schema":{"description":"Movie or show; all is supported by search/history only.","enum":["movie","show","movies","shows","all"],"type":"string"}},{"in":"query","name":"query","required":true,"schema":{"description":"Search text; URL encode reserved characters.","maxLength":500,"minLength":1,"type":"string"}},{"in":"query","name":"genres","required":false,"schema":{"description":"Comma separated lowercase Trakt genre slugs.","maxLength":200,"type":"string"}},{"in":"query","name":"years","required":false,"schema":{"description":"Year or inclusive ascending year range.","pattern":"^[0-9]{4}(-[0-9]{4})?$","type":"string"}},{"in":"query","name":"limit","required":false,"schema":{"default":20,"maximum":100,"minimum":1,"type":"integer"}},{"in":"query","name":"page","required":false,"schema":{"default":1,"maximum":10000,"minimum":1,"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Page"}}},"description":"Success"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Authorization required"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limited; observe Retry-After"},"502":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Trakt upstream unavailable or invalid"}}}},"/sse":{"get":{"description":"Legacy MCP SSE. First endpoint event gives the POST /messages URL. Send the same Bearer credential on both requests. Maximum eight streams per connection. Reconnect and reinitialize after stream loss.","operationId":"openLegacySse","responses":{"200":{"content":{"text/event-stream":{"schema":{"type":"string"}}},"description":"Persistent SSE stream"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Authorization required"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limited; observe Retry-After"},"502":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Trakt upstream unavailable or invalid"}}}},"/sync/watched":{"get":{"description":"Read watched summaries with full movie/show metadata, genres, release dates and play counts. This is not a play-event feed. The all option returns movies and shows separately. Upstream pagination metadata is preserved when present.","operationId":"getWatchedHistory","parameters":[{"in":"query","name":"media_type","required":false,"schema":{"description":"Movie or show; all is supported by search/history only.","enum":["movie","show","movies","shows","all"],"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/Page"},{"additionalProperties":false,"properties":{"movies":{"$ref":"#/components/schemas/Page"},"shows":{"$ref":"#/components/schemas/Page"}},"required":["movies","shows"],"type":"object"}]}}},"description":"Success"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Invalid request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Authorization required"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Rate limited; observe Retry-After"},"502":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Trakt upstream unavailable or invalid"}}}}},"security":[{"oauth":[]}],"servers":[{"url":"https://trakt.swacktech.com"}]}