UNPKG

histoire

Version:

A fast story book powered by Vite

16 lines (15 loc) • 1.16 kB
import { McpServer } from '@modelcontextprotocol/server'; import { registerReadTools } from './read-tools.js'; import { registerReadResources } from './resources.js'; /** Create a fresh SDK instance while lifecycle and operation state stay in project. */ export function createHistoireMcpServer(options) { const server = new McpServer({ name: 'histoire', version: options.version }, { instructions: 'Explore this Histoire book with project, story, docs, source and preview reads. When execution tools are available, start a screenshot, rendered inspection or test job, then poll its operation handle until terminal. Rendered inspection uses a fresh isolated variant, not unsaved changes in an open preview.', capabilities: { tools: { listChanged: false }, resources: { listChanged: false } }, }); registerReadTools(server, options.project, options.observeClientName, options.observeReadTool); // Extensions register discovery first; the final raw reader owns dispatch. options.register?.(server, options); registerReadResources(server, options.project, options.principal, options.readResource); return server; }