Skip to main content
Glama

Tiptap Collaboration MCP Server

by trainual
list-documents.ts1.49 kB
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; export default function registerListDocuments( server: McpServer, getBaseUrl: () => string, getToken: () => string | undefined ) { server.tool( 'list-documents', 'List all collaboration documents', {}, async () => { try { const headers: Record<string, string> = { 'User-Agent': 'tiptap-collaboration-mcp', 'Content-Type': 'application/json', }; const token = getToken(); if (token) headers['Authorization'] = token; const response = await fetch(`${getBaseUrl()}/api/documents`, { headers }); if (!response.ok) { return { content: [ { type: 'text', text: `Failed to retrieve documents list. HTTP error: ${response.status} ${response.statusText}`, }, ], }; } const documentsData = await response.json(); return { content: [ { type: 'text', text: `Documents: ${JSON.stringify(documentsData, null, 2)}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error listing documents: ${ error instanceof Error ? error.message : 'Unknown error' }`, }, ], }; } } ); }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/trainual/tiptap-collaboration-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server