Skip to content

Commit a67a8b9

Browse files
author
piexlMax(奇淼
committed
feat: 增加全局GVA_MCP_SERVER属性,方便灵活化开发。
1 parent cbc140d commit a67a8b9

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

server/global/global.go

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package global
22

33
import (
44
"fmt"
5+
"github.com/mark3labs/mcp-go/server"
56
"sync"
67

78
"github.com/gin-gonic/gin"
@@ -35,6 +36,7 @@ var (
3536
GVA_Concurrency_Control = &singleflight.Group{}
3637
GVA_ROUTERS gin.RoutesInfo
3738
GVA_ACTIVE_DBNAME *string
39+
GVA_MCP_SERVER *server.MCPServer
3840
BlackCache local_cache.Cache
3941
lock sync.RWMutex
4042
)

server/initialize/mcp.go

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ func McpRun() *server.SSEServer {
1414
config.Version,
1515
)
1616

17+
global.GVA_MCP_SERVER = s
18+
1719
mcpTool.RegisterAllTools(s)
1820

1921
return server.NewSSEServer(s,

0 commit comments

Comments
 (0)