Skip to main content
Glama
Tommertom

Plugwise MCP Server

by Tommertom
mastra-init.ts1.57 kB
import { Mastra } from '@mastra/core/mastra'; import { Agent } from '@mastra/core/agent'; import { McpClient } from './mcp-client.js'; import { McpToolAdapter } from './tool-adapter.js'; import { createPlugwiseAgent } from './plugwise-agent.js'; export interface MastraConfigOptions { mcpServerPath?: string; model?: string; enableLogging?: boolean; } export interface InitializedMastra { mastra: Mastra; plugwiseAgent: Agent; mcpClient: McpClient; cleanup: () => Promise<void>; } export async function initializeMastra(options: MastraConfigOptions = {}): Promise<InitializedMastra> { const { mcpServerPath, model, enableLogging = true } = options; if (enableLogging) { console.error('[Mastra Config] Initializing Mastra with Plugwise MCP integration...'); } const mcpClient = new McpClient(mcpServerPath); await mcpClient.connect(); const toolAdapter = new McpToolAdapter(mcpClient); const tools = await toolAdapter.loadTools(); if (enableLogging) { console.error(`[Mastra Config] Loaded ${Object.keys(tools).length} Plugwise tools`); } const plugwiseAgent = createPlugwiseAgent({ tools, model }); const mastra = new Mastra({ agents: { plugwiseAgent, }, }); const cleanup = async () => { if (enableLogging) { console.error('[Mastra Config] Cleaning up...'); } await mcpClient.disconnect(); }; return { mastra, plugwiseAgent, mcpClient, cleanup, }; }

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