@edicarlos.lds/businessmap-mcp
Version:
Model Context Protocol server for BusinessMap (Kanbanize) integration
54 lines • 2.06 kB
JavaScript
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { BusinessMapClient } from '../client/businessmap-client.js';
import { config } from '../config/environment.js';
import { BoardToolHandler, CardToolHandler, CustomFieldToolHandler, UserToolHandler, UtilityToolHandler, WorkflowToolHandler, WorkspaceToolHandler, } from './tools/index.js';
export class BusinessMapMcpServer {
mcpServer;
businessMapClient;
constructor() {
this.mcpServer = new McpServer({
name: config.server.name,
version: config.server.version,
});
this.businessMapClient = new BusinessMapClient(config.businessMap);
this.setupTools();
this.setupResources();
}
/**
* Initialize the server by verifying the BusinessMap API connection
*/
async initialize() {
try {
await this.businessMapClient.initialize();
}
catch (error) {
const message = error instanceof Error ? error.message : 'Unknown error';
throw new Error(`Failed to initialize BusinessMap MCP Server: ${message}`);
}
}
setupTools() {
const readOnlyMode = config.businessMap.readOnlyMode ?? false;
// Initialize tool handlers
const toolHandlers = [
new WorkspaceToolHandler(),
new BoardToolHandler(),
new CardToolHandler(),
new CustomFieldToolHandler(),
new UserToolHandler(),
new UtilityToolHandler(),
new WorkflowToolHandler(),
];
// Register all tools from handlers
toolHandlers.forEach((handler) => {
handler.registerTools(this.mcpServer, this.businessMapClient, readOnlyMode);
});
}
setupResources() {
// TODO: Implement resource endpoints for reading workspace/board/card data
// This would allow LLMs to access current state without performing actions
}
get server() {
return this.mcpServer;
}
}
//# sourceMappingURL=mcp-server.js.map