mcp_server

package
v1.7.0-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MCPBody   = "Body"
	MCPHeader = "Header"
	MCPQuery  = "Query"
	MCPPath   = "Path"
)

Variables

View Source
var (
	ServiceBasePath = "mcp/service"
	GlobalBasePath  = "mcp/global"
)

Functions

func DelSSEServer

func DelSSEServer(sid string)

func ServeHTTP

func ServeHTTP(w http.ResponseWriter, r *http.Request)

func SetSSEServer

func SetSSEServer(sid string, name string, version string, tools ...ITool)

Types

type API

type API struct {
	Path        string                 `json:"path"`
	Method      string                 `json:"method"`
	ContentType string                 `json:"content_type"`
	Summary     string                 `json:"summary"`
	Description string                 `json:"description"`
	Params      []*openapi3.Parameter  `json:"params"`
	Body        map[string]interface{} `json:"body"`
}

type ITool

type ITool interface {
	RegisterMCP(s *server.MCPServer)
}

func NewTool

func NewTool(name string, uri string, method string, contentType string, opts ...mcp.ToolOption) ITool

type MCPInfo

type MCPInfo struct {
	Name        string
	Description string
	Apis        []*API
}

func ConvertMCPFromOpenAPI3Data

func ConvertMCPFromOpenAPI3Data(data []byte) (*MCPInfo, error)

type Server

type Server struct {
	// contains filtered or unexported fields
}

func DefaultMCPServer

func DefaultMCPServer() *Server

func NewServer

func NewServer() *Server

func (*Server) Del

func (s *Server) Del(path string)

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) Set

func (s *Server) Set(path string, sseServer *server.SSEServer)

type Tool

type Tool struct {
	// contains filtered or unexported fields
}

func (*Tool) RegisterMCP

func (t *Tool) RegisterMCP(s *server.MCPServer)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL