mcp

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ProtocolVersion = "2024-11-05"
	ServerName      = "goquent"
	ServerVersion   = "0.1.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Content

type Content struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

Content is text content returned by tools/prompts/resources.

type Options

type Options struct {
	Manifest  *manifest.Manifest
	Resources []string
	Tools     []string
	Prompts   []string
}

Options configures the read-only MCP server.

type Prompt

type Prompt struct {
	Name        string           `json:"name"`
	Description string           `json:"description,omitempty"`
	Arguments   []PromptArgument `json:"arguments,omitempty"`
}

Prompt describes an MCP prompt template.

type PromptArgument

type PromptArgument struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Required    bool   `json:"required,omitempty"`
}

PromptArgument describes a prompt parameter.

type PromptMessage

type PromptMessage struct {
	Role    string  `json:"role"`
	Content Content `json:"content"`
}

PromptMessage is returned by prompts/get.

type Resource

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

Resource describes an MCP resource.

type Server

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

Server exposes Goquent schema, review, and planning helpers through MCP.

func NewServer

func NewServer(opts Options) *Server

NewServer creates a read-only MCP server.

func (*Server) CallTool

func (s *Server) CallTool(ctx context.Context, name string, args map[string]any) (ToolResult, error)

CallTool executes a read-only MCP tool.

func (*Server) GetPrompt

func (s *Server) GetPrompt(name string, args map[string]any) ([]PromptMessage, error)

GetPrompt returns a prompt body.

func (*Server) HandleJSONRPC

func (s *Server) HandleJSONRPC(ctx context.Context, payload []byte) ([]byte, bool)

HandleJSONRPC handles one JSON-RPC request payload.

func (*Server) Prompts

func (s *Server) Prompts() []Prompt

Prompts lists prompt templates.

func (*Server) ReadResource

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

ReadResource returns a resource body.

func (*Server) Resources

func (s *Server) Resources() []Resource

Resources lists read-only Goquent resources.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, r io.Reader, w io.Writer) error

Serve runs a minimal MCP stdio JSON-RPC server.

func (*Server) Tools

func (s *Server) Tools() []Tool

Tools lists read-only MCP tools.

type Tool

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

Tool describes an MCP tool.

type ToolResult

type ToolResult struct {
	Content []Content `json:"content"`
	IsError bool      `json:"isError,omitempty"`
}

ToolResult is an MCP tool result.

Jump to

Keyboard shortcuts

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