Skip to content

allow individual tools to be disabled #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os/exec"
"os/signal"
"path/filepath"
"strings"
"syscall"
"time"

Expand All @@ -24,6 +25,9 @@ type config struct {
workspaceDir string
lspCommand string
lspArgs []string

disabledToolStr string
disabledTools []string
}

type mcpServer struct {
Expand All @@ -39,11 +43,17 @@ func parseConfig() (*config, error) {
cfg := &config{}
flag.StringVar(&cfg.workspaceDir, "workspace", "", "Path to workspace directory")
flag.StringVar(&cfg.lspCommand, "lsp", "", "LSP command to run (args should be passed after --)")
flag.StringVar(&cfg.disabledToolStr, "disable-tools", "", "Comma-separated list of tools to disable")
flag.Parse()

// Get remaining args after -- as LSP arguments
cfg.lspArgs = flag.Args()

// Parse disabled tools
if cfg.disabledToolStr != "" {
cfg.disabledTools = append(cfg.disabledTools, strings.Split(cfg.disabledToolStr, ",")...)
}

// Validate workspace directory
if cfg.workspaceDir == "" {
return nil, fmt.Errorf("workspace directory is required")
Expand Down
2 changes: 2 additions & 0 deletions tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ func (s *mcpServer) registerTools() error {
return mcp.NewToolResultText(text), nil
})

s.mcpServer.DeleteTools(s.config.disabledTools...)

coreLogger.Info("Successfully registered all MCP tools")
return nil
}