# Liveblocks (Collaborative) MCP

> Liveblocks (Collaborative) lets your AI agent manage real-time, shared infrastructure directly from conversation. Use this MCP to control collaborative rooms, monitor who is in a session, and synchronize complex documents across multiple users without touching an API endpoint. It's the complete toolset for orchestrating live state management.

## Overview
- **Category:** productivity
- **Price:** Free
- **Tags:** real-time-sync, multiplayer-experience, presence-tracking, collaborative-editing, web-sockets, state-management

## Description

This connector lets you treat your entire real-time backend—room creation, user presence, shared document storage, and discussion threads—as just another function call in a conversation. You can instruct your agent to create an entirely new project space, automatically assign permissions, and then instantly get a full list of who’s currently working in it. Need to update the core data or patch a specific section of shared notes? Your agent handles that, treating complex document states like simple variables.

It's built for environments where state changes constantly; think live code editors, collaborative whiteboards, or multiplayer game lobbies. Instead of juggling multiple dashboards and manual API calls, you talk to your AI client, and it interacts with the infrastructure via Vinkius. This lets developers debug room storage, PMs review user feedback threads, and support staff verify permissions—all in one place.

## Tools

### list_active_users
Gets a list of all users currently connected to a specified room.

### authorize_user
Generates an access token for a user, applying specific permissions and scopes.

### broadcast_event
Sends a structured JSON event to all clients connected within a room.

### create_room
Initializes an entirely new collaborative workspace with defined metadata and access rules.

### create_thread
Starts a new discussion thread within a room, automatically posting the initial comment.

### delete_room
Permanently removes an existing collaborative workspace and all its contents.

### get_room
Retrieves comprehensive details about a specific room, including its current status and metadata.

### get_storage
Fetches the entire contents of the room's shared storage in JSON or LSON format.

### get_ydoc
Retrieves a snapshot of the document state using Yjs for structured data inspection.

### identify_user
Obtains an ID token needed to verify and identify a user's presence in the system.

### initialize_storage
Sets up or resets the shared storage area for a room, giving it a clean slate.

### list_rooms
Lists all existing rooms, allowing filtering and pagination based on metadata.

### list_threads
Retrieves a list of all discussion threads associated with a particular room.

### list_versions
Shows historical snapshots and version control logs for the shared document state.

### patch_storage
Applies specific JSON Patch operations to update only a small part of the room's storage content.

### resolve_thread
Marks a discussion thread as resolved, closing out the conversation topic.

### set_presence
Sets or updates the ephemeral presence status for an agent or user within a room.

### update_room
Changes properties of a room, including its metadata and access permissions.

### update_ydoc
Sends binary updates to modify the core Yjs document state.

## Prompt Examples

**Prompt:** 
```
List all Liveblocks rooms created after January 1st with the metadata 'status:active'.
```

**Response:** 
```
I've found 3 rooms matching your criteria: 'Project-Alpha' (ID: room_01), 'Design-Sprint' (ID: room_05), and 'Team-Sync' (ID: room_09). Would you like to see the active users for any of these?
```

**Prompt:** 
```
Check who is currently collaborating in room 'editor-prod-42'.
```

**Response:** 
```
There are currently 2 active users in 'editor-prod-42': 'Alice (ID: user_A)' and 'Bob (ID: user_B)'. Alice has been connected for 15 minutes.
```

**Prompt:** 
```
Create a new collaborative room for 'Sprint 24 Planning' with default access set to 'room:write'.
```

**Response:** 
```
Room 'Sprint 24 Planning' has been successfully created with ID 'sprint-24-plan'. Default access is set to write. You can now start adding threads or initializing storage.
```

## Capabilities

### Manage Room Lifecycle
Create, read, update, or delete collaborative rooms with specific access controls.

### Track User Presence
Monitor which users are active in a room and set temporary presence indicators for agents.

### Synchronize Shared Data
Retrieve or update the content stored within a room's document state (Yjs). 

### Control Collaborative Threads
Create new discussion threads and manage existing feedback loops.

## Use Cases

### Onboarding a new client team
A PM needs to set up a private working space. They ask their agent: 'Create a room called Q3 Strategy with write access and list the available rooms.' The agent uses `create_room` and then calls `list_rooms`, giving the PM immediate confirmation they're in the right place.

### Live debugging shared documents
A developer finds a bug in shared notes. They prompt: 'What is the current state of the core document?' The agent uses `get_ydoc` to retrieve the structured data, allowing the dev to see exactly what's wrong without manually inspecting logs.

### Support ticket escalation
A support engineer needs to verify if a user can access a feature. They prompt: 'Check all permissions for Project X.' The agent runs `get_room` and then uses `list_active_users` to confirm who was last in the room, providing comprehensive context.

### Starting a new design cycle
A team leader needs to gather feedback. They ask: 'Start a thread about the landing page copy and notify everyone.' The agent executes `create_thread` and then uses `broadcast_event` to alert all current users in the room.

## Benefits

- You can stop manually checking multiple dashboards for who's online. Use the `list_active_users` tool to instantly verify all active participants in any room, keeping your support process fast and accurate.
- Debugging document state used to mean pulling raw JSON files. Now you use `get_ydoc` or `get_storage` to get a clean, actionable snapshot of shared data directly into your chat context.
- When project scope changes, you don't need an admin ticket. Use `create_room` and `update_room` together to spin up new collaboration spaces and set precise permissions instantly.
- Managing team feedback is easier than ever. Instead of losing threads in email chains, the agent can use `create_thread`, `list_threads`, and eventually `resolve_thread` to keep discussions organized right where they happen.
- Need to replicate a development environment? The ability to call `initialize_storage` resets your workspace instantly, giving you a clean slate for testing without manual cleanup.

## How It Works

The bottom line is your AI client performs complex infrastructure operations that used to require direct code integration.

1. First, subscribe to this MCP in your Vinkius catalog and provide your Liveblocks Secret Key.
2. Next, prompt your AI client with a goal, such as 'Create a room for Project X,' or 'List all users currently active in the design sprint.'
3. Your agent executes the necessary functions, retrieves the live data (like user lists or storage patches), and presents the result back to you in natural language.

## Frequently Asked Questions

**How do I use Liveblocks (Collaborative) MCP to check users?**
You use the `list_active_users` tool. Just prompt your agent and tell it which room you want to check, and the system returns a real-time list of all connected participants.

**Can I reset shared document state with Liveblocks (Collaborative) MCP?**
Yes, you use `initialize_storage`. This function sets up or resets the room's storage area, giving it a clean starting point for new collaboration sessions.

**What is the difference between get_ydoc and get_storage?**
The `get_ydoc` tool retrieves the shared state using Yjs format, which is best for structured data. Use `get_storage` when you need the full, general contents of the room's storage area.

**How do I make a new collaboration space?**
You use the `create_room` tool. You provide details like the name and initial access controls, and the MCP handles generating the necessary infrastructure for you.

**Can Liveblocks (Collaborative) MCP handle user permissions?**
Yes. You can use `authorize_user` to generate tokens with specific read/write scopes, and `update_room` to adjust overall room permissions.