Include meaningful User-Agent header in requests to the GitHub UI
This adds a custom `User-Agent` header to requests from the GitHub server to the GitHub API, identifying the application, the version and key information about the environment. This aligns with the [recommendations][1] in the GitHub Docs. As part of this change, I have also moved the current version of the server into a constant, and fix the initialization of `Server` to use that version, taking from `package.json`. [1]: https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api?apiVersion=2022-11-28#user-agent
This commit is contained in:
parent
0f7730209d
commit
df63442c3c
1 changed files with 11 additions and 3 deletions
|
|
@ -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: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue