fix(mcp): disable DNS rebinding protection for LAN HTTP transport #6

Merged
user2595 merged 1 commits from fix/mcp-transport-security into main 2026-06-14 12:56:00 +00:00
Owner

Summary

  • FastMCP defaults to DNS rebinding protection with allowed_hosts=["localhost"], blocking requests from the Mac (192.168.178.82) to the Jetson (192.168.178.103:8765)
  • Security is already provided by _TokenAuth Bearer token middleware + UFW restricting port 8765 to trusted LAN IPs — host-header validation is redundant
  • Single-line fix: pass TransportSecuritySettings(enable_dns_rebinding_protection=False) to FastMCP constructor

Test plan

  • 28 MCP tests pass (uv run pytest tests/mcp/ -q)
  • Re-run ansible-playbook --tags codex_mcp to pull updated code on Jetson + restart service
  • curl http://192.168.178.103:8765/mcp from Mac responds (not 421)

🤖 Generated with Claude Code

## Summary - FastMCP defaults to DNS rebinding protection with `allowed_hosts=["localhost"]`, blocking requests from the Mac (192.168.178.82) to the Jetson (192.168.178.103:8765) - Security is already provided by `_TokenAuth` Bearer token middleware + UFW restricting port 8765 to trusted LAN IPs — host-header validation is redundant - Single-line fix: pass `TransportSecuritySettings(enable_dns_rebinding_protection=False)` to FastMCP constructor ## Test plan - [x] 28 MCP tests pass (`uv run pytest tests/mcp/ -q`) - [ ] Re-run `ansible-playbook --tags codex_mcp` to pull updated code on Jetson + restart service - [ ] `curl http://192.168.178.103:8765/mcp` from Mac responds (not 421) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
user2595 added 1 commit 2026-06-14 12:55:48 +00:00
FastMCP defaults to DNS rebinding protection (allowed_hosts=localhost only),
which rejects requests from the Mac (192.168.178.82) to the Jetson
(192.168.178.103:8765). Security is already provided by Bearer token auth
in _TokenAuth middleware and UFW restricting port 8765 to trusted LAN IPs,
making host-header validation redundant in this deployment context.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
user2595 merged commit 6c28446644 into main 2026-06-14 12:56:00 +00:00
user2595 deleted branch fix/mcp-transport-security 2026-06-14 12:56:00 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: user2595/codex-py#6
No description provided.