Skip to content
Studio1HQPublic

About

Cowrite: TipTap document editor as a ChatGPT MCP app with Velt CRDT, comments, presence and cursors.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Cowrite ChatGPT App with Velt: A collaborative document editor that runs inside ChatGPT as an MCP app

Cowrite ChatGPT App with Velt

A collaborative document editor that runs inside ChatGPT as an MCP app

Cowrite is a TipTap editor widget served by an MCP server and opened from ChatGPT. Velt CRDT, comments, presence and cursors handle collaboration, and ChatGPT tools read and write the document.


Built by Studio1 Built with Velt

Velt docs  ·  Velt  ·  More examples  ·  studio1hq.com


Overview

Cowrite is a real-time collaborative document editor that runs as a ChatGPT app. A React and TipTap editor widget is built and served locally, an MCP server exposes it to ChatGPT, and Velt provides CRDT sync, comments, presence and live cursors between users. ChatGPT can open the editor, read the document to summarise it, and write formatted content into it.

Untitled.design.17.mp4

Features

  • TipTap editor: Rich text with formatting, headings and lists.
  • Real-time collaboration: Live edits and cursors from other users through Velt CRDT (@veltdev/tiptap-crdt-react).
  • Comments: Comments on text selections with @veltdev/tiptap-velt-comments, a comment tool and a sidebar.
  • Presence: VeltPresence in the header and VeltCursor in the editor.
  • AI tools: Three MCP tools for ChatGPT: cowrite-open, cowrite-get-content and cowrite-write-content.
  • Smart formatting: When ChatGPT writes content, lists, headings and paragraphs are detected and formatted.

Tech stack

Layer Tool
Frontend React 19, Vite
Editor TipTap 3.14
Collaboration Velt (React SDK, CRDT, TipTap comments)
Protocol Model Context Protocol
MCP server Node.js with SSE transport, tsx
Tunnel ngrok
Packaging pnpm workspace

Getting started

Prerequisites

  • Node.js 18 or newer
  • pnpm (or npm or yarn)
  • An ngrok account
  • A Velt account and API key from the Velt console
  • A ChatGPT account with Developer Mode available
  • Chrome 142 or newer users: go to chrome://flags/, search for local-network-access-check, set it to Disabled and restart Chrome

Installation

git clone https://github.com/Studio1HQ/co-write.git
cd co-write
pnpm install

Install ngrok and add your token:

brew install ngrok            # macOS, or download from ngrok.com
ngrok config add-authtoken YOUR_TOKEN

Environment variables

Create a .env file in the root folder (not .env.example).

Variable Description
VITE_VELT_API_KEY Your Velt API key from the Velt console. Enables cursors, comments and CRDT sync.

The server also reads BASE_URL and PORT from the environment.

Run

Use three terminals.

Terminal 1, build and serve the widget on http://localhost:4444:

pnpm run build
pnpm run serve

Terminal 2, start the MCP server on http://localhost:8000:

cd cowrite_server
pnpm start

Terminal 3, expose the server:

ngrok http 8000

Copy the ngrok URL (like https://abc123.ngrok-free.app), then connect ChatGPT:

  1. Open ChatGPT, go to Settings, and enable Developer Mode.
  2. Go to Settings, Connectors, Create.
  3. Set the name to Cowrite and the URL to https://abc123.ngrok-free.app/mcp (your ngrok URL). Trust the provider.
  4. Enable Cowrite from the + menu in a chat.
  5. Try: "Open cowrite", "Summarize the document", or "Write these notes in the document: Project deadline is Friday, Need to review code, Call with client at 3pm".

How it works

  1. ChatGPT renders the Cowrite widget in an iframe.
  2. The widget syncs document content to the MCP server.
  3. ChatGPT calls tools to read or write the document content.
  4. Written content is formatted by detecting lists, headings and paragraphs.
  5. Changes appear for all connected users through Velt.

Key paths: src/cowrite/ is the widget (cowrite.jsx, Header.jsx, MenuBar.jsx, mockUsers.js), cowrite_server/src/server.ts is the MCP server (SSE endpoint at /mcp), and build-all.mts builds the widget assets served on port 4444.

Troubleshooting:

  • Environment variables not found: Make sure .env is in the root, named exactly .env, and restart your terminal. If values still do not load, put the API key directly in src/cowrite/cowrite.jsx.
  • Editor does not appear: Check all three terminals are running and the build finished. The ngrok URL should show "Cowrite MCP server listening...".
  • ChatGPT cannot connect: Check the ngrok URL ends with /mcp, the server is on port 8000 and nothing else uses that port.
  • Collaboration not working: Check VITE_VELT_API_KEY, then rebuild with pnpm run build.

Resources



Studio1

Built by Studio1, the technical content and DevRel partner for devtool teams. Made with Velt.
Browse more open-source examples at github.com/Studio1HQ.

Website Book a call X LinkedIn

studio1hq.com · Technical content, docs, video and DevRel for devtools

About

Cowrite: TipTap document editor as a ChatGPT MCP app with Velt CRDT, comments, presence and cursors.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages