Documentation

Introduction to MCP

Understanding PaperCast's integration with AI agents.

The PaperCast Model Context Protocol (MCP) server provides AI agents with the tools to directly interact with your local PaperCast playground. You can ask an agent to build layouts, inject data, and debug overflow issues, and watch the changes apply instantly in your browser.

Remote control architecture

Not just a code generator

Unlike traditional AI coding tools that write files to a codebase, the PaperCast MCP Server acts as a real-time remote control hub. When you open the PaperCast playground in your browser, the website connects to this MCP server over a local WebSocket.

This creates a real-time workflow:

  1. You instruct the AI agent to build a document.
  2. The AI agent uses MCP tools to compute the layout and send schema mutations to the local server.
  3. The local server broadcasts these mutations via WebSockets to your browser.
  4. Your browser instantly renders the visual updates.

The role of the browser

The browser engine renders the UI and measures physical element heights. The AI agent relies on the browser to understand the true visual state of the document. The WebSocket connection allows the AI to query the browser for element heights, pagination boundaries, and the current AST state, and then apply changes seamlessly.

Next steps