- Notifications
You must be signed in to change notification settings - Fork949
Description
Describe the bug
Thegithub-mcp-server
is incompatible with OpenAI models (likegpt-4.1
andgpt-4o-mini
) that use function/tool calling. The OpenAI API requires tool parameter schemas to explicitly include"additionalProperties": false
at the top level. Most tools generated bygithub-mcp-server
are missing this property in their schema, causing API requests to fail with a400 Bad Request
error. This prevents the server from being used effectively with OpenAI-based clients.
Affected version
GitHub MCP ServerVersion: v0.2.1Commit: 9fa582d8d63522d70ce8f3af58265effb9645323Build Date: 2025-04-21T23:03:01Z
Steps to reproduce the behavior
- Run the
ghcr.io/github/github-mcp-server:v0.2.1
Docker image (or build from source commit9fa582d
) with a validGITHUB_PERSONAL_ACCESS_TOKEN
. - Configure an MCP client to use this server with an OpenAI model that supports function/tool calling (e.g.,
gpt-4.1-nano
). - Attempt to invoke a tool like
add_issue_comment
orget_pull_request
through the client. - Observe the error returned by the OpenAI API (either in server logs or client response).
Expected vs actual behavior
Expected: The tool call should be successfully sent to the OpenAI model, and the model should be able to invoke the tool using the provided schema.
Actual: The OpenAI API rejects the tool call with a400 Bad Request
error because the schema is invalid. The specific error indicates thatadditionalProperties
is required and must befalse
in the tool's parameter schema.
Logs
Example OpenAI Error Log:
ERROR API status error from OpenAI API: Error code: 400 - {'error': {'message': "Invalid schema for function 'add_issue_comment': In context=(), 'additionalProperties' is required to be supplied and to be false.", 'type': 'invalid_request_error', 'param': 'tools[0].function.parameters', 'code': 'invalid_function_parameters'}} WARNING Attempt 1/1 failed: Invalid schema for function 'add_issue_comment': In context=(), 'additionalProperties' is required to be supplied and to be false.
Additional Context:
The root cause appears to be the schema generation logic within the underlyingmcp-go
framework (github.com/mark3labs/mcp-go
), which doesn't add the requiredadditionalProperties: false
property to the top-level parameter object for most tools defined viamcp.NewTool
.
It's worth noting that while tools likePushFiles
(repositories.go
) andCreatePullRequestReview
(pullrequests.go
) correctly defineadditionalProperties: false
for the schema ofitems within their specific array parameters (usingmcp.Items
), this specific fix doesn't apply to thetop-level parameters object of those tools, nor does it apply to the simpler tools (likeadd_issue_comment
) that lack such nested structures. The core issue remains the generation of the main tool parameter schema required by the OpenAI API.
A fix within themcp-go
framework seems necessary for broad compatibility.