From ce64f2a79309bc6bf8fe3750dca98736e1772a01 Mon Sep 17 00:00:00 2001 From: "dong.chen" Date: Tue, 5 Aug 2025 14:29:10 +0800 Subject: [PATCH 1/2] feat: add description for `github_host` in configuration --- configuration/default_settings.jsonc | 2 ++ configuration/installation_instructions.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/configuration/default_settings.jsonc b/configuration/default_settings.jsonc index f323533..3380537 100644 --- a/configuration/default_settings.jsonc +++ b/configuration/default_settings.jsonc @@ -1,4 +1,6 @@ { /// Your GitHub Personal Access Token "github_personal_access_token": "GITHUB_PERSONAL_ACCESS_TOKEN" + /// Your GitHub Host URL when customized (Optional) + // "github_host": "https://ghe.example.com/" } diff --git a/configuration/installation_instructions.md b/configuration/installation_instructions.md index 0364487..86df1ed 100644 --- a/configuration/installation_instructions.md +++ b/configuration/installation_instructions.md @@ -1 +1,3 @@ To use GitHub's MCP, go to your account's Developer Settings and [create a Personal Access Token](https://github.com/settings/tokens). + +You may setup GitHub host when using custom URL slugs. For more information, see [GitHub MCP with Enterprise Server](https://github.com/github/github-mcp-server#github-enterprise-server-and-enterprise-cloud-with-data-residency-ghecom). From 4e3976200aa05c69e56f55a3896f90cceb1b08b8 Mon Sep 17 00:00:00 2001 From: "dong.chen" Date: Tue, 5 Aug 2025 14:32:57 +0800 Subject: [PATCH 2/2] feat: pass in `github_host` when is not empty --- src/mcp_server_github.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/mcp_server_github.rs b/src/mcp_server_github.rs index 86dadf4..9f85482 100644 --- a/src/mcp_server_github.rs +++ b/src/mcp_server_github.rs @@ -12,6 +12,7 @@ const BINARY_NAME: &str = "github-mcp-server"; #[derive(Debug, Deserialize, JsonSchema)] struct GitHubContextServerSettings { github_personal_access_token: String, + github_host: Option, } struct GitHubModelContextExtension { @@ -113,13 +114,19 @@ impl zed::Extension for GitHubModelContextExtension { let settings: GitHubContextServerSettings = serde_json::from_value(settings).map_err(|e| e.to_string())?; + let mut env: Vec<(String, String)> = vec![( + "GITHUB_PERSONAL_ACCESS_TOKEN".into(), + settings.github_personal_access_token, + )]; + + if let Some(github_host) = settings.github_host.filter(|h| !h.trim().is_empty()) { + env.push(("GITHUB_HOST".into(), github_host)); + } + Ok(Command { command: self.context_server_binary_path(context_server_id)?, args: vec!["stdio".to_string()], - env: vec![( - "GITHUB_PERSONAL_ACCESS_TOKEN".into(), - settings.github_personal_access_token, - )], + env, }) }