skill: remote MCP access via VPN + future HTTPS proxy plan

- VPN (WireGuard, port 41495) is current approach for external access
- SSH transport option for Claude Code on VPN-connected machines
- mcp-proxy/HTTPS approach documented as future option for cloud agents
- Security notes: filesystem/git never expose publicly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
post 2026-06-07 01:46:19 +03:00
parent a20341c7fd
commit 540f7e7464

118
skills/remote-mcp-access.md Normal file
View file

@ -0,0 +1,118 @@
# Remote MCP Access
## Summary
MCP servers communicate via stdin/stdout — they have no network ports by default.
To give external machines or people access to MCP servers, a transport layer is needed.
## Current Approach: WireGuard VPN (recommended)
The home cluster has WireGuard server on the Keenetic router:
- Port: 41495/UDP (external)
- VPN subnet: 172.16.6.0/24
- Router LAN: 192.168.170.0/24
When a client connects via WireGuard:
1. They get an IP in 172.16.6.x
2. They can reach all LAN machines (192.168.170.x)
3. CT102 MCP hub (192.168.170.43) is accessible via SSH
### How an external machine uses CT102 MCP servers
**Option A — SSH into CT102 and run tools locally:**
```bash
ssh root@192.168.170.43 # from VPN
# Now run any MCP server command interactively
```
**Option B — Claude Code on external machine points to CT102 via SSH transport:**
In `~/.claude.json` on the external machine, configure servers to run over SSH:
```json
"memory": {
"command": "ssh",
"args": [
"-o", "StrictHostKeyChecking=no",
"root@192.168.170.43",
"node /usr/lib/node_modules/@modelcontextprotocol/server-memory/dist/index.js"
]
}
```
This pipes stdin/stdout through SSH to CT102's local MCP process.
Requires: VPN connected + SSH key or password auth to CT102.
**Option C — Install MCP servers locally on the external machine:**
Simpler: each machine installs its own MCP servers (see baseline list).
VPN only needed for accessing LAN resources (NAS, Forgejo, etc).
### Adding a new WireGuard client
On Keenetic router via Telnet:
```
# View current WireGuard config
show interface Wireguard0
# Add peer (get pubkey from client's wg genkey | wg pubkey)
interface Wireguard0
peer <CLIENT_PUBKEY> allowed-address 172.16.6.x/32
exit
system configuration save
```
Client config template:
```ini
[Interface]
PrivateKey = <CLIENT_PRIVATE_KEY>
Address = 172.16.6.x/32
DNS = 192.168.170.1
[Peer]
PublicKey = <SERVER_PUBKEY>
Endpoint = <EXTERNAL_IP_OR_DOMAIN>:41495
AllowedIPs = 192.168.170.0/24, 172.16.6.0/24
PersistentKeepalive = 25
```
Get server pubkey: `show interface Wireguard0` on Keenetic.
---
## Future Approach: mcp-proxy over HTTPS (not yet configured)
For cloud AI agents (n8n workflows, external Claude API agents) that cannot use VPN,
MCP servers can be exposed via HTTP SSE transport behind NPM with authentication.
**How it would work:**
1. Install `mcp-proxy` on CT102:
```bash
pip install mcp-proxy
# or: npx -y mcp-proxy
```
2. Run proxy that wraps any stdio MCP server in HTTP SSE:
```bash
mcp-proxy --host 0.0.0.0 --port 8811 -- node /path/to/mcp-server
```
3. NPM reverse proxy: `mcp.4min.pro` → CT102:8811 with Authentik SSO auth
4. Clients connect to `https://mcp.4min.pro/sse`
**Security requirements before enabling:**
- Authentik forward auth on all MCP endpoints
- Whitelist only specific tools (filesystem is dangerous to expose)
- Consider separate limited-access MCP instance (no filesystem, no git)
- Log all tool calls
**Status:** not configured. Implement only when cloud agents need it.
---
## Security Notes
MCP servers can have broad access:
- `filesystem` — reads/writes files on the host machine
- `git` — pushes commits to repositories
- `memory` — reads all stored knowledge
Never expose filesystem or git MCP servers to the public internet without strong auth.
Safe to expose externally (limited blast radius): `memory`, `fetch`, `time`, `sequential-thinking`.