Skip to main content
Glama
Tommertom

Plugwise MCP Server

by Tommertom
connection.service.ts1.58 kB
/** * Connection Service * Manages the active Plugwise client connection */ import { PlugwiseClient } from '../client/plugwise-client.js'; import { PlugwiseConfig } from '../types/plugwise-types.js'; /** * Connection Service * Maintains a single active connection to a Plugwise gateway */ export class ConnectionService { private client: PlugwiseClient | null = null; private currentConfig: PlugwiseConfig | null = null; /** * Get the active client instance */ getClient(): PlugwiseClient | null { return this.client; } /** * Get the current connection configuration */ getConfig(): PlugwiseConfig | null { return this.currentConfig; } /** * Check if connected */ isConnected(): boolean { return this.client !== null && this.client.isConnected(); } /** * Connect to a Plugwise gateway */ async connect(config: PlugwiseConfig): Promise<PlugwiseClient> { this.currentConfig = config; this.client = new PlugwiseClient(config); await this.client.connect(); return this.client; } /** * Disconnect from the current gateway */ disconnect(): void { this.client = null; this.currentConfig = null; } /** * Ensure a connection exists, throw if not */ ensureConnected(): PlugwiseClient { if (!this.client || !this.client.isConnected()) { throw new Error('Not connected. Use the connect tool first.'); } return this.client; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Tommertom/plugwise-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server