feat: add a framework for translations #25
Merged
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.
Closes #24
i18n / Overriding descriptions
The descriptions of the tools can be overridden by creating a github-mcp-server.json file in the same directory as the binary.
The file should contain a JSON object with the tool names as keys and the new descriptions as values.
For example:
{ "TOOL_ADD_ISSUE_COMMENT_DESCRIPTION": "an alternative description", "TOOL_CREATE_BRANCH_DESCRIPTION": "Create a new branch in a GitHub repository" }You can create an export of the current translations by running the binary with the
--export-translationsflag.This flag will preserve any translations/overrides you have made, while adding any new translations that have been added to the binary since the last time you exported.
You can also use ENV vars to override the descriptions. The environment variable names are the same as the keys in the JSON file,
prefixed with
GITHUB_MCP_and all uppercase.For example, to override the
TOOL_ADD_ISSUE_COMMENT_DESCRIPTIONtool, you can set the following environment variable:The JSON Dump
So far, I have drawn the line at descriptions, but parameters can easily be added, I just didn't want this PR to touch any more parts. This is the whole shebang:
{ "RESOURCE_REPOSITORY_CONTENT_BRANCH_DESCRIPTION": "Repository Content for specific branch", "RESOURCE_REPOSITORY_CONTENT_COMMIT_DESCRIPTION": "Repository Content for specific commit", "RESOURCE_REPOSITORY_CONTENT_DESCRIPTION": "Repository Content", "RESOURCE_REPOSITORY_CONTENT_PR_DESCRIPTION": "Repository Content for specific pull request", "RESOURCE_REPOSITORY_CONTENT_TAG_DESCRIPTION": "Repository Content for specific tag", "TOOL_ADD_ISSUE_COMMENT_DESCRIPTION": "Add a comment to an existing issue", "TOOL_CREATE_BRANCH_DESCRIPTION": "Create a new branch in a GitHub repository", "TOOL_CREATE_OR_UPDATE_FILE_DESCRIPTION": "Create or update a single file in a GitHub repository", "TOOL_CREATE_REPOSITORY_DESCRIPTION": "Create a new GitHub repository in your account", "TOOL_FORK_REPOSITORY_DESCRIPTION": "Fork a GitHub repository to your account or specified organization", "TOOL_GET_CODE_SCANNING_ALERT_DESCRIPTION": "Get details of a specific code scanning alert in a GitHub repository.", "TOOL_GET_FILE_CONTENTS_DESCRIPTION": "Get the contents of a file or directory from a GitHub repository", "TOOL_GET_ISSUE_DESCRIPTION": "Get details of a specific issue in a GitHub repository.", "TOOL_GET_ME_DESCRIPTION": "Get details of the authenticated GitHub user", "TOOL_GET_PULL_REQUEST_COMMENTS_DESCRIPTION": "Get the review comments on a pull request", "TOOL_GET_PULL_REQUEST_DESCRIPTION": "Get details of a specific pull request", "TOOL_GET_PULL_REQUEST_FILES_DESCRIPTION": "Get the list of files changed in a pull request", "TOOL_GET_PULL_REQUEST_REVIEWS_DESCRIPTION": "Get the reviews on a pull request", "TOOL_GET_PULL_REQUEST_STATUS_DESCRIPTION": "Get the combined status of all status checks for a pull request", "TOOL_LIST_CODE_SCANNING_ALERTS_DESCRIPTION": "List code scanning alerts in a GitHub repository.", "TOOL_LIST_COMMITS_DESCRIPTION": "Get list of commits of a branch in a GitHub repository", "TOOL_LIST_PULL_REQUESTS_DESCRIPTION": "List and filter repository pull requests", "TOOL_MERGE_PULL_REQUEST_DESCRIPTION": "Merge a pull request", "TOOL_SEARCH_CODE_DESCRIPTION": "Search for code across GitHub repositories", "TOOL_SEARCH_ISSUES_DESCRIPTION": "Search for issues and pull requests across GitHub repositories", "TOOL_SEARCH_REPOSITORIES_DESCRIPTION": "Search for GitHub repositories", "TOOL_SEARCH_USERS_DESCRIPTION": "Search for GitHub users", "TOOL_UPDATE_PULL_REQUEST_BRANCH_DESCRIPTION": "Update a pull request branch with the latest changes from the base branch" }Live example
tools/listAn example running with a file, and an env var:
{ "jsonrpc": "2.0", "id": 3, "result": { "tools": [ { "description": "an alternative description", "inputSchema": { "type": "object", "properties": { "body": { "description": "Comment text", "type": "string" }, "issue_number": { "description": "Issue number to comment on", "type": "number" }, "owner": { "description": "Repository owner", "type": "string" }, "repo": { "description": "Repository name", "type": "string" } }, "required": [ "owner", "repo", "issue_number", "body" ] }, "name": "add_issue_comment" }, { "description": "OVERRIDE DESCRIPTION", "inputSchema": { "type": "object", "properties": { "branch": { "description": "Name for new branch", "type": "string" }, "from_branch": { "description": "Source branch (defaults to repo default)", "type": "string" }, "owner": { "description": "Repository owner", "type": "string" }, "repo": { "description": "Repository name", "type": "string" } }, "required": [ "owner", "repo", "branch" ] }, "name": "create_branch" }, ... ] } }