mirror of
https://github.com/alibaba/higress.git
synced 2026-05-26 21:57:30 +08:00
add: add mcp server amap tools (#1951)
This commit is contained in:
33
plugins/wasm-go/mcp-servers/amap-tools/server/server.go
Normal file
33
plugins/wasm-go/mcp-servers/amap-tools/server/server.go
Normal file
@@ -0,0 +1,33 @@
|
||||
// server/server.go
|
||||
package server
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/alibaba/higress/plugins/wasm-go/pkg/wrapper"
|
||||
)
|
||||
|
||||
// Define your server configuration structure
|
||||
type AmapMCPServer struct {
|
||||
ApiKey string `json:"apiKey"`
|
||||
// Add other configuration fields as needed
|
||||
}
|
||||
|
||||
// Validate the configuration
|
||||
func (s AmapMCPServer) ConfigHasError() error {
|
||||
if s.ApiKey == "" {
|
||||
return errors.New("missing api key")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Parse configuration from JSON
|
||||
func ParseFromConfig(configBytes []byte, server *AmapMCPServer) error {
|
||||
return json.Unmarshal(configBytes, server)
|
||||
}
|
||||
|
||||
// Parse configuration from HTTP request
|
||||
func ParseFromRequest(ctx wrapper.HttpContext, server *AmapMCPServer) error {
|
||||
return ctx.ParseMCPServerConfig(server)
|
||||
}
|
||||
Reference in New Issue
Block a user