Office vs. Home Network
Use different MCP servers depending on which network you're on, with no manual toggling.
Config
# ~/.config/llmenv/config.yaml
scope:
network:
- name: office
gateway_mac: "aa:bb:cc:dd:ee:ff" # your office router's MAC
tags: [office]
- name: home
gateway_mac: "11:22:33:44:55:66" # your home router's MAC
tags: [home]
mcp:
- name: internal-docs
tags: [office]
transport: stdio
command: npx
args: ["-y", "my-company-docs-mcp"]
- name: home-assistant
tags: [home]
transport: stdio
command: uvx
args: ["home-assistant-mcp"]
How it works
- On every shell prompt, llmenv runs
llmenv export. - It detects the current gateway MAC and matches it to a
networkscope. - The matching scope adds
officeorhometo the active tag set. - The MCP server whose tags intersect the active set is included; the other is not.
- The adapter writes
mcp.jsoninto the config directory. Claude Code picks it up on the next session.
If you're on an unknown network (traveling, coffee shop) neither scope matches and neither MCP loads.
Verify
llmenv doctor # confirm which scopes and MCPs are active
llmenv export --dry-run # preview the manifest that would be written
Tips
- Run
ip neigh show default(Linux) orarp -n $(route -n get default | grep gateway | awk '{print $2}')(macOS) to find your router's MAC. - You can stack multiple network scopes — if you have a VPN that changes the gateway, add it as a third entry with its own tags.