Skip to content

feat: supports allowed_hosts/allowed_origins for DNS rebinding protections#32

Merged
sunng87 merged 3 commits intomainfrom
feature/enable_dns_rebinding_protection
Dec 23, 2025
Merged

feat: supports allowed_hosts/allowed_origins for DNS rebinding protections#32
sunng87 merged 3 commits intomainfrom
feature/enable_dns_rebinding_protection

Conversation

@killme2008
Copy link
Contributor

See modelcontextprotocol/python-sdk#1798

  • allowed_hosts to enable DNS rebinding protection.
  • allowed_origins to set allowed origins for CORS (for sse/streamable-http), only works when allowed_hosts is set.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds DNS rebinding protection and CORS configuration support for HTTP-based MCP transports (SSE and streamable-http). The implementation introduces two new configuration parameters that allow users to control security settings for their server deployments, with protection disabled by default for backward compatibility.

  • Adds allowed_hosts parameter to enable DNS rebinding protection with configurable host whitelist
  • Adds allowed_origins parameter to configure CORS allowed origins (only effective when DNS rebinding protection is enabled)
  • Version bump from 0.4.1 to 0.4.2

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/greptimedb_mcp_server/config.py Adds allowed_hosts and allowed_origins fields to Config dataclass with CLI and environment variable parsing logic
src/greptimedb_mcp_server/server.py Implements DNS rebinding protection configuration using TransportSecuritySettings based on the new config parameters
tests/test_server.py Updates test fixture to include empty lists for new allowed_hosts and allowed_origins parameters
README.md Documents the DNS rebinding protection feature with usage examples for CLI arguments and environment variables
pyproject.toml Bumps version from 0.4.1 to 0.4.2

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Dennis Zhuang <[email protected]>
@sunng87 sunng87 merged commit f60b305 into main Dec 23, 2025
1 check 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