Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`createMcpExpressApp` / `createMcpHonoApp`: non-loopback `host` silently skips Host/Origin checks (only `0.0.0.0`/`::` warn) |

Open Beginner friendly
#2,843 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript

Research direction

The issue is in packages/middleware/express/src/express.ts and packages/middleware/hono/src/hono.ts. Look at the logic that adds localhostHostValidation middleware and logs warnings. The task is to extend the warning or validation to non-loopback hosts like '192.168.1.10'. Check how allowedHosts and allowedOrigins options are used. A test should verify the warning appears or validation is applied for a non-loopback host.

Written by the indexing model from the issue text.

Description

v1 v2

Static review of public source at commit 603217008710. No traffic was sent to any MCP environment.

createMcpExpressApp (and the matching Hono helper) auto-arm Host + Origin validation only for loopback hosts. Binding to 0.0.0.0 / :: logs a warning, but any other non-loopback host (LAN IP, container hostname, public DNS name) gets neither middleware nor that warning:

packages/middleware/express/src/express.ts (same ladder in packages/middleware/hono/src/hono.ts):

const localhostHosts = ['127.0.0.1', 'localhost', '::1'];
if (localhostHosts.includes(host)) {
    app.use(localhostHostValidation());
} else if (host === '0.0.0.0' || host === '::') {
    console.warn(
        `Warning: Server is binding to ${host} without DNS rebinding protection. ` +
            'Consider using the allowedHosts option...'
    );
}
// Origin: only armed for loopback or explicit allowedOrigins

So createMcpExpressApp({ host: '192.168.1.10' }) or { host: 'mcp.internal' } serves without Host/Origin checks and without the operator nudge that 0.0.0.0 already gets. DNS rebinding / browser-origin abuse is exactly what those middleware exist for on HTTP MCP endpoints.

Suggested change:

  • Treat every non-loopback host like 0.0.0.0: require allowedHosts (and ideally allowedOrigins), or at least emit the same warning.
  • Or fail closed: refuse to construct the app for non-loopback binds unless allowlists are provided.
  • Keep the explicit opt-out path for demos that truly need an open bind.

Severity: medium as insecure default / defense-in-depth for non-loopback HTTP mounts; not claiming a working exploit against a specific deployment. No proof-of-concept.

Happy to send a focused PR if this direction is useful.

Dominant language
TypeScript
Stars
13.4k
Forks
2.2k
Avg merge
4d 18h
Merged PRs (30d)
6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from modelcontextprotocol/typescript-sdk

All issues in modelcontextprotocol/typescript-sdk

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.