UNPKG

@edicarlos.lds/businessmap-mcp

Version:

Model Context Protocol server for BusinessMap (Kanbanize) integration

44 lines 1.81 kB
import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js'; export class BoardResourceHandler { registerResources(server, client) { // List all boards server.registerResource('boards', new ResourceTemplate('businessmap://boards', { list: undefined }), {}, async (uri) => { try { const boards = await client.getBoards(); return { contents: [ { uri: uri.href, text: JSON.stringify(boards, null, 2), }, ], }; } catch (error) { throw new Error(`Failed to fetch boards: ${error instanceof Error ? error.message : 'Unknown error'}`); } }); // Get board details server.registerResource('board', new ResourceTemplate('businessmap://boards/{board_id}', { list: undefined }), {}, async (uri, variables) => { try { const boardId = parseInt(variables.board_id); if (isNaN(boardId)) { throw new Error(`Invalid board_id: "${variables.board_id}" is not a valid number`); } const board = await client.getBoard(boardId); return { contents: [ { uri: uri.href, text: JSON.stringify(board, null, 2), }, ], }; } catch (error) { throw new Error(`Failed to fetch board: ${error instanceof Error ? error.message : 'Unknown error'}`); } }); } } //# sourceMappingURL=board-resources.js.map