Add all in one mcp (#1978)

This commit is contained in:
澄潭
2025-03-30 00:25:21 +08:00
committed by GitHub
parent 037c71a320
commit 492c5d350a
14 changed files with 318 additions and 75 deletions

View File

@@ -5,7 +5,7 @@ go 1.24
toolchain go1.24.1
require (
github.com/alibaba/higress/plugins/wasm-go v1.4.4-0.20250329122411-e07be585ff55
github.com/alibaba/higress/plugins/wasm-go v1.4.4-0.20250329145934-61b36a20cd9c
github.com/tidwall/gjson v1.17.3
)

View File

@@ -1,5 +1,5 @@
github.com/alibaba/higress/plugins/wasm-go v1.4.4-0.20250329122411-e07be585ff55 h1:yGPhs3VhC4Mj4SmbaLcKSZ1sV8wRW/eGf/13P0c2+S8=
github.com/alibaba/higress/plugins/wasm-go v1.4.4-0.20250329122411-e07be585ff55/go.mod h1:csP9Mpkc+gVgbZsizCdcYSy0LJrQA+//RcnZBInyknc=
github.com/alibaba/higress/plugins/wasm-go v1.4.4-0.20250329145934-61b36a20cd9c h1:giBV8e7p0qxRdBsCu4AjXbpUI8sNiGkEtPNWEXf6fA4=
github.com/alibaba/higress/plugins/wasm-go v1.4.4-0.20250329145934-61b36a20cd9c/go.mod h1:csP9Mpkc+gVgbZsizCdcYSy0LJrQA+//RcnZBInyknc=
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=

View File

@@ -17,14 +17,13 @@ package main
import (
"quark-search/tools"
"github.com/alibaba/higress/plugins/wasm-go/pkg/mcp/server"
"github.com/alibaba/higress/plugins/wasm-go/pkg/mcp"
)
func main() {}
func init() {
quarkSearchServer := &server.MCPServer{}
server.Load(server.AddMCPServer(
"quark-search",
quarkSearchServer.AddMCPTool("web_search", &tools.WebSearch{})))
mcp.LoadMCPServer(mcp.AddMCPServer("quark-search",
tools.LoadTools(&mcp.MCPServer{})))
mcp.InitMCPServer()
}

View File

@@ -0,0 +1,24 @@
// Copyright (c) 2022 Alibaba Group Holding Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package tools
import (
"github.com/alibaba/higress/plugins/wasm-go/pkg/mcp"
"github.com/alibaba/higress/plugins/wasm-go/pkg/mcp/server"
)
func LoadTools(server *mcp.MCPServer) server.Server {
return server.AddMCPTool("web_search", &WebSearch{})
}