advanced-homeassistant-mcp
AGENTS.md57 starsChanged 13 months agoApache-2.0View on GitHub
Note: This file was updated 2026-06-10 as part of a project audit and cleanup. Several claims below were corrected to match the current state of the repo after removal of dead code, dependency cleanup, and config consolidation. The project documentation lives in docs-site/ (Astro v6 + MDX + Tailwind v4 + shadcn-style components, deployed to GitHub Pages). It is a separate package — cd docs-site to work on it.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 51
Logging: Use winston logger from @/utils/logger, never console.log
- Very specific: line 52
Error handling: Always check instanceof Error before accessing .message
- Very specific: line 59
Config: Import from src/config/app.config (single source of truth).
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent Instructions
Note: This file was updated 2026-06-10 as part of a project audit and cleanup. Several claims below were corrected to match the current state of the repo after removal of dead code, dependency cleanup, and config consolidation.
Commands
- Build (all 3 entry points):
bun run build:all(esbuild →dist/, minified, with inline sourcemaps) - Single test:
bun test __tests__/path/to/file.test.ts - All tests:
bun test(auto-preloadstest/setup.tsperbunfig.toml) - Typecheck:
bun x tsc --noEmit(tsconfig is typecheck-only, not used by build) - Lint:
bun run lint - Format:
bun run format - Clean:
bun run clean(removesdist/,dist-ts/,.bun/,coverage/,bin/*.js)
Architecture
- Three entry points (post-cleanup):
src/index.ts→dist/index.cjs— HTTP+WS, customMCPServer(Express)src/stdio-server.ts→dist/stdio-server.mjs— STDIO,fastmcpv3src/http-server.ts→dist/http-server.mjs— HTTP,fastmcpv3
- MCP core:
src/mcp/MCPServer.ts(custom) +src/mcp/transports/(transport layers) - Tools:
src/tools/homeassistant/(domain-specific),src/tools/(generic) — not undersrc/mcp/ - HA client:
src/hass/(WebSocket API client) - Build output:
dist/with external deps (esbuild config inpackage.jsonscripts)
Module System
- Source: TypeScript with ESM-style imports, path alias
@/*→src/* - Build: esbuild outputs CJS (
.cjs) and ESM (.mjs) — NOT tsc - Imports:
.jsextensions are required for relative imports (esbuild resolves to.tssource); the project uses them throughout// Correct (matches current codebase) import { MCPServer } from "@/mcp/MCPServer"; // or import { MCPServer } from "../mcp/MCPServer.js"; - tsconfig:
module: ESNext,moduleResolution: Bundler(matchespackage.json#type: module)
Testing Gotchas
- Preload required:
test/setup.tssetsHASS_TOKEN,JWT_SECRET, and other env vars - Coverage thresholds: 80% statements/lines/functions, 70% branches (see
bunfig.toml) - Test location:
__tests__/directory (notsrc/ortest/) - E2E tests: under
__tests__/integration/(nottest/e2e/which was removed) - Config:
bunfig.toml[test]section controls test behavior;testMatchonly matches.test.ts(no.js, no.disabled)
Important Patterns
- Logging: Use
winstonlogger from@/utils/logger, neverconsole.log - Error handling: Always check
instanceof Errorbefore accessing.messagecatch (error) { const msg = error instanceof Error ? error.message : String(error); } - External deps: Listed in esbuild
--externalflags (not bundled). Keep this list in sync withpackage.json#dependencies. - Config: Import from
src/config/app.config(single source of truth). The legacysrc/config.tsandsrc/config.jsare gone. - Validation: Zod (NOT Valibot, despite earlier docs). Schemas live in
src/schemas/.
Smithery Deployment
- Entry:
src/smithery-sdk.ts(uses@modelcontextprotocol/sdk) - Build:
bun run smithery:build→dist/smithery.js - Container:
Dockerfile.smitherybuildsdist/http-simple.mjs(the simple HTTP server) - Local debug:
npx @smithery/cli playground-stdio -- npm run start:stdio
Docs Site
The project documentation lives in docs-site/ (Astro v6 + MDX + Tailwind v4 + shadcn-style components, deployed to GitHub Pages). It is a separate package — cd docs-site to work on it.
- Dev:
cd docs-site && bun install && bun run dev(http://localhost:4321) - Build:
cd docs-site && bun run build→docs-site/dist/ - Typecheck:
cd docs-site && bun x astro check - Preview build:
cd docs-site && bun run preview - Content: MDX files in
docs-site/src/content/docs/, one per page. Frontmatter schema (zod) is indocs-site/src/content.config.tsand enforcestitle,description,section,order,draft. - Theme: pure grayscale B/W with a single indigo accent (
--ring: hsl(239 84% 67%)). All semantic tokens live indocs-site/src/styles/global.cssand are mapped to Tailwind utilities via@theme inline. The shadcn config indocs-site/components.jsonmatches. - Base path:
/advanced-homeassistant-mcp(matches the GitHub Pages URL). - Deploy:
.github/workflows/deploy-docs.ymlruns on push tomainwhendocs-site/**changes.
Environment
- Runtime: Bun (dev/test/build), Node.js >=18 (production)
- Config:
src/config/app.config.tsloads fromdotenv, validates with Zod (Valibot was removed) - Lockfile:
bun.lockis canonical;package-lock.jsonis also present for npm fallback - TypeScript: Strict mode enabled,
bun-typesin type array
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

