Description
Describe the bug
The github-mcp-server
is incompatible with OpenAI models (like gpt-4.1
and gpt-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 by github-mcp-server
are missing this property in their schema, causing API requests to fail with a 400 Bad Request
error. This prevents the server from being used effectively with OpenAI-based clients.
Affected version
GitHub MCP Server
Version: v0.2.1
Commit: 9fa582d8d63522d70ce8f3af58265effb9645323
Build 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 a 400 Bad Request
error because the schema is invalid. The specific error indicates that additionalProperties
is required and must be false
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 underlying mcp-go
framework (github.com/mark3labs/mcp-go
), which doesn't add the required additionalProperties: false
property to the top-level parameter object for most tools defined via mcp.NewTool
.
It's worth noting that while tools like PushFiles
(repositories.go
) and CreatePullRequestReview
(pullrequests.go
) correctly define additionalProperties: false
for the schema of items within their specific array parameters (using mcp.Items
), this specific fix doesn't apply to the top-level parameters object of those tools, nor does it apply to the simpler tools (like add_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 the mcp-go
framework seems necessary for broad compatibility.