Oh My Sage MCP logo

Oh My Sage MCP

Manage Mi Home gateway automation rules through natural-language requests in MCP-compatible agents.

Install Oh My Sage MCP

Pick your client, then add it in one click or paste the config.

STDIONode.js
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "oh-my-sage-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "oh-my-sage-mcp"
      ],
      "env": {
        "GATEWAY_URL": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

We couldn’t confirm it starts correctly

We ran the install command but it didn't respond within our test window — this can mean a slow first-time install rather than a real problem.

npx -y oh-my-sage-mcp

No response to initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

oh-my-sage-mcp connects AI agents to a local Mi Home central gateway and exposes tools for inspecting devices, rules, variables, and execution logs. Agents can create, patch, validate, enable, disable, and delete automation rules, with device-capability and structure checks before writes. It uses a one-time six-digit gateway login code and can run on demand over stdio or as a shared local/private HTTP service. Reach for it when you want to manage Mi Home Automation Geek Edition rules through conversational requests.

Use cases

  • Create Mi Home automation rules from natural-language requests
  • Patch a single node without rewriting unrelated rule content
  • Find rules that reference a device or variable
  • Inspect execution logs to diagnose a failed automation
  • Validate graph structure and device capabilities before writing

Key features

  • Connects to a local Mi Home central gateway
  • Exposes 32 tools for devices, rules, logs, drafts, and variables
  • Validates graph structure and MIOT device capabilities before writes
  • Supports incremental rule patches with read hashes
  • Provides stdio and persistent HTTP deployment options
  • Supports temporary batched drafts for larger graphs

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 3d ago via OSV.dev · oh-my-sage-mcp (npm)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars159Stargazers on the source repository.
npm downloads1.7kPackage downloads in the last 30 days.
Last commit6d agoMost recent push to the default branch.
Install checkInconclusiveDidn't respond in our test window — often a slow first install.

How Oh My Sage MCP works

What oh-my-sage-mcp does

oh-my-sage-mcp gives an MCP-compatible AI agent access to automation data and rule management for a Mi Home central gateway on the local network. It can retrieve the gateway's devices, device details, MIOT Spec capabilities, automation graphs, variables, and execution logs. It can also create new rules, apply targeted edits, replace complete rule definitions, toggle rules, remove rules, and manage graph variables.

The server supports tasks such as finding every rule that references a device, locating a node across rules, investigating execution history, checking graph layout problems, and removing unused variables. Rule creation and modification are intended to be used with the mijia-automation Skill, which provides the rule-writing guidance.

How it works

The agent first authenticates against the gateway with a six-digit, one-time login code obtained from the Mi Home app. Once connected, it can inspect the available devices and their supported MIOT properties before proposing an automation change.

Writes go through two validation stages. Structural validation checks graph connections and ports; capability validation compares device operations and values with the devices' actual MIOT Specs and verifies variable references. A failed check prevents the write and returns the reason for correction.

Rule data can be handled as compact, one-node-per-line text. Incremental patching is preferred for focused changes, while full-text replacement supports synchronization workflows. Read operations return a hash, allowing an update to be rejected if the rule changed after it was read. Larger graphs can be uploaded through temporary drafts in batches.

Setup and configuration

The runtime requires Node.js 20 or newer, a Mi Home central gateway with Automation Geek Edition enabled, and the gateway's LAN address. An on-demand setup can be added to an MCP client with npx, using GATEWAY_URL such as http://192.168.1.10. After restarting the client, provide a fresh login code in the conversation.

For persistent use, install the npm package globally and run the supplied local installation script on Windows, macOS, or Linux. The local service listens on 127.0.0.1:3790/mcp, so multiple agents on the same computer can share the connection. A Docker deployment is also available for a private server or NAS; clients connect to its /mcp endpoint with a bearer access password.

The repository also includes a browser interface. It requires the repository checkout, an OpenAI-compatible model API, LLM_BASE_URL, LLM_MODEL, LLM_API_KEY, and GATEWAY_URL. The web interface should not be exposed publicly because it has no account system.

Tools and capabilities

The MCP tool set covers:

  • Gateway authentication, disconnection, and connection-status checks.
  • Device listing, detailed device and MIOT Spec inspection, and device-usage searches.
  • Rule retrieval, creation, incremental patching, full-text replacement, querying, deletion, and enable/disable controls.
  • Execution-log filtering by rule, node, and time.
  • Structural validation, device-capability validation, and graph-layout inspection.
  • Draft creation, batched node uploads, draft edits, status checks, commits, and discards.
  • Variable listing, value and configuration reads, creation, updates, and deletion.

Drafts expire after 30 minutes, and each append operation accepts up to 25 nodes. Disconnecting a shared connection disconnects all clients using it. The one-time login code must be obtained again when a new connection is required.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Oh My Sage MCP

oh-my-sage-mcp is an MCP server that connects AI agents to a local Mi Home central gateway. Its main tools inspect devices, MIOT capabilities, automation rules, variables, and execution logs, then create, patch, validate, enable, disable, or delete rules through conversational requests.

Install it with `npx -y add-mcp oh-my-sage-mcp -g -n oh-my-sage --env GATEWAY_URL=http://<gateway-ip>` and install the `mijia-automation` Skill separately. Node.js 20 or newer and a Mi Home gateway with Automation Geek Edition enabled are required.

Yes, oh-my-sage-mcp works with Cursor. Add it through the client configuration using the `npx` command and `GATEWAY_URL`, or connect Cursor to a persistent service at `http://127.0.0.1:3790/mcp`.

Yes, writes are checked for both graph structure and device capabilities before they reach the gateway. The capability check uses the device's MIOT Spec, verifies writable properties and value ranges, and checks that referenced variables exist.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewOh My Sage MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/oh-my-sage-mcp?style=directory)](https://allmcps.com/mcp/oh-my-sage-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/oh-my-sage-mcp"><img src="https://allmcps.com/api/badge/oh-my-sage-mcp?style=directory" alt="Oh My Sage MCP on AllMCPs" /></a>