examples: bind local servers to localhost by default#1494
examples: bind local servers to localhost by default#1494TheodorNEngoy wants to merge 4 commits intomodelcontextprotocol:mainfrom
Conversation
|
@modelcontextprotocol/client
@modelcontextprotocol/server
@modelcontextprotocol/express
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
|
Added one more hardening tweak: the SSE polling example now avoids If someone needs broader CORS for a hosted inspector/app, they can set |
|
One more small hardening tweak: the demo auth server example now sets an explicit JSON/urlencoded body size limit (100kb) for non-better-auth routes (avoids accidental large-body DoS). |
A number of runnable examples start HTTP servers using
listen(port)(bind-all-interfaces) and some also enable demo-only permissive CORS.This PR makes the safer default explicit:
localhostby default.MCP_HOST(defaultlocalhost) and pass it through to server binds.listen(port, (error) => ...)pattern to properserver.on('error', ...)handling.This reduces the risk of people running an example and accidentally exposing an insecure demo server on their LAN/public interface.