mcp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPServer

type HTTPServer struct {
	Name    string
	URL     string
	Headers map[string]string
	Type    string // "http" or "sse"
	// contains filtered or unexported fields
}

HTTPServer represents an MCP server connected via HTTP or SSE transport.

func ConnectHTTP

func ConnectHTTP(ctx context.Context, name, url string, headers map[string]string) (*HTTPServer, error)

ConnectHTTP connects to an MCP server via HTTP streamable transport.

func ConnectSSE

func ConnectSSE(ctx context.Context, name, url string, headers map[string]string) (*HTTPServer, error)

ConnectSSE connects to an MCP server via Server-Sent Events transport.

func (*HTTPServer) Call

func (s *HTTPServer) Call(ctx context.Context, method string, params interface{}) (json.RawMessage, error)

Call sends a JSON-RPC request and returns the result.

func (*HTTPServer) CallTool

func (s *HTTPServer) CallTool(ctx context.Context, name string, args map[string]interface{}) (string, error)

CallTool invokes a tool on the HTTP/SSE MCP server.

func (*HTTPServer) Close

func (s *HTTPServer) Close() error

Close is a no-op for HTTP/SSE servers (no persistent connection).

func (*HTTPServer) ListTools

func (s *HTTPServer) ListTools(ctx context.Context) ([]Tool, error)

ListTools returns tools from the HTTP/SSE MCP server.

type Resource

type Resource struct {
	URI         string `json:"uri"`
	Name        string `json:"name"`
	MimeType    string `json:"mimeType,omitempty"`
	Description string `json:"description,omitempty"`
}

Resource is a resource exposed by an MCP server.

type Server

type Server struct {
	Name    string
	Command string
	Args    []string
	// contains filtered or unexported fields
}

Server represents a connected MCP server.

func Connect

func Connect(ctx context.Context, name, command string, args ...string) (*Server, error)

Connect starts an MCP server process via stdio transport.

func (*Server) CallTool

func (s *Server) CallTool(name string, args map[string]interface{}) (string, error)

CallTool invokes a tool on the MCP server.

func (*Server) Close

func (s *Server) Close() error

Close shuts down the MCP server.

func (*Server) ListResources

func (s *Server) ListResources() ([]Resource, error)

ListResources returns resources available on this MCP server.

func (*Server) ListTools

func (s *Server) ListTools() ([]Tool, error)

ListTools returns tools available on this MCP server.

func (*Server) ReadResource

func (s *Server) ReadResource(uri string) (string, error)

ReadResource reads a resource from this MCP server.

type Tool

type Tool struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	InputSchema map[string]interface{} `json:"inputSchema"`
}

Tool is a tool exposed by an MCP server.

Jump to

Keyboard shortcuts

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