mcp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteNotification

func WriteNotification(w io.Writer, n Notification) error

func WriteResponse

func WriteResponse(w io.Writer, resp Response) error

Types

type APIClient

type APIClient struct {
	BaseURL string
	APIKey  string
	HTTP    *http.Client
}

APIClient is a thin HTTP client for the hiveshare API, used by the MCP server to proxy tool calls.

func NewAPIClient

func NewAPIClient(baseURL, apiKey string) *APIClient

func (*APIClient) AddMemory

func (c *APIClient) AddMemory(ctx context.Context, hiveshareID string, entry map[string]interface{}) (map[string]interface{}, error)

func (*APIClient) GetContext

func (c *APIClient) GetContext(ctx context.Context, hiveshareID, sourceRef string) (interface{}, error)

func (*APIClient) GetMetrics

func (c *APIClient) GetMetrics(ctx context.Context, hiveshareID string) (interface{}, error)

func (*APIClient) ListHeadspaces

func (c *APIClient) ListHeadspaces(ctx context.Context) ([]map[string]interface{}, error)

func (*APIClient) SearchMemory

func (c *APIClient) SearchMemory(ctx context.Context, hiveshareID, query, sourceType string, limit int) (map[string]interface{}, error)

type InputSchema

type InputSchema struct {
	Type       string              `json:"type"`
	Properties map[string]Property `json:"properties"`
	Required   []string            `json:"required,omitempty"`
}

type Notification

type Notification struct {
	JSONRPC string      `json:"jsonrpc"`
	Method  string      `json:"method"`
	Params  interface{} `json:"params,omitempty"`
}

type Property

type Property struct {
	Type        string `json:"type"`
	Description string `json:"description"`
}

type RPCError

type RPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func Errorf

func Errorf(code int, msg string, args ...interface{}) *RPCError

type Request

type Request struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      interface{}     `json:"id"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

func ReadRequest

func ReadRequest(r *bufio.Reader) (*Request, error)

type Response

type Response struct {
	JSONRPC string      `json:"jsonrpc"`
	ID      interface{} `json:"id"`
	Result  interface{} `json:"result,omitempty"`
	Error   *RPCError   `json:"error,omitempty"`
}

type Server

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

Server is the MCP stdio server.

func NewServer

func NewServer(client *APIClient, defaultHiveshare string, reader io.Reader, writer io.Writer) *Server

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

type Tool

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

Tool definition for MCP initialize response

Jump to

Keyboard shortcuts

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