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:
- id: office
match: { gateway_mac: "aa:bb:cc:dd:ee:ff" } # your office router's MAC
tags: [office]
- id: home
match: { gateway_mac: "11:22:33:44:55:66" } # your home router's MAC
tags: [home]
mcp:
- name: internal-docs
when: [office]
type: stdio # default; shown for clarity
command: npx
args: ["-y", "my-company-docs-mcp"]
- name: home-assistant
when: [home]
type: 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 upserts the selected server into
mcpServersin.claude.json. 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.