Skip to content

examples: bind auth-middleware server to localhost by default#784

Merged
maciej-kisiel merged 2 commits intomodelcontextprotocol:mainfrom
TheodorNEngoy:codex/auth-middleware-bind-localhost
Feb 11, 2026
Merged

examples: bind auth-middleware server to localhost by default#784
maciej-kisiel merged 2 commits intomodelcontextprotocol:mainfrom
TheodorNEngoy:codex/auth-middleware-bind-localhost

Conversation

@TheodorNEngoy
Copy link
Contributor

The auth-middleware example currently defaults to -http :8080, which binds to all interfaces (LAN-exposed) by default.

This changes the default to localhost:8080 and adds a short comment noting -http 0.0.0.0:8080 if you intentionally want to expose it.

Rationale: this example serves token-generation endpoints and authenticated MCP routes; binding loopback by default avoids accidental exposure while keeping the opt-in remote behavior.

@TheodorNEngoy
Copy link
Contributor Author

Local sanity check: go test ./... passes on this branch.

@maciej-kisiel
Copy link
Contributor

Thanks for the change. The same logic probably applies here as well: https://github.com/modelcontextprotocol/go-sdk/blob/main/scripts/server-conformance.sh#L74, could you adjust it as well?

@TheodorNEngoy
Copy link
Contributor Author

Pushed an update per your note: scripts/server-conformance.sh now binds the conformance server to loopback by default (localhost:) instead of : (all interfaces).

@maciej-kisiel maciej-kisiel merged commit 6a81e5d into modelcontextprotocol:main Feb 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants