diff --git a/src/github/common/utils.ts b/src/github/common/utils.ts index 21c8aa71a..e85691a0b 100644 --- a/src/github/common/utils.ts +++ b/src/github/common/utils.ts @@ -1,10 +1,12 @@ +import { getUserAgent } from "universal-user-agent"; import { createGitHubError } from "./errors.js"; +import { VERSION } from "./version.js"; type RequestOptions = { method?: string; body?: unknown; headers?: Record; -}; +} async function parseResponseBody(response: Response): Promise { const contentType = response.headers.get("content-type"); @@ -24,6 +26,8 @@ export function buildUrl(baseUrl: string, params: Record = { "Accept": "application/vnd.github.v3+json", "Content-Type": "application/json", + "User-Agent": USER_AGENT, ...options.headers, }; diff --git a/src/github/common/version.ts b/src/github/common/version.ts new file mode 100644 index 000000000..00b8a6918 --- /dev/null +++ b/src/github/common/version.ts @@ -0,0 +1 @@ +export const VERSION = "0.6.2"; \ No newline at end of file diff --git a/src/github/index.ts b/src/github/index.ts index 3d60e8faf..88b236894 100644 --- a/src/github/index.ts +++ b/src/github/index.ts @@ -25,11 +25,12 @@ import { GitHubConflictError, isGitHubError, } from './common/errors.js'; +import { VERSION } from "./common/version.js"; const server = new Server( { name: "github-mcp-server", - version: "0.1.0", + version: VERSION, }, { capabilities: { diff --git a/src/github/package.json b/src/github/package.json index 46d24ccd6..29f5296b6 100644 --- a/src/github/package.json +++ b/src/github/package.json @@ -23,6 +23,7 @@ "@types/node": "^22", "@types/node-fetch": "^2.6.12", "node-fetch": "^3.3.2", + "universal-user-agent": "^7.0.2", "zod": "^3.22.4", "zod-to-json-schema": "^3.23.5" }, @@ -30,4 +31,4 @@ "shx": "^0.3.4", "typescript": "^5.6.2" } -} \ No newline at end of file +}