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.
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
- 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:
VeltPresencein the header andVeltCursorin the editor. - AI tools: Three MCP tools for ChatGPT:
cowrite-open,cowrite-get-contentandcowrite-write-content. - Smart formatting: When ChatGPT writes content, lists, headings and paragraphs are detected and formatted.
| 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 |
- 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 forlocal-network-access-check, set it to Disabled and restart Chrome
git clone https://github.com/Studio1HQ/co-write.git
cd co-write
pnpm installInstall ngrok and add your token:
brew install ngrok # macOS, or download from ngrok.com
ngrok config add-authtoken YOUR_TOKENCreate 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.
Use three terminals.
Terminal 1, build and serve the widget on http://localhost:4444:
pnpm run build
pnpm run serveTerminal 2, start the MCP server on http://localhost:8000:
cd cowrite_server
pnpm startTerminal 3, expose the server:
ngrok http 8000Copy the ngrok URL (like https://abc123.ngrok-free.app), then connect ChatGPT:
- Open ChatGPT, go to Settings, and enable Developer Mode.
- Go to Settings, Connectors, Create.
- Set the name to
Cowriteand the URL tohttps://abc123.ngrok-free.app/mcp(your ngrok URL). Trust the provider. - Enable Cowrite from the + menu in a chat.
- 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".
- ChatGPT renders the Cowrite widget in an iframe.
- The widget syncs document content to the MCP server.
- ChatGPT calls tools to read or write the document content.
- Written content is formatted by detecting lists, headings and paragraphs.
- 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
.envis in the root, named exactly.env, and restart your terminal. If values still do not load, put the API key directly insrc/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 withpnpm run build.
- Velt documentation: SDK guides and API reference.
- Velt console: Create projects and API keys.
- Velt: Product site.
- TipTap: Editor docs.
- Model Context Protocol: Protocol docs.
- ngrok: Tunnel used to expose the local MCP server.
Built by Studio1, the technical content and DevRel partner for devtool teams. Made with Velt.
Browse more open-source examples at github.com/Studio1HQ.
studio1hq.com · Technical content, docs, video and DevRel for devtools