Skip to content

Conversation

codeMonkey-shin
Copy link

πŸ“‹ Summary

Added --listen command line option and LISTEN environment variable support to allow configurable host binding for the MCP server.

πŸ”§ Changes Made

  • βœ… Added --listen option to all entry points (run_server.py, kubectl_mcp_tool/mcp_server.py, kubectl_mcp_tool/cli.py)
  • βœ… Implemented LISTEN environment variable with special true value for 0.0.0.0 binding
  • βœ… Updated serve_sse methods to accept host parameter with fallback compatibility
  • βœ… Modified Dockerfile to use secure defaults (127.0.0.1)
  • βœ… Updated README with comprehensive Docker usage examples

πŸ”’ Security

  • Default: 127.0.0.1 (localhost only) for security
  • External Access: Set LISTEN=true or --listen 0.0.0.0 when needed

🐳 Docker Usage

```bash

Default (secure, localhost only)

docker run -p 8080:8000 kubectl-mcp-server

External access

docker run -p 8080:8000 -e LISTEN=true kubectl-mcp-server
```

πŸ§ͺ Testing

  • βœ… Verified default 127.0.0.1 binding
  • βœ… Verified LISTEN=true β†’ 0.0.0.0 binding
  • βœ… Verified command line options work correctly
  • βœ… Verified help text displays correct defaults

πŸ“š Documentation

  • Updated README with Docker examples and environment variables
  • Added clear security considerations
  • Documented all usage patterns

πŸ”„ Backward Compatibility

  • Maintains full backward compatibility
  • Existing deployments continue to work unchanged
  • New functionality is opt-in"

- Add --listen command line option to all entry points
- Support LISTEN environment variable with special 'true' value for 0.0.0.0 binding
- Default to 127.0.0.1 for security, use LISTEN=true for external access
- Update Dockerfile to use secure defaults
- Update README with Docker usage examples and environment variables
- Maintain backward compatibility with existing deployments
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.

1 participant