Skip to content

Conversation

Copy link

Copilot AI commented Dec 30, 2025

User requested ability to specify MCP server listening port via command-line parameter instead of only through config file.

Changes

Flag & Configuration

  • Added --mcp-port string flag in common/flag.go
  • Added McpPort field to ENOptions struct in common/config.go

Port Selection Logic (runner/mcpServer.go)

  • Command-line port takes precedence over config file
  • Validates port range (1-65535) when specified via flag
  • Config file fallback maintains backward compatibility

Documentation (README.md)

  • Added usage examples for both default and custom port scenarios

Usage

# Use config file port (default: 8080)
./enscan --mcp

# Override with custom port
./enscan --mcp --mcp-port 9090

Port validation prevents invalid values at startup:

./enscan --mcp --mcp-port 99999
# Error: 无效的端口号: 99999 (端口号必须在 1-65535 之间)
Original prompt

This section details on the original issue you should resolve

<issue_title>可以在--mcp地方加个参数指定监听到某个端口吗</issue_title>
<issue_description>可以在--mcp地方加个参数指定监听到某个端口吗</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits December 30, 2025 02:18
Co-authored-by: keac <16091665+keac@users.noreply.github.com>
Co-authored-by: keac <16091665+keac@users.noreply.github.com>
Co-authored-by: keac <16091665+keac@users.noreply.github.com>
Co-authored-by: keac <16091665+keac@users.noreply.github.com>
Copilot AI changed the title [WIP] Add option to specify port in mcp parameter Add --mcp-port flag for runtime port configuration Dec 30, 2025
Copilot AI requested a review from keac December 30, 2025 02:23
@keac keac closed this Jan 5, 2026
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.

可以在--mcp地方加个参数指定监听到某个端口吗

2 participants