4,500+ servers built on MCP Fusion
Vinkius
ESPHome logo
Vinkius
Mastra AI logo

How to Use the ESPHome MCP in Mastra AI

Build resilient IoT automation workflows with Mastra AI and your custom ESPHome hardware.

See Vinkius in Action

Works with every AI agent you already use

…and any MCP-compatible client

ESPHome MCP on Cursor AI Code Editor MCP Client ESPHome MCP on Claude Desktop App MCP Integration ESPHome MCP on OpenAI Agents SDK MCP Compatible ESPHome MCP on Visual Studio Code MCP Extension Client ESPHome MCP on GitHub Copilot AI Agent MCP Integration ESPHome MCP on Google Gemini AI MCP Integration ESPHome MCP on Lovable AI Development MCP Client ESPHome MCP on Mistral AI Agents MCP Compatible ESPHome MCP on Amazon AWS Bedrock MCP Support
MCP Servers - Free for Subscribers
Mastra AI

Connect ESPHome MCP to Mastra AI

Create your Vinkius account to connect ESPHome to Mastra AI and route execution through our secure gateway. The platform manages server hosting, runtime updates, and security layers. Configuration requires no manual server provisioning.

GDPR Free for Subscribers

Multi-step hardware sequences with Mastra AI

Mastra AI workflows sequence the `alarm_action` and `cover_action` tools to lock down a building based on custom conditional logic. If the initial API call fails due to network latency, the framework automatically retries with exponential backoff. When a `switch_action` times out, the agent catches the error immediately. It logs the failure and attempts a secondary protocol without requiring human intervention.

Granular state verification via MCP Server

This MCP Server exposes `get_entity_state` so your agent can verify a physical action actually occurred. It triggers a relay, waits two seconds, and polls the API to confirm the door sensor registers as closed. Relying on fire-and-forget commands causes hardware sync issues, so the agent checks `get_entity_state` first. It decides if the action is necessary and only fires `button_press` if the current state requires it.

Automated hardware tuning

The `number_set` and `select_option` tools let your workflow adjust operational parameters on the fly. If the metrics show the CPU running hot, the agent lowers the polling frequency by updating the select entity. Your logic monitors environmental changes over time using `get_metrics`. The agent reads a temperature spike and immediately adjusts the cooling system via `fan_action` before alerting the administrator.

Setup guide

Set up ESPHome MCP in Mastra AI

Prerequisites

  • Node.js 18+ and a TypeScript project
  • @mastra/mcp + @mastra/core packages
  • Active Vinkius subscription with a valid endpoint token
  1. 1

    Install dependencies

    Run npm install @mastra/mcp @mastra/core plus your preferred model provider (e.g. @ai-sdk/openai).

  2. 2

    Configure the MCPClient

    Create an MCPClient with your Vinkius endpoint as a URL object. Replace [YOUR_TOKEN_HERE] with your token from cloud.vinkius.com.

  3. 3

    Discover and inject tools

    Call mcpClient.listTools() and spread the result into your agent's tools object. All ESPHome tools become native Mastra tools.

  4. 4

    Run with any model

    Swap openai("gpt-4o") for any AI SDK-compatible provider. Call agent.generate() and the agent routes tool calls through MCP automatically.

agent.ts
import { MCPClient } from "@mastra/mcp";
import { Agent } from "@mastra/core/agent";
import { openai } from "@ai-sdk/openai";

const mcpClient = new MCPClient({
  id: "esphome-mcp-client",
  servers: {
    "esphome-mcp": {
      url: new URL(
        "https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp"
      ),
    },
  },
});

const agent = new Agent({
  name: "ESPHome Agent",
  model: openai("gpt-4o"),
  instructions: "You have access to ESPHome tools.",
  tools: {
    ...(await mcpClient.listTools()),
  },
});

const result = await agent.generate(
  "List recent ESPHome transactions"
);
console.log(result.text);

Independent Platform Disclaimer: Vinkius is an independent platform and is not affiliated with, endorsed by, sponsored by, verified by, or otherwise authorized by ESPHome. All third-party trademarks, logos, and brand names are the property of their respective owners. Their use on this website is strictly for informational purposes to identify service compatibility and interoperability.

Why Choose Vinkius

Vinkius connects your tools to AI with real-time monitoring and automatic cost savings — all from one dashboard.

Real-time monitoring

Live

visibility into every interaction

Connect your favorite tools to your AI and see exactly what's happening — every request, every response, in real time.

Built-in savings

60%

lower AI costs

Vinkius compresses data between your apps and your AI automatically. Lower bills every month — no configuration required.

Single dashboard

One

place for every integration

Every tool your AI connects to, managed from a single screen. One account, complete control.

Common questions about ESPHome MCP in Mastra AI

Install @mastra/mcp and initialize the MCPClient with your server URL. You then spread listTools() into your agent's tool array.
Yes. You configure requireToolApproval on the specific tool. The workflow pauses, waits for an administrator to click approve, and then flips the physical relay.
The framework catches the HTTP error from the MCP server. You configure exponential backoff rules in your workflow to retry the connection automatically.
No. The Mastra client auto-detects whether the server uses Server-Sent Events or Streamable HTTP and connects accordingly.
The tools transmit raw sensor values and local IP addresses. Vinkius enforces a zero-trust architecture, destroying the execution environment immediately after the workflow step completes, leaving no persistent logs of your home network.

Start using the ESPHome MCP today

We host it, we monitor it, we maintain it. You just paste one token.

Built & Managed by Vinkius 30s setup 10 tools

We've already built the connector for ESPHome. Just plug in your AI agents and start using Vinkius.

No hosting. No infrastructure. No complex setup.
All 10 tools are live and waiting. You're up and running in seconds.

Claude Claude
ChatGPT ChatGPT
Cursor Cursor
Gemini Gemini
Windsurf Windsurf
VS Code VS Code
JetBrains JetBrains
Vercel Vercel
+ other MCP clients

Vinkius gives your AI agents access to the full catalog of app connectors, all fully managed, secure, and enterprise-ready. One subscription, every tool you need.

Zero hosting required Full MCP catalog included Enterprise-grade security Auto-updated by Vinkius

Built, hosted, and secured by Vinkius. You just connect and go.