Skip to content

Commit 290de37

Browse files
committed
script to run cli config program
1 parent bbfaea1 commit 290de37

File tree

4 files changed

+44
-24
lines changed

4 files changed

+44
-24
lines changed

.vscode/launch.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@
2323
"program": "cmd/github-mcp-server/main.go",
2424
"args": ["stdio", "--read-only"],
2525
"console": "integratedTerminal",
26+
},
27+
{
28+
"name": "Run Configuration Tool",
29+
"type": "go",
30+
"request": "launch",
31+
"mode": "auto",
32+
"cwd": "${workspaceFolder}",
33+
"program": "cmd/github-mcp-server",
34+
"args": ["configure"],
35+
"console": "integratedTerminal",
2636
}
2737
]
2838
}
Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ import (
1515
"github.com/spf13/cobra"
1616
)
1717

18-
var wizardCmd = &cobra.Command{
19-
Use: "wizard",
20-
Short: "Interactive configuration wizard for GitHub MCP Server",
21-
Long: `This wizard will help you configure which specific tools to enable.`,
22-
RunE: runWizard,
18+
var configureCmd = &cobra.Command{
19+
Use: "configure",
20+
Short: "Interactive configuration tool for GitHub MCP Server",
21+
Long: `This interactive tool will help you configure which specific tools to enable.`,
22+
RunE: runConfigure,
2323
}
2424

25-
// Styles for the wizard UI
25+
// Styles for the configuration UI
2626
var (
2727
titleStyle = lipgloss.NewStyle().
2828
Bold(true).
@@ -98,7 +98,7 @@ const asciiArt = `
9898
| |__| | | |_| | | | |_| | |_) | | | | | |____| |
9999
\_____|_|\__|_| |_|\__,_|_.__/ |_| |_|\_____|_|
100100
101-
🧙 Configuration Wizard 🔧
101+
🔧 Configuration Tool ⚙️
102102
`
103103

104104
type toolInfo struct {
@@ -114,7 +114,7 @@ type toolsetInfo struct {
114114
tools []toolInfo
115115
}
116116

117-
type wizardModel struct {
117+
type configureModel struct {
118118
toolsets []toolsetInfo
119119
allTools []toolInfo
120120
filteredTools []toolInfo
@@ -130,14 +130,14 @@ type wizardModel struct {
130130
showWelcome bool
131131
}
132132

133-
func initialWizardModel(toolsets []toolsetInfo) wizardModel {
133+
func initialConfigureModel(toolsets []toolsetInfo) configureModel {
134134
// Flatten all tools
135135
var allTools []toolInfo
136136
for _, ts := range toolsets {
137137
allTools = append(allTools, ts.tools...)
138138
}
139139

140-
return wizardModel{
140+
return configureModel{
141141
toolsets: toolsets,
142142
allTools: allTools,
143143
filteredTools: allTools,
@@ -148,11 +148,11 @@ func initialWizardModel(toolsets []toolsetInfo) wizardModel {
148148
}
149149
}
150150

151-
func (m wizardModel) Init() tea.Cmd {
151+
func (m configureModel) Init() tea.Cmd {
152152
return nil
153153
}
154154

155-
func (m wizardModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
155+
func (m configureModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
156156
switch msg := msg.(type) {
157157
case tea.WindowSizeMsg:
158158
m.width = msg.Width
@@ -277,7 +277,7 @@ func (m wizardModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
277277
return m, nil
278278
}
279279

280-
func (m *wizardModel) applyFilter() {
280+
func (m *configureModel) applyFilter() {
281281
if m.filter == "" {
282282
m.filteredTools = m.allTools
283283
} else {
@@ -295,7 +295,7 @@ func (m *wizardModel) applyFilter() {
295295
m.viewportOffset = 0
296296
}
297297

298-
func (m *wizardModel) adjustViewport() {
298+
func (m *configureModel) adjustViewport() {
299299
maxVisible := m.height - 10 // Reserve space for header and footer
300300
if maxVisible < 1 {
301301
maxVisible = 10
@@ -308,7 +308,7 @@ func (m *wizardModel) adjustViewport() {
308308
}
309309
}
310310

311-
func (m wizardModel) View() string {
311+
func (m configureModel) View() string {
312312
if m.quitting && !m.confirmed {
313313
return dimStyle.Render("\nConfiguration cancelled.\n")
314314
}
@@ -326,7 +326,7 @@ func (m wizardModel) View() string {
326326
var s strings.Builder
327327

328328
// Header
329-
s.WriteString(titleStyle.Render("🧙 GitHub MCP Server Configuration Wizard"))
329+
s.WriteString(titleStyle.Render("🔧 GitHub MCP Server Configuration Tool"))
330330
s.WriteString("\n")
331331
s.WriteString(subtitleStyle.Render("Select the tools you want to enable for your MCP server"))
332332
s.WriteString("\n")
@@ -432,7 +432,7 @@ func (m wizardModel) View() string {
432432
return s.String()
433433
}
434434

435-
func (m wizardModel) renderWelcome() string {
435+
func (m configureModel) renderWelcome() string {
436436
var s strings.Builder
437437

438438
// Center the content vertically
@@ -455,7 +455,7 @@ func (m wizardModel) renderWelcome() string {
455455
Width(70).
456456
Align(lipgloss.Center).
457457
Foreground(lipgloss.Color("#FFFFFF")).
458-
Render("Welcome to the GitHub MCP Server Configuration Wizard!")
458+
Render("Welcome to the GitHub MCP Server Configuration Tool!")
459459
s.WriteString(welcomeMsg)
460460
s.WriteString("\n\n")
461461

@@ -516,7 +516,7 @@ func (m wizardModel) renderWelcome() string {
516516
return s.String()
517517
}
518518

519-
func (m wizardModel) renderConfirmation() string {
519+
func (m configureModel) renderConfirmation() string {
520520
var s strings.Builder
521521

522522
// Get selected tools
@@ -677,23 +677,23 @@ func getFirstSentence(description string) string {
677677
}
678678

679679

680-
func runWizard(cmd *cobra.Command, args []string) error {
680+
func runConfigure(cmd *cobra.Command, args []string) error {
681681
// Dynamically get available toolsets
682682
toolsets := getAvailableToolsets()
683683

684684
// Create and run the Bubble Tea program
685685
p := tea.NewProgram(
686-
initialWizardModel(toolsets),
686+
initialConfigureModel(toolsets),
687687
tea.WithAltScreen(),
688688
)
689689

690690
finalModel, err := p.Run()
691691
if err != nil {
692-
return fmt.Errorf("error running wizard: %w", err)
692+
return fmt.Errorf("error running configuration: %w", err)
693693
}
694694

695695
// Cast the final model and print confirmation if needed
696-
if m, ok := finalModel.(wizardModel); ok {
696+
if m, ok := finalModel.(configureModel); ok {
697697
if m.confirmed {
698698
// Print the confirmation output after exiting alt screen
699699
fmt.Print(m.renderConfirmation())

cmd/github-mcp-server/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func init() {
103103

104104
// Add subcommands
105105
rootCmd.AddCommand(stdioCmd)
106-
rootCmd.AddCommand(wizardCmd)
106+
rootCmd.AddCommand(configureCmd)
107107
}
108108

109109
func initConfig() {

script/configure

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# This script runs the interactive configuration CLI program for the GitHub MCP server.
4+
# It helps you select which tools to enable and generates the configuration.
5+
6+
set -e
7+
8+
cd "$(dirname "$0")/.."
9+
10+
go run ./cmd/github-mcp-server configure

0 commit comments

Comments
 (0)