Skip to content

Commit 09c5a0a

Browse files
Add content filtering flag to CLI and server configuration
Co-authored-by: SamMorrowDrums <4811358+SamMorrowDrums@users.noreply.github.com>
1 parent e2f6b44 commit 09c5a0a

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

cmd/github-mcp-server/main.go

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,16 @@ var (
4444
}
4545

4646
stdioServerConfig := ghmcp.StdioServerConfig{
47-
Version: version,
48-
Host: viper.GetString("host"),
49-
Token: token,
50-
EnabledToolsets: enabledToolsets,
51-
DynamicToolsets: viper.GetBool("dynamic_toolsets"),
52-
ReadOnly: viper.GetBool("read-only"),
53-
ExportTranslations: viper.GetBool("export-translations"),
54-
EnableCommandLogging: viper.GetBool("enable-command-logging"),
55-
LogFilePath: viper.GetString("log-file"),
47+
Version: version,
48+
Host: viper.GetString("host"),
49+
Token: token,
50+
EnabledToolsets: enabledToolsets,
51+
DynamicToolsets: viper.GetBool("dynamic_toolsets"),
52+
ReadOnly: viper.GetBool("read-only"),
53+
DisableContentFiltering: viper.GetBool("disable-content-filtering"),
54+
ExportTranslations: viper.GetBool("export-translations"),
55+
EnableCommandLogging: viper.GetBool("enable-command-logging"),
56+
LogFilePath: viper.GetString("log-file"),
5657
}
5758

5859
return ghmcp.RunStdioServer(stdioServerConfig)
@@ -73,6 +74,7 @@ func init() {
7374
rootCmd.PersistentFlags().Bool("enable-command-logging", false, "When enabled, the server will log all command requests and responses to the log file")
7475
rootCmd.PersistentFlags().Bool("export-translations", false, "Save translations to a JSON file")
7576
rootCmd.PersistentFlags().String("gh-host", "", "Specify the GitHub hostname (for GitHub Enterprise etc.)")
77+
rootCmd.PersistentFlags().Bool("disable-content-filtering", false, "Disable filtering of invisible characters and hidden content from GitHub issues, PRs, and comments")
7678

7779
// Bind flag to viper
7880
_ = viper.BindPFlag("toolsets", rootCmd.PersistentFlags().Lookup("toolsets"))
@@ -82,6 +84,7 @@ func init() {
8284
_ = viper.BindPFlag("enable-command-logging", rootCmd.PersistentFlags().Lookup("enable-command-logging"))
8385
_ = viper.BindPFlag("export-translations", rootCmd.PersistentFlags().Lookup("export-translations"))
8486
_ = viper.BindPFlag("host", rootCmd.PersistentFlags().Lookup("gh-host"))
87+
_ = viper.BindPFlag("disable-content-filtering", rootCmd.PersistentFlags().Lookup("disable-content-filtering"))
8588

8689
// Add subcommands
8790
rootCmd.AddCommand(stdioCmd)

internal/ghmcp/server.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ type MCPServerConfig struct {
4343
// ReadOnly indicates if we should only offer read-only tools
4444
ReadOnly bool
4545

46+
// DisableContentFiltering disables filtering of invisible characters and hidden content
47+
DisableContentFiltering bool
48+
4649
// Translator provides translated text for the server tooling
4750
Translator translations.TranslationHelperFunc
4851
}
@@ -160,6 +163,9 @@ type StdioServerConfig struct {
160163
// ReadOnly indicates if we should only register read-only tools
161164
ReadOnly bool
162165

166+
// DisableContentFiltering disables filtering of invisible characters and hidden content
167+
DisableContentFiltering bool
168+
163169
// ExportTranslations indicates if we should export translations
164170
// See: https://github.com/github/github-mcp-server?tab=readme-ov-file#i18n--overriding-descriptions
165171
ExportTranslations bool
@@ -180,13 +186,14 @@ func RunStdioServer(cfg StdioServerConfig) error {
180186
t, dumpTranslations := translations.TranslationHelper()
181187

182188
ghServer, err := NewMCPServer(MCPServerConfig{
183-
Version: cfg.Version,
184-
Host: cfg.Host,
185-
Token: cfg.Token,
186-
EnabledToolsets: cfg.EnabledToolsets,
187-
DynamicToolsets: cfg.DynamicToolsets,
188-
ReadOnly: cfg.ReadOnly,
189-
Translator: t,
189+
Version: cfg.Version,
190+
Host: cfg.Host,
191+
Token: cfg.Token,
192+
EnabledToolsets: cfg.EnabledToolsets,
193+
DynamicToolsets: cfg.DynamicToolsets,
194+
ReadOnly: cfg.ReadOnly,
195+
DisableContentFiltering: cfg.DisableContentFiltering,
196+
Translator: t,
190197
})
191198
if err != nil {
192199
return fmt.Errorf("failed to create MCP server: %w", err)

0 commit comments

Comments
 (0)