mcp_server

package
v1.7.2-beta Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: Apache-2.0 Imports: 12 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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