Skip to content

Commit 107cf76

Browse files
Copilotkeac
andcommitted
Address code review feedback
- Use strings.HasPrefix instead of index check for safety - Organize imports for better readability Co-authored-by: keac <[email protected]>
1 parent 086fa0c commit 107cf76

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

runner/mcpServer.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ package runner
33
import (
44
"encoding/json"
55
"fmt"
6+
"log"
7+
"strconv"
8+
"strings"
9+
610
"github.com/mark3labs/mcp-go/mcp"
711
"github.com/mark3labs/mcp-go/server"
812
"github.com/wgpsec/ENScan/common"
913
"github.com/wgpsec/ENScan/common/gologger"
1014
"github.com/wgpsec/ENScan/common/utils"
1115
"golang.org/x/net/context"
12-
"log"
13-
"strconv"
1416
)
1517

1618
// getInfoPro 顾名思义,PRO方法
@@ -188,7 +190,7 @@ func McpServer(options *common.ENOptions) {
188190
}
189191

190192
// 如果只提供了端口(如 :8080),则补全为完整URL
191-
if len(mcpAddr) > 0 && mcpAddr[0] == ':' {
193+
if strings.HasPrefix(mcpAddr, ":") {
192194
mcpAddr = "http://localhost" + mcpAddr
193195
}
194196

0 commit comments

Comments
 (0)