Integrationen

Model Context Protocol (MCP)

Stelle Thunderbit als MCP-Server bereit, damit Claude, Cursor, Windsurf und Claude Code URLs lesen können

MCP ist ein offenes Protokoll, um Tools an LLM-Hosts anzudocken. Sobald du Thunderbit als MCP-Server verdrahtet hast, bekommt jeder MCP-fähige Client — Claude Desktop, Cursor, Windsurf, Claude Code, Zed — ein read_url-Tool gratis dazu.

Installation

npm install @modelcontextprotocol/sdk zod

Server (TypeScript)

import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';

const API = 'https://openapi.thunderbit.com/openapi/v1';
const H = { Authorization: `Bearer ${process.env.THUNDERBIT_API_KEY}` };

const server = new Server(
  { name: 'thunderbit', version: '0.1.0' },
  { capabilities: { tools: {} } },
);

server.setRequestHandler(ListToolsRequestSchema, async () => ({
  tools: [
    {
      name: 'read_url',
      description: 'Fetch a URL and return clean Markdown.',
      inputSchema: {
        type: 'object',
        properties: {
          url: { type: 'string' },
          renderMode: { type: 'string', enum: ['basic', 'advanced'], default: 'basic' },
        },
        required: ['url'],
      },
    },
  ],
}));

server.setRequestHandler(CallToolRequestSchema, async (req) => {
  const { url, renderMode = 'basic' } = req.params.arguments as any;
  const res = await fetch(`${API}/distill`, {
    method: 'POST',
    headers: { ...H, 'Content-Type': 'application/json' },
    body: JSON.stringify({ url, renderMode }),
  });
  const json = await res.json();
  return { content: [{ type: 'text', text: json.data.markdown }] };
});

await server.connect(new StdioServerTransport());

In Claude Desktop einbinden

~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "thunderbit": {
      "command": "node",
      "args": ["/abs/path/to/server.js"],
      "env": { "THUNDERBIT_API_KEY": "tb_live_..." }
    }
  }
}

Starte Claude Desktop neu — read_url taucht im Tool-Picker auf.

In Cursor / Windsurf / Claude Code einbinden

Alle drei lesen die MCP-Konfiguration aus einer ähnlichen JSON-Datei. Siehe Doku des jeweiligen Editors — die mcpServers-Form ist identisch.

Tipps

  • Ergänze ein zweites Tool extract_data auf Basis von /extract für strukturierte Pulls
  • Für Batch-Jobs stelle read_urls (Plural) auf Basis von /batch/distill bereit und polle im Handler
  • Halte den Server stdio-basiert für Desktop-Hosts; wechsle auf SSE, wenn du remote hostest

Verwandt