-
-
Notifications
You must be signed in to change notification settings - Fork 462
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
Add MCP server support and enhance server command options #709
base: main
Are you sure you want to change the base?
Conversation
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.
Hello @hahwul, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
This pull request introduces support for the MCP (Message Control Protocol) server type in addition to the existing REST API server. It enhances the command options to allow specifying the server type and improves logging for server startup. The changes primarily affect the cmd/server.go
file, where the server type flag is added and the server startup logic is modified to support both REST and MCP server types. Additionally, a new file pkg/server/mcp.go
is added, containing the implementation for running the MCP server. The go.mod
and go.sum
files are also updated to include the necessary dependencies for the MCP server.
Highlights
- MCP Server Support: Adds support for running the application as an MCP server, enabling interaction through the Message Control Protocol.
- Command-Line Option Enhancement: Introduces a new
--type
flag to theserver
command, allowing users to specify whether to start a REST API server or an MCP server. - Dependency Updates: Updates
go.mod
andgo.sum
to include dependencies required for the MCP server, such asgithub.com/mark3labs/mcp-go
andgithub.com/google/uuid
.
Changelog
Click here to see the changelog
- cmd/server.go
- Added
server_type
variable to store the server type (REST or MCP). (line 10) - Modified
runServerCmd
function to start either REST API server or MCP server based on theserver_type
flag. (lines 24-31) - Added a new flag
--type
to specify the server type. (line 39)
- Added
- go.mod
- Added
github.com/google/uuid v1.6.0
as a dependency. (line 44) - Added
github.com/mark3labs/mcp-go v0.20.0
as a dependency. (line 49) - Added
github.com/yosida95/uritemplate/v3 v3.0.2
as a dependency. (line 61)
- Added
- go.sum
- Added checksums for the new dependencies:
github.com/google/uuid
,github.com/mark3labs/mcp-go
, andgithub.com/yosida95/uritemplate/v3
. (lines 51, 77, 130)
- Added checksums for the new dependencies:
- pkg/server/mcp.go
- Created a new file
pkg/server/mcp.go
to implement the MCP server functionality. (line 1) - Implemented the
RunMCPServer
function to start the MCP server, define tools, and handle requests. (line 16) - Implemented
generateScanID
function to create a unique scan ID for MCP scans. (line 239)
- Created a new file
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
A server's choice, a flag's command,
REST or MCP, across the land.
New protocols arise,
Beneath the digital skies,
Scanning the web, close at hand.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
The pull request introduces support for the MCP server type and enhances server command options. The changes look good overall, but there are a few areas that could be improved for clarity and maintainability.
Summary of Findings
- Error Handling in MCP Server: The MCP server implementation includes error handling, but it could be more robust. Specifically, the error handling within the tool handlers could be improved to provide more informative error messages to the client.
- Parameter Parsing in MCP Server: The parameter parsing in the MCP server's tool handlers relies on type assertions, which can lead to runtime errors if the client provides incorrect data types. Consider adding validation to ensure that the provided parameters match the expected types.
- Scan ID Generation: The scan ID generation logic in the MCP server could be improved to ensure uniqueness and prevent collisions. Consider using a more robust method for generating scan IDs, such as UUIDs.
Merge Readiness
The pull request introduces significant new functionality with the MCP server support. While the core implementation appears functional, the identified issues related to error handling, parameter parsing, and scan ID generation should be addressed to improve the robustness and maintainability of the code. I recommend addressing these issues before merging. I am unable to approve this pull request, and other reviewers should review and approve this code before merging.
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
Introduce support for the MCP server type in addition to the existing REST API server. Enhance command options to specify server type and improve logging for server startup.