-
Notifications
You must be signed in to change notification settings - Fork 383
Add custom port/address parameter to --mcp flag with optional value support #208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Copilot
wants to merge
6
commits into
master
Choose a base branch
from
copilot/add-mcp-port-parameter
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Change --mcp from boolean to string flag - Support formats: :8080, http://localhost:8080 - Falls back to config.yaml if not specified - Update all IsMCPServer references to MCPServer string check Co-authored-by: keac <[email protected]>
- Use strings.HasPrefix instead of index check for safety - Organize imports for better readability Co-authored-by: keac <[email protected]>
Co-authored-by: keac <[email protected]>
Copilot
AI
changed the title
[WIP] Add parameter to specify port for mcp listener
Add custom port/address parameter to --mcp flag
Dec 5, 2025
keac
requested changes
Dec 5, 2025
Member
keac
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
未配置端口号情况下指定默认端口
- Implement custom mcpFlag type with IsBoolFlag() support - Allow --mcp (uses config.yaml default) or --mcp=:8080 (custom port) - Add MCPServerSet field to track if flag was explicitly set - Update all MCP server checks to use MCPServerSet flag Co-authored-by: keac <[email protected]>
- Add detailed comment explaining IsBoolFlag behavior - Update help text with specific usage examples - Address code review feedback Co-authored-by: keac <[email protected]>
Author
已实现。现在 用法示例:
|
Copilot
AI
changed the title
Add custom port/address parameter to --mcp flag
Add custom port/address parameter to --mcp flag with optional value support
Dec 5, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
--mcpflag only enabled MCP mode, requiring users to modifyconfig.yamlto change the listening port.Changes
--mcpto support optional values using custom flag implementation--mcpalone uses config.yaml default port (backward compatible)--mcpuses config.yaml default (e.g., port 8080)--mcp=:8080specifies custom port (short format, auto-expands tohttp://localhost:8080)--mcp=http://localhost:8080specifies full URL--mcp=http://0.0.0.0:8080specifies custom host with portmcpFlagtype implementingIsBoolFlag()interface for optional value behaviorMCPServerSetfield to track if flag was explicitly setconfig.yamlwhen specifiedUsage
The implementation uses
strings.HasPrefixfor safe string handling, validates addresses through the existingutils.ExtractPortStringfunction, and implements Go'sIsBoolFlag()interface to support optional values.Testing
--mcpwithout value uses config.yaml default port--mcp=:PORTcustom port format works correctly--mcp=http://...full URL format works correctlyOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.