Combine MCP server and SSH to give your LLM powers to edit configurations and control your home

I used Model Context Protocol Server - Home Assistant and added to my local desktop Claude. It works great, however I also wanted to help me e.g. improve or design new automations. Unfortunately, the MCP integration doesn’t give access to the raw configs and automations, so I used a workaround. I added another MCP ssh server (technically shell server, yes, I like to live dangerously) so claude can connect to HA via ssh and cat/list configurations. I created a new project in the claude desktop up with the following instructions:

Don't forget you have access to the homeassistant tool that you can use to get the current context.  In addition to it, you can use `ssh ha` to execute remote commands to fetch additional information, such as:

ssh ha -t cat /root/config/configuration.yaml

ssh ha -t cat /root/config/automations.yaml > /tmp/automations.yaml

ssh ha -t ls /root/config/

and so on. Notice that e.g. automations.yaml is a very long file, so after dumping it into file locally you might want to use some shell utilities such as `grep` or better `yq`.  Note that we have yq v4, you might want to read https://mikefarah.gitbook.io/yq/recipes if you get the syntax wrong.  When thinking about automations, always filter those that are actually enabled (likely using Homeassistant MCP context).

And that’s it. It now all works great:

Ok this is just plain crazy, love it. How good are the automations ? Any unreliable results?
As a precaution: Before the automation is written to HA can it do a sanity check do it is sure it doesn’t break anything like verifying the yaml?

Agree on the craziness.

On the efficacy: It one shot the automation from the example above, and it’s actually correct.

I tried more complicated usecase, and I would say it nailed it too. Even based on that vague description of mine, it figure out what the problem is (abrupt changes etc. - that is actually what bothers me), found the relevant lights, areas, after I nudged it considered only enabled entities, and proposed a better alternative, with an offer to create the automations in independent files. I expect that getting to that stage would take me at least a couple of hours and I am sure I would get many stupid small things like wrong ID or condition on time wrong here and there.



It can also just help me think about all of this very easily. I have like 100 automations, have like 40 bulbs, some led panels, many Shelly RGBW led strips for recessed lighting, … it’s a lot to keep in mind. LLMs can handle that for me.


As a precaution: Before the automation is written to HA can it do a sanity check do it is sure it doesn’t break anything like verifying the yank

I didn’t go that crazy yet, as this validation bit is indeed missing and I am too lazy to copy automations from backups etc. My expected workflow now is to let it create yaml files on my local disk and I copy it manually to the HA yaml automation editor and tweak the details. I would maybe let it use GitHub - wonderwhy-er/DesktopCommanderMCP: This is MCP server for Claude that gives it terminal control, file system search and diff file editing capabilities if it couldn’t get patches to the automations.yaml fine if I wanted to go full automated.

1 Like