# PeerTube MCP

> PeerTube MCP Server gives your AI agent direct access to the decentralized video ecosystem. Manage feeds and download content from PeerTube instances using natural language commands. It lets you interact with a federated, open-source alternative to centralized platforms, handling everything from user registration to private file retrieval.

## Overview
- **Category:** loved-by-devs
- **Price:** Free
- **Tags:** decentralized, fediverse, video-hosting, rss-feeds, content-discovery, open-source

## Description

Listen up. The **PeerTube MCP Server** gives your AI agent direct access to the whole decentralized video ecosystem. You can manage feeds and download content from PeerTube instances using natural language commands. It lets you interact with a federated, open-source alternative, handling everything from user registration right through to private file retrieval. 

When you use this server, your agent knows exactly how to operate across public streams, private accounts, and background tasks.

**Video Discovery and Streaming**

You want to check out what's happening online? You can first run `get_video_feeds` to pull the core list and metadata for video feeds from whatever PeerTube instance you connect to. If you just need a quick look at publicly available content, use `get_public_web_video`; that function grabs a direct file link for any web-hosted video.

For proper streaming playback, you gotta get the manifest file using `get_public_hls_playlist`. This retrieves the HLS playlist necessary to stream public videos robustly. To read what people are saying about a specific piece of media, your agent calls `get_video_comments_feed`, which pulls a complete feed of comments tied to a video ID.

**Authentication and Account Management**

If you're dealing with private or protected content, authentication is key. You can create a new user account on the specified PeerTube instance by running `register_user`. After that, your agent acquires the necessary access token using `get_user_token` to authorize all subsequent API calls.

For deeper integration, you'll need OAuth 2.0 credentials; run `get_local_oauth_clients` to retrieve your local Client ID and Secret for authorization flows. If the video itself is private, use `get_private_web_video`. This requires a specific videoFileToken to access protected media.

**Content Retrieval and Status Checks**

Once you've got the right links or tokens, getting the final content is straightforward. To pull the actual file for public videos, you rely on `get_public_web_video`. If you just need a single downloadable link for any video, `generate_video_download` creates that usable download URL.

Finally, if any process runs in the background—like transcoding a video or completing a complex federation task—you can check on its status using `get_completed_jobs` to monitor whether those jobs finished successfully and are ready for viewing.

## Tools

### generate_video_download
Creates a direct, usable download link for a specified video file.

### get_completed_jobs
Checks the status of background tasks that require authentication to view results.

### get_local_oauth_clients
Retrieves your local Client ID and Secret needed for OAuth 2.0 authorization flows.

### get_private_web_video
Fetches a private web video file, requiring a specific videoFileToken for access.

### get_public_hls_playlist
Retrieves the manifest playlist necessary to stream public videos using HLS protocol.

### get_public_web_video
Gets a direct file link for any publicly available web video.

### get_user_token
Acquires the necessary user access token to authorize subsequent API calls.

### get_video_comments_feed
Retrieves a complete feed of comments associated with a specific video ID.

### get_video_feeds
Fetches the core list and metadata for video feeds from your connected PeerTube instance.

### register_user
Creates a new user account on the specified PeerTube instance.

## Prompt Examples

**Prompt:** 
```
Retrieve the local OAuth client credentials for this PeerTube instance.
```

**Response:** 
```
I've retrieved the OAuth client details. The Client ID is `...` and the Client Secret is `...`. You can use these to request a user token.
```

**Prompt:** 
```
Show me the latest video comments feed in JSON format.
```

**Response:** 
```
Fetching the comments feed... I've found the latest comments in JSON format. Would you like me to summarize the most recent discussions?
```

**Prompt:** 
```
Generate a download link for the video with ID 'a1b2c3d4'.
```

**Response:** 
```
Processing request... I have generated a download link for video 'a1b2c3d4'. You can access the mp4 file here: [Link].
```

## Capabilities

### Find public video streams
Use `get_public_web_video` to fetch a direct link for publicly available web-hosted videos.

### Stream HLS playlists
Get the manifest file using `get_public_hls_playlist`, which is necessary for robust, streaming video playback.

### Manage user accounts
Register new users or obtain access tokens needed to interact with private content via `register_user` and `get_user_token`.

### Retrieve private files
Use `get_private_web_video` when you have a videoFileToken, allowing your agent access to protected media.

### Check job status
Run `get_completed_jobs` to monitor whether background processes like transcoding finished successfully.

## Use Cases

### A developer needs OAuth tokens
The dev needs client access data to build a third-party dashboard. Instead of checking documentation and manually hitting the API, they prompt their agent: 'Give me the local OAuth credentials.' The agent uses `get_local_oauth_clients` and returns the Client ID and Secret immediately.

### A creator wants to analyze public discussions
A researcher wants to gauge sentiment on a popular video. They ask their agent to 'Get the comments feed for this video.' The agent runs `get_video_comments_feed`, returning structured data that can be immediately summarized or analyzed in bulk.

### Finding and downloading private content
A user has a restricted link to internal footage. They tell their agent, 'Download the video at this token.' The agent uses `get_private_web_video` with the provided file token, bypassing public access restrictions.

### Monitoring large content uploads
A team uploaded 50 videos for transcoding. Instead of logging into the admin panel repeatedly, they prompt their agent: 'What's the status of the video jobs?' The agent calls `get_completed_jobs` and gives a single, clear report on success/failure.

## Benefits

- Access complex metadata using `get_video_feeds`. Instead of navigating multiple RSS or JSON endpoints, you ask your agent for the feed data directly. This handles pagination and format parsing automatically.
- Stream videos reliably by calling `get_public_hls_playlist`. You get the HLS manifest needed for robust playback in any modern player, bypassing single-file download limitations.
- Handle authentication securely with `get_user_token`. Your agent grabs the necessary token and keeps it ready for calls to both public and private tools like `get_private_web_video`.
- Monitor large jobs using `get_completed_jobs`. You don't have to manually check a dashboard; just ask your agent, 'Did the transcoding job finish?' and get an immediate status update.
- Build full user pipelines. Use `register_user` first, then use the resulting credentials to fetch content or manage feeds for that new account.

## How It Works

The bottom line is that you feed the server an instance URL and let your agent execute complex video operations through simple chat prompts.

1. First, subscribe to the server and provide your target PeerTube Instance URL.
2. Next, if you need private content or admin rights, use `get_user_token` to obtain a valid access token.
3. Finally, run commands like `get_video_feeds` or `generate_video_download` within your AI client using the established connection.

## Frequently Asked Questions

**How do I get a download link using generate_video_download?**
You pass the video ID and necessary tokens to `generate_video_download`. The tool executes the request and returns a direct, usable URL for the file.

**Do I need to use get_public_hls_playlist for streaming?**
Yes. For robust streaming playback, you must call `get_public_hls_playlist` because it provides the necessary HLS manifest that modern video players require.

**What's the first step to accessing private content?**
First, you must obtain a user access token by calling `get_user_token`. Then, you can pass this token along with the necessary file token when using `get_private_web_video`.

**Can I check if video transcoding finished?**
Yes. Use `get_completed_jobs`. This tool checks the status of background processing tasks, letting you know if a job succeeded or failed without manual intervention.

**How do I start with authentication using get_local_oauth_clients?**
First, run `get_local_oauth_clients` to grab your client credentials. This returns the Client ID and Secret needed for secure connection. You use these details later when calling a tool to request a specific user access token.

**Can I get video feeds in different formats like RSS or JSON using get_video_feeds?**
Yes, the function supports multiple output structures. Simply specify whether you need Atom, JSON, or XML format when calling it. This allows your agent to parse the feed data into whatever structure it needs.

**What should I check if get_public_web_video fails?**
The tool returns an error code and a message indicating failure, so don't assume missing content. A 403 status usually means access is restricted, while a 404 means the video ID doesn't exist.

**What happens if I try to register_user with bad input?**
The function returns an error detailing exactly what was wrong. You must correct the formatting—for example, ensuring a valid email structure or strong password requirements—before retrying.

**How can I generate a direct download link for a PeerTube video?**
You can use the `generate_video_download` tool by providing the video's ID or UUID. The agent will return a muxed mp4 container link for downloading.

**Can I register a new user account on my instance using the AI?**
Yes, if the instance allows public registration, you can use the `register_user` tool with a username, password, and email address.

**How do I check if my video transcoding jobs are finished?**
Use the `get_completed_jobs` tool. It retrieves a list of all finished background jobs, allowing you to verify successful processing.