domotz-mcp
Version:
MCP server for Domotz API and BMS (Building Management System) integration with IoT device monitoring
24 lines (23 loc) • 904 B
JavaScript
import { MCPServer } from "mcp-framework";
import { fileURLToPath } from 'url';
import { dirname } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Initialize the server with automatic discovery
const apiKey = process.argv.find(arg => arg.startsWith('--api-key='))?.split('=')[1] || process.env.DOMOTZ_API_KEY;
if (apiKey) {
process.env.DOMOTZ_API_KEY = apiKey;
}
// Initialize the server with automatic discovery
const server = new MCPServer({
name: "domotz-mcp",
version: "0.1.0",
transport: { type: "stdio" },
basePath: __filename, // Use the current file path, which will be dist/index.js after build
});
// Start the server - tools will be automatically discovered from the tools directory
server.start().catch((error) => {
console.error("Failed to start server:", error);
process.exit(1);
});